src/CompileContext.h
author David Anderson <danderson@mozilla.com>
Wed Jul 25 00:48:08 2012 -0700 (2012-07-25)
changeset 91 5f4402180204
parent 86 32ad0523b309
permissions -rw-r--r--
Added clang support. A lot of the motion here is introducing a new offsetof because clang's seems broken?
     1 /*
     2  * Copyright (C) 2012 David Anderson
     3  *
     4  * This file is part of JITCraft.
     5  *
     6  * JITCraft is free software: you can redistribute it and/or modify it under
     7  * the terms of the GNU General Public License as published by the Free
     8  * Software Foundation, either version 3 of the License, or (at your option)
     9  * any later version.
    10  * 
    11  * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
    12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
    14  *
    15  * You should have received a copy of the GNU General Public License along with
    16  * JITCraft. If not, see http://www.gnu.org/licenses/.
    17  */
    18 #ifndef _include_jitcraft_compile_context_h_
    19 #define _include_jitcraft_compile_context_h_
    20 
    21 #include <stdarg.h>
    22 #include "Messages.h"
    23 
    24 namespace ke {
    25 
    26 class Zone;
    27 struct SourcePosition;
    28 
    29 class CompileContext
    30 {
    31     Zone *zone_;
    32     unsigned failures_;
    33     const char *file_;
    34 
    35   public:
    36     CompileContext(Zone *zone, const char *file);
    37     ~CompileContext();
    38 
    39     void reportErrorVa(const SourcePosition &pos, Message msg, va_list ap);
    40     void reportError(const SourcePosition &pos, Message msg, ...);
    41 
    42     unsigned failures() const {
    43         return failures_;
    44     }
    45 };
    46 
    47 }
    48 
    49 #endif // _include_jitcraft_compile_context_h_