zcov: / include/clang/Basic/LangOptions.h


Files: 1 Branches Taken: 0.0% 0 / 0
Generated: 2010-02-10 01:31 Branches Executed: 0.0% 0 / 0
Line Coverage: 100.0% 47 / 47


Programs: 54 Runs 106470


       1                 : //===--- LangOptions.h - C Language Family Language Options -----*- C++ -*-===//
       2                 : //
       3                 : //                     The LLVM Compiler Infrastructure
       4                 : //
       5                 : // This file is distributed under the University of Illinois Open Source
       6                 : // License. See LICENSE.TXT for details.
       7                 : //
       8                 : //===----------------------------------------------------------------------===//
       9                 : //
      10                 : //  This file defines the LangOptions interface.
      11                 : //
      12                 : //===----------------------------------------------------------------------===//
      13                 : 
      14                 : #ifndef LLVM_CLANG_LANGOPTIONS_H
      15                 : #define LLVM_CLANG_LANGOPTIONS_H
      16                 : 
      17                 : #include <string>
      18                 : 
      19                 : namespace clang {
      20                 : 
      21                 : /// LangOptions - This class keeps track of the various options that can be
      22                 : /// enabled, which controls the dialect of C that is accepted.
      23           302723: class LangOptions {
      24                 : public:
      25                 :   unsigned Trigraphs         : 1;  // Trigraphs in source files.
      26                 :   unsigned BCPLComment       : 1;  // BCPL-style '//' comments.
      27                 :   unsigned Bool              : 1;  // 'bool', 'true', 'false' keywords.
      28                 :   unsigned DollarIdents      : 1;  // '$' allowed in identifiers.
      29                 :   unsigned AsmPreprocessor   : 1;  // Preprocessor in asm mode.
      30                 :   unsigned GNUMode           : 1;  // True in gnu99 mode false in c99 mode (etc)
      31                 :   unsigned ImplicitInt       : 1;  // C89 implicit 'int'.
      32                 :   unsigned Digraphs          : 1;  // C94, C99 and C++
      33                 :   unsigned HexFloats         : 1;  // C99 Hexadecimal float constants.
      34                 :   unsigned C99               : 1;  // C99 Support
      35                 :   unsigned Microsoft         : 1;  // Microsoft extensions.
      36                 :   unsigned CPlusPlus         : 1;  // C++ Support
      37                 :   unsigned CPlusPlus0x       : 1;  // C++0x Support
      38                 :   unsigned CXXOperatorNames  : 1;  // Treat C++ operator names as keywords.
      39                 : 
      40                 :   unsigned ObjC1             : 1;  // Objective-C 1 support enabled.
      41                 :   unsigned ObjC2             : 1;  // Objective-C 2 support enabled.
      42                 :   unsigned ObjCNonFragileABI : 1;  // Objective-C modern abi enabled
      43                 :   unsigned ObjCNonFragileABI2 : 1;  // Objective-C enhanced modern abi enabled
      44                 : 
      45                 :   unsigned PascalStrings     : 1;  // Allow Pascal strings
      46                 :   unsigned WritableStrings   : 1;  // Allow writable strings
      47                 :   unsigned LaxVectorConversions : 1;
      48                 :   unsigned AltiVec           : 1;  // Support AltiVec-style vector initializers.
      49                 :   unsigned Exceptions        : 1;  // Support exception handling.
      50                 :   unsigned RTTI              : 1;  // Support RTTI information.
      51                 : 
      52                 :   unsigned NeXTRuntime       : 1; // Use NeXT runtime.
      53                 :   unsigned Freestanding      : 1; // Freestanding implementation
      54                 :   unsigned NoBuiltin         : 1; // Do not use builtin functions (-fno-builtin)
      55                 : 
      56                 :   unsigned ThreadsafeStatics : 1; // Whether static initializers are protected
      57                 :                                   // by locks.
      58                 :   unsigned POSIXThreads      : 1; // Compiling with POSIX thread support
      59                 :                                   // (-pthread)
      60                 :   unsigned Blocks            : 1; // block extension to C
      61                 :   unsigned BlockIntrospection: 1; // block have ObjC type encodings.
      62                 :   unsigned EmitAllDecls      : 1; // Emit all declarations, even if
      63                 :                                   // they are unused.
      64                 :   unsigned MathErrno         : 1; // Math functions must respect errno
      65                 :                                   // (modulo the platform support).
      66                 : 
      67                 :   unsigned OverflowChecking  : 1; // Extension to call a handler function when
      68                 :                                   // signed integer arithmetic overflows.
      69                 : 
      70                 :   unsigned HeinousExtensions : 1; // Extensions that we really don't like and
      71                 :                                   // may be ripped out at any time.
      72                 : 
      73                 :   unsigned Optimize          : 1; // Whether __OPTIMIZE__ should be defined.
      74                 :   unsigned OptimizeSize      : 1; // Whether __OPTIMIZE_SIZE__ should be
      75                 :                                   // defined.
      76                 :   unsigned Static            : 1; // Should __STATIC__ be defined (as
      77                 :                                   // opposed to __DYNAMIC__).
      78                 :   unsigned PICLevel          : 2; // The value for __PIC__, if non-zero.
      79                 : 
      80                 :   unsigned GNUInline         : 1; // Should GNU inline semantics be
      81                 :                                   // used (instead of C99 semantics).
      82                 :   unsigned NoInline          : 1; // Should __NO_INLINE__ be defined.
      83                 : 
      84                 :   unsigned ObjCGCBitmapPrint : 1; // Enable printing of gc's bitmap layout
      85                 :                                   // for __weak/__strong ivars.
      86                 : 
      87                 :   unsigned AccessControl     : 1; // Whether C++ access control should
      88                 :                                   // be enabled.
      89                 :   unsigned CharIsSigned      : 1; // Whether char is a signed or unsigned type
      90                 :   unsigned ShortWChar        : 1; // Force wchar_t to be unsigned short int.
      91                 : 
      92                 :   unsigned OpenCL            : 1; // OpenCL C99 language extensions.
      93                 :   
      94                 :   unsigned AssumeSaneOperatorNew : 1; // Whether to add __attribute__((malloc))
      95                 :                                       // to the declaration of C++'s new
      96                 :                                       // operators
      97                 :   unsigned ElideConstructors : 1; // Whether C++ copy constructors should be
      98                 :                                   // elided if possible.
      99                 :   unsigned CatchUndefined     :1; // Generate code to check for undefined ops.
     100                 : private:
     101                 :   unsigned GC : 2;                // Objective-C Garbage Collection modes.  We
     102                 :                                   // declare this enum as unsigned because MSVC
     103                 :                                   // insists on making enums signed.  Set/Query
     104                 :                                   // this value using accessors.
     105                 :   unsigned SymbolVisibility  : 3; // Symbol's visibility.
     106                 :   unsigned StackProtector    : 2; // Whether stack protectors are on. We declare
     107                 :                                   // this enum as unsigned because MSVC insists
     108                 :                                   // on making enums signed.  Set/Query this
     109                 :                                   // value using accessors.
     110                 : 
     111                 : public:
     112                 :   unsigned InstantiationDepth;    // Maximum template instantiation depth.
     113                 : 
     114                 :   std::string ObjCConstantStringClass;
     115                 : 
     116                 :   enum GCMode { NonGC, GCOnly, HybridGC };
     117                 :   enum StackProtectorMode { SSPOff, SSPOn, SSPReq };
     118                 :   enum VisibilityMode {
     119                 :     Default,
     120                 :     Protected,
     121                 :     Hidden
     122                 :   };
     123                 : 
     124             4077:   LangOptions() {
     125             4077:     Trigraphs = BCPLComment = Bool = DollarIdents = AsmPreprocessor = 0;
     126             4077:     GNUMode = ImplicitInt = Digraphs = 0;
     127             4077:     HexFloats = 0;
     128             4077:     GC = ObjC1 = ObjC2 = ObjCNonFragileABI = ObjCNonFragileABI2 = 0;
     129             4077:     C99 = Microsoft = CPlusPlus = CPlusPlus0x = 0;
     130             4077:     CXXOperatorNames = PascalStrings = WritableStrings = 0;
     131             4077:     Exceptions = Freestanding = NoBuiltin = 0;
     132             4077:     NeXTRuntime = 1;
     133             4077:     RTTI = 1;
     134             4077:     LaxVectorConversions = 1;
     135             4077:     HeinousExtensions = 0;
     136             4077:     AltiVec = OpenCL = StackProtector = 0;
     137                 : 
     138             4077:     SymbolVisibility = (unsigned) Default;
     139                 : 
     140             4077:     ThreadsafeStatics = 1;
     141             4077:     POSIXThreads = 0;
     142             4077:     Blocks = 0;
     143             4077:     BlockIntrospection = 0;
     144             4077:     EmitAllDecls = 0;
     145             4077:     MathErrno = 1;
     146                 : 
     147             4077:     AssumeSaneOperatorNew = 1;
     148                 : 
     149                 :     // FIXME: The default should be 1.
     150             4077:     AccessControl = 0;
     151             4077:     ElideConstructors = 1;
     152                 : 
     153             4077:     OverflowChecking = 0;
     154             4077:     ObjCGCBitmapPrint = 0;
     155                 : 
     156             4077:     InstantiationDepth = 99;
     157                 : 
     158             4077:     Optimize = 0;
     159             4077:     OptimizeSize = 0;
     160                 : 
     161             4077:     Static = 0;
     162             4077:     PICLevel = 0;
     163                 : 
     164             4077:     GNUInline = 0;
     165             4077:     NoInline = 0;
     166                 : 
     167             4077:     CharIsSigned = 1;
     168             4077:     ShortWChar = 0;
     169             4077:     CatchUndefined = 0;
     170             4077:   }
     171                 : 
     172            23272:   GCMode getGCMode() const { return (GCMode) GC; }
     173               96:   void setGCMode(GCMode m) { GC = (unsigned) m; }
     174                 : 
     175            10700:   StackProtectorMode getStackProtectorMode() const {
     176            10700:     return static_cast<StackProtectorMode>(StackProtector);
     177                 :   }
     178             2569:   void setStackProtectorMode(StackProtectorMode m) {
     179             2569:     StackProtector = static_cast<unsigned>(m);
     180             2569:   }
     181                 : 
     182             4004:   VisibilityMode getVisibilityMode() const {
     183             4004:     return (VisibilityMode) SymbolVisibility;
     184                 :   }
     185             2569:   void setVisibilityMode(VisibilityMode v) { SymbolVisibility = (unsigned) v; }
     186                 : };
     187                 : 
     188                 : }  // end namespace clang
     189                 : 
     190                 : #endif

Generated: 2010-02-10 01:31 by zcov