diff options
Diffstat (limited to 'include/clang/Basic/LangOptions.h')
-rw-r--r-- | include/clang/Basic/LangOptions.h | 90 |
1 files changed, 74 insertions, 16 deletions
diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index 5bd0d04..f4db55a 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -15,6 +15,7 @@ #define LLVM_CLANG_LANGOPTIONS_H #include <string> +#include "clang/Basic/Visibility.h" namespace clang { @@ -43,6 +44,8 @@ public: unsigned ObjC2 : 1; // Objective-C 2 support enabled. unsigned ObjCNonFragileABI : 1; // Objective-C modern abi enabled unsigned ObjCNonFragileABI2 : 1; // Objective-C enhanced modern abi enabled + unsigned ObjCDefaultSynthProperties : 1; // Objective-C auto-synthesized properties. + unsigned AppleKext : 1; // Allow apple kext features. unsigned PascalStrings : 1; // Allow Pascal strings unsigned WritableStrings : 1; // Allow writable strings @@ -51,8 +54,10 @@ public: unsigned AltiVec : 1; // Support AltiVec-style vector initializers. unsigned Exceptions : 1; // Support exception handling. unsigned SjLjExceptions : 1; // Use setjmp-longjump exception handling. + unsigned ObjCExceptions : 1; // Support Objective-C exceptions. unsigned RTTI : 1; // Support RTTI information. + unsigned MSBitfields : 1; // MS-compatible structure layout unsigned NeXTRuntime : 1; // Use NeXT runtime. unsigned Freestanding : 1; // Freestanding implementation unsigned NoBuiltin : 1; // Do not use builtin functions (-fno-builtin) @@ -89,8 +94,12 @@ public: unsigned CharIsSigned : 1; // Whether char is a signed or unsigned type unsigned ShortWChar : 1; // Force wchar_t to be unsigned short int. + unsigned ShortEnums : 1; // The enum type will be equivalent to the + // smallest integer type with enough room. + unsigned OpenCL : 1; // OpenCL C99 language extensions. - + unsigned CUDA : 1; // CUDA C++ language extensions. + unsigned AssumeSaneOperatorNew : 1; // Whether to add __attribute__((malloc)) // to the declaration of C++'s new // operators @@ -101,10 +110,16 @@ public: unsigned DumpVTableLayouts : 1; /// Dump the layouts of emitted vtables. unsigned NoConstantCFStrings : 1; // Do not do CF strings unsigned InlineVisibilityHidden : 1; // Whether inline C++ methods have - // hidden visibility by default. + // hidden visibility by default. unsigned SpellChecking : 1; // Whether to perform spell-checking for error // recovery. + unsigned SinglePrecisionConstants : 1; // Whether to treat double-precision + // floating point constants as + // single precision constants. + unsigned FastRelaxedMath : 1; // OpenCL fast relaxed math (on its own, + // defines __FAST_RELAXED_MATH__). + unsigned DefaultFPContract : 1; // Default setting for FP_CONTRACT // FIXME: This is just a temporary option, for testing purposes. unsigned NoBitFieldTypeAlign : 1; @@ -118,47 +133,56 @@ private: public: unsigned InstantiationDepth; // Maximum template instantiation depth. + unsigned NumLargeByValueCopy; // Warn if parameter/return value is larger + // in bytes than this setting. 0 is no check. + + // Version of Microsoft Visual C/C++ we are pretending to be. This is + // temporary until we support all MS extensions used in Windows SDK and stdlib + // headers. Sets _MSC_VER. + unsigned MSCVersion; std::string ObjCConstantStringClass; enum GCMode { NonGC, GCOnly, HybridGC }; enum StackProtectorMode { SSPOff, SSPOn, SSPReq }; - enum VisibilityMode { - Default, - Protected, - Hidden - }; - + enum SignedOverflowBehaviorTy { SOB_Undefined, // Default C standard behavior. SOB_Defined, // -fwrapv SOB_Trapping // -ftrapv }; + /// The name of the handler function to be called when -ftrapv is specified. + /// If none is specified, abort (GCC-compatible behaviour). + std::string OverflowHandler; LangOptions() { Trigraphs = BCPLComment = Bool = DollarIdents = AsmPreprocessor = 0; GNUMode = GNUKeywords = ImplicitInt = Digraphs = 0; HexFloats = 0; GC = ObjC1 = ObjC2 = ObjCNonFragileABI = ObjCNonFragileABI2 = 0; + AppleKext = 0; + ObjCDefaultSynthProperties = 0; NoConstantCFStrings = 0; InlineVisibilityHidden = 0; C99 = Microsoft = Borland = CPlusPlus = CPlusPlus0x = 0; CXXOperatorNames = PascalStrings = WritableStrings = ConstStrings = 0; Exceptions = SjLjExceptions = Freestanding = NoBuiltin = 0; + ObjCExceptions = 1; + MSBitfields = 0; NeXTRuntime = 1; RTTI = 1; LaxVectorConversions = 1; HeinousExtensions = 0; - AltiVec = OpenCL = StackProtector = 0; + AltiVec = OpenCL = CUDA = StackProtector = 0; + + SymbolVisibility = (unsigned) DefaultVisibility; - SymbolVisibility = (unsigned) Default; - ThreadsafeStatics = 1; POSIXThreads = 0; Blocks = 0; EmitAllDecls = 0; MathErrno = 1; SignedOverflowBehavior = SOB_Undefined; - + AssumeSaneOperatorNew = 1; AccessControl = 1; ElideConstructors = 1; @@ -168,6 +192,9 @@ public: InstantiationDepth = 1024; + NumLargeByValueCopy = 0; + MSCVersion = 0; + Optimize = 0; OptimizeSize = 0; @@ -179,10 +206,14 @@ public: CharIsSigned = 1; ShortWChar = 0; + ShortEnums = 0; CatchUndefined = 0; DumpRecordLayouts = 0; DumpVTableLayouts = 0; SpellChecking = 1; + SinglePrecisionConstants = 0; + FastRelaxedMath = 0; + DefaultFPContract = 0; NoBitFieldTypeAlign = 0; } @@ -196,17 +227,44 @@ public: StackProtector = static_cast<unsigned>(m); } - VisibilityMode getVisibilityMode() const { - return (VisibilityMode) SymbolVisibility; + Visibility getVisibilityMode() const { + return (Visibility) SymbolVisibility; } - void setVisibilityMode(VisibilityMode v) { SymbolVisibility = (unsigned) v; } - + void setVisibilityMode(Visibility v) { SymbolVisibility = (unsigned) v; } + SignedOverflowBehaviorTy getSignedOverflowBehavior() const { return (SignedOverflowBehaviorTy)SignedOverflowBehavior; } void setSignedOverflowBehavior(SignedOverflowBehaviorTy V) { SignedOverflowBehavior = (unsigned)V; } + + bool areExceptionsEnabled() const { + return Exceptions; + } +}; + +/// Floating point control options +class FPOptions { +public: + unsigned fp_contract : 1; + + FPOptions() : fp_contract(0) {} + + FPOptions(const LangOptions &LangOpts) : + fp_contract(LangOpts.DefaultFPContract) {} +}; + +/// OpenCL volatile options +class OpenCLOptions { +public: +#define OPENCLEXT(nm) unsigned nm : 1; +#include "clang/Basic/OpenCLExtensions.def" + + OpenCLOptions() { +#define OPENCLEXT(nm) nm = 0; +#include "clang/Basic/OpenCLExtensions.def" + } }; } // end namespace clang |