number of attributes are supported outside of C++ mode. See the Clang
attribute documentation for more information about which attributes are
supported for each syntax.
+
+- Added the ``-std=c17``, ``-std=gnu17``, and ``-std=iso9899:2017`` language
+ mode flags for compatibility with GCC. This enables support for the next
+ version of the C standard, expected to be published by ISO in 2018. The only
+ difference between the ``-std=c17`` and ``-std=c11`` language modes is the
+ value of the ``__STDC_VERSION__`` macro, as C17 is a bug fix release.
Deprecated Compiler Flags
-------------------------
-//===--- LangOptions.def - Language option database -------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the language options. Users of this file must
-// define the LANGOPT macro to make use of this information.
-//
-// Optionally, the user may also define:
-//
-// BENIGN_LANGOPT: for options that don't affect the construction of the AST in
-// any way (that is, the value can be different between an implicit module
-// and the user of that module).
-//
-// COMPATIBLE_LANGOPT: for options that affect the construction of the AST in
-// a way that doesn't prevent interoperability (that is, the value can be
-// different between an explicit module and the user of that module).
-//
-// ENUM_LANGOPT: for options that have enumeration, rather than unsigned, type.
-//
-// VALUE_LANGOPT: for options that describe a value rather than a flag.
-//
-// BENIGN_ENUM_LANGOPT, COMPATIBLE_ENUM_LANGOPT,
-// BENIGN_VALUE_LANGOPT, COMPATIBLE_VALUE_LANGOPT: combinations of the above.
-//
-// FIXME: Clients should be able to more easily select whether they want
-// different levels of compatibility versus how to handle different kinds
-// of option.
-//
-// The Description field should be a noun phrase, for instance "frobbing all
-// widgets" or "C's implicit blintz feature".
-//===----------------------------------------------------------------------===//
-
-#ifndef LANGOPT
-# error Define the LANGOPT macro to handle language options
-#endif
-
-#ifndef COMPATIBLE_LANGOPT
-# define COMPATIBLE_LANGOPT(Name, Bits, Default, Description) \
- LANGOPT(Name, Bits, Default, Description)
-#endif
-
-#ifndef BENIGN_LANGOPT
-# define BENIGN_LANGOPT(Name, Bits, Default, Description) \
- COMPATIBLE_LANGOPT(Name, Bits, Default, Description)
-#endif
-
-#ifndef ENUM_LANGOPT
-# define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
- LANGOPT(Name, Bits, Default, Description)
-#endif
-
-#ifndef COMPATIBLE_ENUM_LANGOPT
-# define COMPATIBLE_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
- ENUM_LANGOPT(Name, Type, Bits, Default, Description)
-#endif
-
-#ifndef BENIGN_ENUM_LANGOPT
-# define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
- COMPATIBLE_ENUM_LANGOPT(Name, Type, Bits, Default, Description)
-#endif
-
-#ifndef VALUE_LANGOPT
-# define VALUE_LANGOPT(Name, Bits, Default, Description) \
- LANGOPT(Name, Bits, Default, Description)
-#endif
-
-#ifndef COMPATIBLE_VALUE_LANGOPT
-# define COMPATIBLE_VALUE_LANGOPT(Name, Bits, Default, Description) \
- VALUE_LANGOPT(Name, Bits, Default, Description)
-#endif
-
-#ifndef BENIGN_VALUE_LANGOPT
-# define BENIGN_VALUE_LANGOPT(Name, Bits, Default, Description) \
- COMPATIBLE_VALUE_LANGOPT(Name, Bits, Default, Description)
-#endif
-
-// FIXME: A lot of the BENIGN_ options should be COMPATIBLE_ instead.
-LANGOPT(C99 , 1, 0, "C99")
-LANGOPT(C11 , 1, 0, "C11")
-LANGOPT(MSVCCompat , 1, 0, "Microsoft Visual C++ full compatibility mode")
-LANGOPT(MicrosoftExt , 1, 0, "Microsoft C++ extensions")
-LANGOPT(AsmBlocks , 1, 0, "Microsoft inline asm blocks")
-LANGOPT(Borland , 1, 0, "Borland extensions")
-LANGOPT(CPlusPlus , 1, 0, "C++")
-LANGOPT(CPlusPlus11 , 1, 0, "C++11")
-LANGOPT(CPlusPlus14 , 1, 0, "C++14")
-LANGOPT(CPlusPlus17 , 1, 0, "C++17")
-LANGOPT(CPlusPlus2a , 1, 0, "C++2a")
-LANGOPT(ObjC1 , 1, 0, "Objective-C 1")
-LANGOPT(ObjC2 , 1, 0, "Objective-C 2")
-BENIGN_LANGOPT(ObjCDefaultSynthProperties , 1, 0,
- "Objective-C auto-synthesized properties")
-BENIGN_LANGOPT(EncodeExtendedBlockSig , 1, 0,
- "Encoding extended block type signature")
-BENIGN_LANGOPT(ObjCInferRelatedResultType , 1, 1,
- "Objective-C related result type inference")
-LANGOPT(AppExt , 1, 0, "Objective-C App Extension")
-LANGOPT(Trigraphs , 1, 0,"trigraphs")
-LANGOPT(LineComment , 1, 0, "'//' comments")
-LANGOPT(Bool , 1, 0, "bool, true, and false keywords")
-LANGOPT(Half , 1, 0, "half keyword")
-LANGOPT(WChar , 1, CPlusPlus, "wchar_t keyword")
-LANGOPT(DeclSpecKeyword , 1, 0, "__declspec keyword")
-BENIGN_LANGOPT(DollarIdents , 1, 1, "'$' in identifiers")
-BENIGN_LANGOPT(AsmPreprocessor, 1, 0, "preprocessor in asm mode")
-LANGOPT(GNUMode , 1, 1, "GNU extensions")
-LANGOPT(GNUKeywords , 1, 1, "GNU keywords")
-BENIGN_LANGOPT(ImplicitInt, 1, !C99 && !CPlusPlus, "C89 implicit 'int'")
-LANGOPT(Digraphs , 1, 0, "digraphs")
-BENIGN_LANGOPT(HexFloats , 1, C99, "C99 hexadecimal float constants")
-LANGOPT(CXXOperatorNames , 1, 0, "C++ operator name keywords")
-LANGOPT(AppleKext , 1, 0, "Apple kext support")
-BENIGN_LANGOPT(PascalStrings, 1, 0, "Pascal string support")
-LANGOPT(WritableStrings , 1, 0, "writable string support")
-LANGOPT(ConstStrings , 1, 0, "const-qualified string support")
-LANGOPT(LaxVectorConversions , 1, 1, "lax vector conversions")
-LANGOPT(AltiVec , 1, 0, "AltiVec-style vector initializers")
-LANGOPT(ZVector , 1, 0, "System z vector extensions")
-LANGOPT(Exceptions , 1, 0, "exception handling")
-LANGOPT(ObjCExceptions , 1, 0, "Objective-C exceptions")
-LANGOPT(CXXExceptions , 1, 0, "C++ exceptions")
-LANGOPT(DWARFExceptions , 1, 0, "dwarf exception handling")
-LANGOPT(SjLjExceptions , 1, 0, "setjmp-longjump exception handling")
-LANGOPT(SEHExceptions , 1, 0, "SEH .xdata exception handling")
-LANGOPT(ExternCNoUnwind , 1, 0, "Assume extern C functions don't unwind")
-LANGOPT(TraditionalCPP , 1, 0, "traditional CPP emulation")
-LANGOPT(RTTI , 1, 1, "run-time type information")
-LANGOPT(RTTIData , 1, 1, "emit run-time type information data")
-LANGOPT(MSBitfields , 1, 0, "Microsoft-compatible structure layout")
-LANGOPT(Freestanding, 1, 0, "freestanding implementation")
-LANGOPT(NoBuiltin , 1, 0, "disable builtin functions")
-LANGOPT(NoMathBuiltin , 1, 0, "disable math builtin functions")
-LANGOPT(GNUAsm , 1, 1, "GNU-style inline assembly")
-LANGOPT(CoroutinesTS , 1, 0, "C++ coroutines TS")
-LANGOPT(RelaxedTemplateTemplateArgs, 1, 0, "C++17 relaxed matching of template template arguments")
-
-LANGOPT(DoubleSquareBracketAttributes, 1, 0, "'[[]]' attributes extension for all language standard modes")
-
-BENIGN_LANGOPT(ThreadsafeStatics , 1, 1, "thread-safe static initializers")
-LANGOPT(POSIXThreads , 1, 0, "POSIX thread support")
-LANGOPT(Blocks , 1, 0, "blocks extension to C")
-BENIGN_LANGOPT(EmitAllDecls , 1, 0, "emitting all declarations")
-LANGOPT(MathErrno , 1, 1, "errno in math functions")
-BENIGN_LANGOPT(HeinousExtensions , 1, 0, "extensions that we really don't like and may be ripped out at any time")
-LANGOPT(Modules , 1, 0, "modules extension to C")
-COMPATIBLE_LANGOPT(ModulesTS , 1, 0, "C++ Modules TS")
-BENIGN_ENUM_LANGOPT(CompilingModule, CompilingModuleKind, 2, CMK_None,
- "compiling a module interface")
-BENIGN_LANGOPT(CompilingPCH, 1, 0, "building a pch")
-COMPATIBLE_LANGOPT(ModulesDeclUse , 1, 0, "require declaration of module uses")
-BENIGN_LANGOPT(ModulesSearchAll , 1, 1, "searching even non-imported modules to find unresolved references")
-COMPATIBLE_LANGOPT(ModulesStrictDeclUse, 1, 0, "requiring declaration of module uses and all headers to be in modules")
-BENIGN_LANGOPT(ModulesErrorRecovery, 1, 1, "automatically importing modules as needed when performing error recovery")
-BENIGN_LANGOPT(ImplicitModules, 1, 1, "building modules that are not specified via -fmodule-file")
-COMPATIBLE_LANGOPT(ModulesLocalVisibility, 1, 0, "local submodule visibility")
-COMPATIBLE_LANGOPT(Optimize , 1, 0, "__OPTIMIZE__ predefined macro")
-COMPATIBLE_LANGOPT(OptimizeSize , 1, 0, "__OPTIMIZE_SIZE__ predefined macro")
-COMPATIBLE_LANGOPT(Static , 1, 0, "__STATIC__ predefined macro (as opposed to __DYNAMIC__)")
-VALUE_LANGOPT(PackStruct , 32, 0,
- "default struct packing maximum alignment")
-VALUE_LANGOPT(MaxTypeAlign , 32, 0,
- "default maximum alignment for types")
-VALUE_LANGOPT(AlignDouble , 1, 0, "Controls if doubles should be aligned to 8 bytes (x86 only)")
-COMPATIBLE_VALUE_LANGOPT(PICLevel , 2, 0, "__PIC__ level")
-COMPATIBLE_VALUE_LANGOPT(PIE , 1, 0, "is pie")
-COMPATIBLE_LANGOPT(GNUInline , 1, 0, "GNU inline semantics")
-COMPATIBLE_LANGOPT(NoInlineDefine , 1, 0, "__NO_INLINE__ predefined macro")
-COMPATIBLE_LANGOPT(Deprecated , 1, 0, "__DEPRECATED predefined macro")
-COMPATIBLE_LANGOPT(FastMath , 1, 0, "fast FP math optimizations, and __FAST_MATH__ predefined macro")
-COMPATIBLE_LANGOPT(FiniteMathOnly , 1, 0, "__FINITE_MATH_ONLY__ predefined macro")
-COMPATIBLE_LANGOPT(UnsafeFPMath , 1, 0, "Unsafe Floating Point Math")
-
-BENIGN_LANGOPT(ObjCGCBitmapPrint , 1, 0, "printing of GC's bitmap layout for __weak/__strong ivars")
-
-BENIGN_LANGOPT(AccessControl , 1, 1, "C++ access control")
-LANGOPT(CharIsSigned , 1, 1, "signed char")
-LANGOPT(WCharSize , 4, 0, "width of wchar_t")
-LANGOPT(WCharIsSigned , 1, 0, "signed or unsigned wchar_t")
-ENUM_LANGOPT(MSPointerToMemberRepresentationMethod, PragmaMSPointersToMembersKind, 2, PPTMK_BestCase, "member-pointer representation method")
+//===--- LangOptions.def - Language option database -------------*- C++ -*-===//\r
+//\r
+// The LLVM Compiler Infrastructure\r
+//\r
+// This file is distributed under the University of Illinois Open Source\r
+// License. See LICENSE.TXT for details.\r
+//\r
+//===----------------------------------------------------------------------===//\r
+//\r
+// This file defines the language options. Users of this file must\r
+// define the LANGOPT macro to make use of this information.\r
+//\r
+// Optionally, the user may also define:\r
+//\r
+// BENIGN_LANGOPT: for options that don't affect the construction of the AST in\r
+// any way (that is, the value can be different between an implicit module\r
+// and the user of that module).\r
+//\r
+// COMPATIBLE_LANGOPT: for options that affect the construction of the AST in\r
+// a way that doesn't prevent interoperability (that is, the value can be\r
+// different between an explicit module and the user of that module).\r
+//\r
+// ENUM_LANGOPT: for options that have enumeration, rather than unsigned, type.\r
+//\r
+// VALUE_LANGOPT: for options that describe a value rather than a flag.\r
+//\r
+// BENIGN_ENUM_LANGOPT, COMPATIBLE_ENUM_LANGOPT,\r
+// BENIGN_VALUE_LANGOPT, COMPATIBLE_VALUE_LANGOPT: combinations of the above.\r
+//\r
+// FIXME: Clients should be able to more easily select whether they want\r
+// different levels of compatibility versus how to handle different kinds\r
+// of option.\r
+//\r
+// The Description field should be a noun phrase, for instance "frobbing all\r
+// widgets" or "C's implicit blintz feature".\r
+//===----------------------------------------------------------------------===//\r
+\r
+#ifndef LANGOPT\r
+# error Define the LANGOPT macro to handle language options\r
+#endif\r
+\r
+#ifndef COMPATIBLE_LANGOPT\r
+# define COMPATIBLE_LANGOPT(Name, Bits, Default, Description) \\r
+ LANGOPT(Name, Bits, Default, Description)\r
+#endif\r
+\r
+#ifndef BENIGN_LANGOPT\r
+# define BENIGN_LANGOPT(Name, Bits, Default, Description) \\r
+ COMPATIBLE_LANGOPT(Name, Bits, Default, Description)\r
+#endif\r
+\r
+#ifndef ENUM_LANGOPT\r
+# define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \\r
+ LANGOPT(Name, Bits, Default, Description)\r
+#endif\r
+\r
+#ifndef COMPATIBLE_ENUM_LANGOPT\r
+# define COMPATIBLE_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \\r
+ ENUM_LANGOPT(Name, Type, Bits, Default, Description)\r
+#endif\r
+\r
+#ifndef BENIGN_ENUM_LANGOPT\r
+# define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \\r
+ COMPATIBLE_ENUM_LANGOPT(Name, Type, Bits, Default, Description)\r
+#endif\r
+\r
+#ifndef VALUE_LANGOPT\r
+# define VALUE_LANGOPT(Name, Bits, Default, Description) \\r
+ LANGOPT(Name, Bits, Default, Description)\r
+#endif\r
+\r
+#ifndef COMPATIBLE_VALUE_LANGOPT\r
+# define COMPATIBLE_VALUE_LANGOPT(Name, Bits, Default, Description) \\r
+ VALUE_LANGOPT(Name, Bits, Default, Description)\r
+#endif\r
+\r
+#ifndef BENIGN_VALUE_LANGOPT\r
+# define BENIGN_VALUE_LANGOPT(Name, Bits, Default, Description) \\r
+ COMPATIBLE_VALUE_LANGOPT(Name, Bits, Default, Description)\r
+#endif\r
+\r
+// FIXME: A lot of the BENIGN_ options should be COMPATIBLE_ instead.\r
+LANGOPT(C99 , 1, 0, "C99")\r
+LANGOPT(C11 , 1, 0, "C11")\r
+LANGOPT(C17 , 1, 0, "C17")\r
+LANGOPT(MSVCCompat , 1, 0, "Microsoft Visual C++ full compatibility mode")\r
+LANGOPT(MicrosoftExt , 1, 0, "Microsoft C++ extensions")\r
+LANGOPT(AsmBlocks , 1, 0, "Microsoft inline asm blocks")\r
+LANGOPT(Borland , 1, 0, "Borland extensions")\r
+LANGOPT(CPlusPlus , 1, 0, "C++")\r
+LANGOPT(CPlusPlus11 , 1, 0, "C++11")\r
+LANGOPT(CPlusPlus14 , 1, 0, "C++14")\r
+LANGOPT(CPlusPlus17 , 1, 0, "C++17")\r
+LANGOPT(CPlusPlus2a , 1, 0, "C++2a")\r
+LANGOPT(ObjC1 , 1, 0, "Objective-C 1")\r
+LANGOPT(ObjC2 , 1, 0, "Objective-C 2")\r
+BENIGN_LANGOPT(ObjCDefaultSynthProperties , 1, 0,\r
+ "Objective-C auto-synthesized properties")\r
+BENIGN_LANGOPT(EncodeExtendedBlockSig , 1, 0,\r
+ "Encoding extended block type signature")\r
+BENIGN_LANGOPT(ObjCInferRelatedResultType , 1, 1,\r
+ "Objective-C related result type inference")\r
+LANGOPT(AppExt , 1, 0, "Objective-C App Extension")\r
+LANGOPT(Trigraphs , 1, 0,"trigraphs")\r
+LANGOPT(LineComment , 1, 0, "'//' comments")\r
+LANGOPT(Bool , 1, 0, "bool, true, and false keywords")\r
+LANGOPT(Half , 1, 0, "half keyword")\r
+LANGOPT(WChar , 1, CPlusPlus, "wchar_t keyword")\r
+LANGOPT(DeclSpecKeyword , 1, 0, "__declspec keyword")\r
+BENIGN_LANGOPT(DollarIdents , 1, 1, "'$' in identifiers")\r
+BENIGN_LANGOPT(AsmPreprocessor, 1, 0, "preprocessor in asm mode")\r
+LANGOPT(GNUMode , 1, 1, "GNU extensions")\r
+LANGOPT(GNUKeywords , 1, 1, "GNU keywords")\r
+BENIGN_LANGOPT(ImplicitInt, 1, !C99 && !CPlusPlus, "C89 implicit 'int'")\r
+LANGOPT(Digraphs , 1, 0, "digraphs")\r
+BENIGN_LANGOPT(HexFloats , 1, C99, "C99 hexadecimal float constants")\r
+LANGOPT(CXXOperatorNames , 1, 0, "C++ operator name keywords")\r
+LANGOPT(AppleKext , 1, 0, "Apple kext support")\r
+BENIGN_LANGOPT(PascalStrings, 1, 0, "Pascal string support")\r
+LANGOPT(WritableStrings , 1, 0, "writable string support")\r
+LANGOPT(ConstStrings , 1, 0, "const-qualified string support")\r
+LANGOPT(LaxVectorConversions , 1, 1, "lax vector conversions")\r
+LANGOPT(AltiVec , 1, 0, "AltiVec-style vector initializers")\r
+LANGOPT(ZVector , 1, 0, "System z vector extensions")\r
+LANGOPT(Exceptions , 1, 0, "exception handling")\r
+LANGOPT(ObjCExceptions , 1, 0, "Objective-C exceptions")\r
+LANGOPT(CXXExceptions , 1, 0, "C++ exceptions")\r
+LANGOPT(DWARFExceptions , 1, 0, "dwarf exception handling")\r
+LANGOPT(SjLjExceptions , 1, 0, "setjmp-longjump exception handling")\r
+LANGOPT(SEHExceptions , 1, 0, "SEH .xdata exception handling")\r
+LANGOPT(ExternCNoUnwind , 1, 0, "Assume extern C functions don't unwind")\r
+LANGOPT(TraditionalCPP , 1, 0, "traditional CPP emulation")\r
+LANGOPT(RTTI , 1, 1, "run-time type information")\r
+LANGOPT(RTTIData , 1, 1, "emit run-time type information data")\r
+LANGOPT(MSBitfields , 1, 0, "Microsoft-compatible structure layout")\r
+LANGOPT(Freestanding, 1, 0, "freestanding implementation")\r
+LANGOPT(NoBuiltin , 1, 0, "disable builtin functions")\r
+LANGOPT(NoMathBuiltin , 1, 0, "disable math builtin functions")\r
+LANGOPT(GNUAsm , 1, 1, "GNU-style inline assembly")\r
+LANGOPT(CoroutinesTS , 1, 0, "C++ coroutines TS")\r
+LANGOPT(RelaxedTemplateTemplateArgs, 1, 0, "C++17 relaxed matching of template template arguments")\r
+\r
+LANGOPT(DoubleSquareBracketAttributes, 1, 0, "'[[]]' attributes extension for all language standard modes")\r
+\r
+BENIGN_LANGOPT(ThreadsafeStatics , 1, 1, "thread-safe static initializers")\r
+LANGOPT(POSIXThreads , 1, 0, "POSIX thread support")\r
+LANGOPT(Blocks , 1, 0, "blocks extension to C")\r
+BENIGN_LANGOPT(EmitAllDecls , 1, 0, "emitting all declarations")\r
+LANGOPT(MathErrno , 1, 1, "errno in math functions")\r
+BENIGN_LANGOPT(HeinousExtensions , 1, 0, "extensions that we really don't like and may be ripped out at any time")\r
+LANGOPT(Modules , 1, 0, "modules extension to C")\r
+COMPATIBLE_LANGOPT(ModulesTS , 1, 0, "C++ Modules TS")\r
+BENIGN_ENUM_LANGOPT(CompilingModule, CompilingModuleKind, 2, CMK_None,\r
+ "compiling a module interface")\r
+BENIGN_LANGOPT(CompilingPCH, 1, 0, "building a pch")\r
+COMPATIBLE_LANGOPT(ModulesDeclUse , 1, 0, "require declaration of module uses")\r
+BENIGN_LANGOPT(ModulesSearchAll , 1, 1, "searching even non-imported modules to find unresolved references")\r
+COMPATIBLE_LANGOPT(ModulesStrictDeclUse, 1, 0, "requiring declaration of module uses and all headers to be in modules")\r
+BENIGN_LANGOPT(ModulesErrorRecovery, 1, 1, "automatically importing modules as needed when performing error recovery")\r
+BENIGN_LANGOPT(ImplicitModules, 1, 1, "building modules that are not specified via -fmodule-file")\r
+COMPATIBLE_LANGOPT(ModulesLocalVisibility, 1, 0, "local submodule visibility")\r
+COMPATIBLE_LANGOPT(Optimize , 1, 0, "__OPTIMIZE__ predefined macro")\r
+COMPATIBLE_LANGOPT(OptimizeSize , 1, 0, "__OPTIMIZE_SIZE__ predefined macro")\r
+COMPATIBLE_LANGOPT(Static , 1, 0, "__STATIC__ predefined macro (as opposed to __DYNAMIC__)")\r
+VALUE_LANGOPT(PackStruct , 32, 0,\r
+ "default struct packing maximum alignment")\r
+VALUE_LANGOPT(MaxTypeAlign , 32, 0,\r
+ "default maximum alignment for types")\r
+VALUE_LANGOPT(AlignDouble , 1, 0, "Controls if doubles should be aligned to 8 bytes (x86 only)")\r
+COMPATIBLE_VALUE_LANGOPT(PICLevel , 2, 0, "__PIC__ level")\r
+COMPATIBLE_VALUE_LANGOPT(PIE , 1, 0, "is pie")\r
+COMPATIBLE_LANGOPT(GNUInline , 1, 0, "GNU inline semantics")\r
+COMPATIBLE_LANGOPT(NoInlineDefine , 1, 0, "__NO_INLINE__ predefined macro")\r
+COMPATIBLE_LANGOPT(Deprecated , 1, 0, "__DEPRECATED predefined macro")\r
+COMPATIBLE_LANGOPT(FastMath , 1, 0, "fast FP math optimizations, and __FAST_MATH__ predefined macro")\r
+COMPATIBLE_LANGOPT(FiniteMathOnly , 1, 0, "__FINITE_MATH_ONLY__ predefined macro")\r
+COMPATIBLE_LANGOPT(UnsafeFPMath , 1, 0, "Unsafe Floating Point Math")\r
+\r
+BENIGN_LANGOPT(ObjCGCBitmapPrint , 1, 0, "printing of GC's bitmap layout for __weak/__strong ivars")\r
+\r
+BENIGN_LANGOPT(AccessControl , 1, 1, "C++ access control")\r
+LANGOPT(CharIsSigned , 1, 1, "signed char")\r
+LANGOPT(WCharSize , 4, 0, "width of wchar_t")\r
+LANGOPT(WCharIsSigned , 1, 0, "signed or unsigned wchar_t")\r
+ENUM_LANGOPT(MSPointerToMemberRepresentationMethod, PragmaMSPointersToMembersKind, 2, PPTMK_BestCase, "member-pointer representation method")\r
ENUM_LANGOPT(DefaultCallingConv, DefaultCallingConvention, 3, DCC_None, "default calling convention")
LANGOPT(ShortEnums , 1, 0, "short enum types")
-//===--- LangStandard.h -----------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_FRONTEND_LANGSTANDARD_H
-#define LLVM_CLANG_FRONTEND_LANGSTANDARD_H
-
-#include "clang/Basic/LLVM.h"
-#include "clang/Frontend/FrontendOptions.h"
-#include "llvm/ADT/StringRef.h"
-
-namespace clang {
-
-namespace frontend {
-
-enum LangFeatures {
- LineComment = (1 << 0),
- C99 = (1 << 1),
- C11 = (1 << 2),
- CPlusPlus = (1 << 3),
- CPlusPlus11 = (1 << 4),
- CPlusPlus14 = (1 << 5),
- CPlusPlus17 = (1 << 6),
- CPlusPlus2a = (1 << 7),
- Digraphs = (1 << 8),
- GNUMode = (1 << 9),
- HexFloat = (1 << 10),
- ImplicitInt = (1 << 11),
- OpenCL = (1 << 12)
-};
-
-}
-
-/// LangStandard - Information about the properties of a particular language
-/// standard.
-struct LangStandard {
- enum Kind {
-#define LANGSTANDARD(id, name, lang, desc, features) \
- lang_##id,
-#include "clang/Frontend/LangStandards.def"
- lang_unspecified
- };
-
- const char *ShortName;
- const char *Description;
- unsigned Flags;
- InputKind::Language Language;
-
-public:
- /// getName - Get the name of this standard.
- const char *getName() const { return ShortName; }
-
- /// getDescription - Get the description of this standard.
- const char *getDescription() const { return Description; }
-
- /// Get the language that this standard describes.
- InputKind::Language getLanguage() const { return Language; }
-
- /// Language supports '//' comments.
- bool hasLineComments() const { return Flags & frontend::LineComment; }
-
- /// isC99 - Language is a superset of C99.
- bool isC99() const { return Flags & frontend::C99; }
-
- /// isC11 - Language is a superset of C11.
- bool isC11() const { return Flags & frontend::C11; }
-
- /// isCPlusPlus - Language is a C++ variant.
- bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; }
-
- /// isCPlusPlus11 - Language is a C++11 variant (or later).
- bool isCPlusPlus11() const { return Flags & frontend::CPlusPlus11; }
-
- /// isCPlusPlus14 - Language is a C++14 variant (or later).
- bool isCPlusPlus14() const { return Flags & frontend::CPlusPlus14; }
-
- /// isCPlusPlus17 - Language is a C++17 variant (or later).
- bool isCPlusPlus17() const { return Flags & frontend::CPlusPlus17; }
-
- /// isCPlusPlus2a - Language is a post-C++17 variant (or later).
- bool isCPlusPlus2a() const { return Flags & frontend::CPlusPlus2a; }
-
-
- /// hasDigraphs - Language supports digraphs.
- bool hasDigraphs() const { return Flags & frontend::Digraphs; }
-
- /// isGNUMode - Language includes GNU extensions.
- bool isGNUMode() const { return Flags & frontend::GNUMode; }
-
- /// hasHexFloats - Language supports hexadecimal float constants.
- bool hasHexFloats() const { return Flags & frontend::HexFloat; }
-
- /// hasImplicitInt - Language allows variables to be typed as int implicitly.
- bool hasImplicitInt() const { return Flags & frontend::ImplicitInt; }
-
- /// isOpenCL - Language is a OpenCL variant.
- bool isOpenCL() const { return Flags & frontend::OpenCL; }
-
- static const LangStandard &getLangStandardForKind(Kind K);
- static const LangStandard *getLangStandardForName(StringRef Name);
-};
-
-} // end namespace clang
-
-#endif
+//===--- LangStandard.h -----------------------------------------*- C++ -*-===//\r
+//\r
+// The LLVM Compiler Infrastructure\r
+//\r
+// This file is distributed under the University of Illinois Open Source\r
+// License. See LICENSE.TXT for details.\r
+//\r
+//===----------------------------------------------------------------------===//\r
+\r
+#ifndef LLVM_CLANG_FRONTEND_LANGSTANDARD_H\r
+#define LLVM_CLANG_FRONTEND_LANGSTANDARD_H\r
+\r
+#include "clang/Basic/LLVM.h"\r
+#include "clang/Frontend/FrontendOptions.h"\r
+#include "llvm/ADT/StringRef.h"\r
+\r
+namespace clang {\r
+\r
+namespace frontend {\r
+\r
+enum LangFeatures {\r
+ LineComment = (1 << 0),\r
+ C99 = (1 << 1),\r
+ C11 = (1 << 2),\r
+ C17 = (1 << 3),\r
+ CPlusPlus = (1 << 4),\r
+ CPlusPlus11 = (1 << 5),\r
+ CPlusPlus14 = (1 << 6),\r
+ CPlusPlus17 = (1 << 7),\r
+ CPlusPlus2a = (1 << 8),\r
+ Digraphs = (1 << 9),\r
+ GNUMode = (1 << 10),\r
+ HexFloat = (1 << 11),\r
+ ImplicitInt = (1 << 12),\r
+ OpenCL = (1 << 13)\r
+};\r
+\r
+}\r
+\r
+/// LangStandard - Information about the properties of a particular language\r
+/// standard.\r
+struct LangStandard {\r
+ enum Kind {\r
+#define LANGSTANDARD(id, name, lang, desc, features) \\r
+ lang_##id,\r
+#include "clang/Frontend/LangStandards.def"\r
+ lang_unspecified\r
+ };\r
+\r
+ const char *ShortName;\r
+ const char *Description;\r
+ unsigned Flags;\r
+ InputKind::Language Language;\r
+\r
+public:\r
+ /// getName - Get the name of this standard.\r
+ const char *getName() const { return ShortName; }\r
+\r
+ /// getDescription - Get the description of this standard.\r
+ const char *getDescription() const { return Description; }\r
+\r
+ /// Get the language that this standard describes.\r
+ InputKind::Language getLanguage() const { return Language; }\r
+\r
+ /// Language supports '//' comments.\r
+ bool hasLineComments() const { return Flags & frontend::LineComment; }\r
+\r
+ /// isC99 - Language is a superset of C99.\r
+ bool isC99() const { return Flags & frontend::C99; }\r
+\r
+ /// isC11 - Language is a superset of C11.\r
+ bool isC11() const { return Flags & frontend::C11; }\r
+\r
+ /// isC17 - Language is a superset of C17.\r
+ bool isC17() const { return Flags & frontend::C17; }\r
+\r
+ /// isCPlusPlus - Language is a C++ variant.\r
+ bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; }\r
+\r
+ /// isCPlusPlus11 - Language is a C++11 variant (or later).\r
+ bool isCPlusPlus11() const { return Flags & frontend::CPlusPlus11; }\r
+\r
+ /// isCPlusPlus14 - Language is a C++14 variant (or later).\r
+ bool isCPlusPlus14() const { return Flags & frontend::CPlusPlus14; }\r
+\r
+ /// isCPlusPlus17 - Language is a C++17 variant (or later).\r
+ bool isCPlusPlus17() const { return Flags & frontend::CPlusPlus17; }\r
+\r
+ /// isCPlusPlus2a - Language is a post-C++17 variant (or later).\r
+ bool isCPlusPlus2a() const { return Flags & frontend::CPlusPlus2a; }\r
+\r
+\r
+ /// hasDigraphs - Language supports digraphs.\r
+ bool hasDigraphs() const { return Flags & frontend::Digraphs; }\r
+\r
+ /// isGNUMode - Language includes GNU extensions.\r
+ bool isGNUMode() const { return Flags & frontend::GNUMode; }\r
+\r
+ /// hasHexFloats - Language supports hexadecimal float constants.\r
+ bool hasHexFloats() const { return Flags & frontend::HexFloat; }\r
+\r
+ /// hasImplicitInt - Language allows variables to be typed as int implicitly.\r
+ bool hasImplicitInt() const { return Flags & frontend::ImplicitInt; }\r
+\r
+ /// isOpenCL - Language is a OpenCL variant.\r
+ bool isOpenCL() const { return Flags & frontend::OpenCL; }\r
+\r
+ static const LangStandard &getLangStandardForKind(Kind K);\r
+ static const LangStandard *getLangStandardForName(StringRef Name);\r
+};\r
+\r
+} // end namespace clang\r
+\r
+#endif\r
-//===-- LangStandards.def - Language Standard Data --------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LANGSTANDARD
-#error "LANGSTANDARD must be defined before including this file"
-#endif
-
-/// LANGSTANDARD(IDENT, NAME, LANG, DESC, FEATURES)
-///
-/// \param IDENT - The name of the standard as a C++ identifier.
-/// \param NAME - The name of the standard.
-/// \param LANG - The InputKind::Language for which this is a standard.
-/// \param DESC - A short description of the standard.
-/// \param FEATURES - The standard features as flags, these are enums from the
-/// clang::frontend namespace, which is assumed to be be available.
-
-/// LANGSTANDARD_ALIAS(IDENT, ALIAS)
-/// \param IDENT - The name of the standard as a C++ identifier.
-/// \param ALIAS - The alias of the standard.
-
-/// LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS)
-/// Same as LANGSTANDARD_ALIAS, but for a deprecated alias.
-
-#ifndef LANGSTANDARD_ALIAS
-#define LANGSTANDARD_ALIAS(IDENT, ALIAS)
-#endif
-
-#ifndef LANGSTANDARD_ALIAS_DEPR
-#define LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS) LANGSTANDARD_ALIAS(IDENT, ALIAS)
-#endif
-
-// C89-ish modes.
-LANGSTANDARD(c89, "c89",
- C, "ISO C 1990",
- ImplicitInt)
-LANGSTANDARD_ALIAS(c89, "c90")
-LANGSTANDARD_ALIAS(c89, "iso9899:1990")
-
-LANGSTANDARD(c94, "iso9899:199409",
- C, "ISO C 1990 with amendment 1",
- Digraphs | ImplicitInt)
-
-LANGSTANDARD(gnu89, "gnu89",
- C, "ISO C 1990 with GNU extensions",
- LineComment | Digraphs | GNUMode | ImplicitInt)
-LANGSTANDARD_ALIAS(gnu89, "gnu90")
-
-// C99-ish modes
-LANGSTANDARD(c99, "c99",
- C, "ISO C 1999",
- LineComment | C99 | Digraphs | HexFloat)
-LANGSTANDARD_ALIAS(c99, "iso9899:1999")
-LANGSTANDARD_ALIAS_DEPR(c99, "c9x")
-LANGSTANDARD_ALIAS_DEPR(c99, "iso9899:199x")
-
-LANGSTANDARD(gnu99, "gnu99",
- C, "ISO C 1999 with GNU extensions",
- LineComment | C99 | Digraphs | GNUMode | HexFloat)
-LANGSTANDARD_ALIAS_DEPR(gnu99, "gnu9x")
-
-// C11 modes
-LANGSTANDARD(c11, "c11",
- C, "ISO C 2011",
- LineComment | C99 | C11 | Digraphs | HexFloat)
-LANGSTANDARD_ALIAS(c11, "iso9899:2011")
-LANGSTANDARD_ALIAS_DEPR(c11, "c1x")
-LANGSTANDARD_ALIAS_DEPR(c11, "iso9899:201x")
-
-LANGSTANDARD(gnu11, "gnu11",
- C, "ISO C 2011 with GNU extensions",
- LineComment | C99 | C11 | Digraphs | GNUMode | HexFloat)
-LANGSTANDARD_ALIAS_DEPR(gnu11, "gnu1x")
-
-// C++ modes
-LANGSTANDARD(cxx98, "c++98",
- CXX, "ISO C++ 1998 with amendments",
- LineComment | CPlusPlus | Digraphs)
-LANGSTANDARD_ALIAS(cxx98, "c++03")
-
-LANGSTANDARD(gnucxx98, "gnu++98",
- CXX, "ISO C++ 1998 with amendments and GNU extensions",
- LineComment | CPlusPlus | Digraphs | GNUMode)
-LANGSTANDARD_ALIAS(gnucxx98, "gnu++03")
-
-LANGSTANDARD(cxx11, "c++11",
- CXX, "ISO C++ 2011 with amendments",
- LineComment | CPlusPlus | CPlusPlus11 | Digraphs)
-LANGSTANDARD_ALIAS_DEPR(cxx11, "c++0x")
-
-LANGSTANDARD(gnucxx11, "gnu++11", CXX,
- "ISO C++ 2011 with amendments and GNU extensions",
- LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode)
-LANGSTANDARD_ALIAS_DEPR(gnucxx11, "gnu++0x")
-
-LANGSTANDARD(cxx14, "c++14",
- CXX, "ISO C++ 2014 with amendments",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs)
-LANGSTANDARD_ALIAS_DEPR(cxx14, "c++1y")
-
-LANGSTANDARD(gnucxx14, "gnu++14",
- CXX, "ISO C++ 2014 with amendments and GNU extensions",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs |
- GNUMode)
-LANGSTANDARD_ALIAS_DEPR(gnucxx14, "gnu++1y")
-
-LANGSTANDARD(cxx17, "c++17",
- CXX, "ISO C++ 2017 with amendments",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- Digraphs | HexFloat)
-LANGSTANDARD_ALIAS_DEPR(cxx17, "c++1z")
-
-LANGSTANDARD(gnucxx17, "gnu++17",
- CXX, "ISO C++ 2017 with amendments and GNU extensions",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- Digraphs | HexFloat | GNUMode)
-LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z")
-
-LANGSTANDARD(cxx2a, "c++2a",
- CXX, "Working draft for ISO C++ 2020",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- CPlusPlus2a | Digraphs | HexFloat)
-
-LANGSTANDARD(gnucxx2a, "gnu++2a",
- CXX, "Working draft for ISO C++ 2020 with GNU extensions",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- CPlusPlus2a | Digraphs | HexFloat | GNUMode)
-
-// OpenCL
-LANGSTANDARD(opencl10, "cl1.0",
- OpenCL, "OpenCL 1.0",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
-LANGSTANDARD_ALIAS_DEPR(opencl10, "cl")
-
-LANGSTANDARD(opencl11, "cl1.1",
- OpenCL, "OpenCL 1.1",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
-LANGSTANDARD(opencl12, "cl1.2",
- OpenCL, "OpenCL 1.2",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
-LANGSTANDARD(opencl20, "cl2.0",
- OpenCL, "OpenCL 2.0",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
-
-LANGSTANDARD_ALIAS_DEPR(opencl10, "CL")
-LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1")
-LANGSTANDARD_ALIAS_DEPR(opencl12, "CL1.2")
-LANGSTANDARD_ALIAS_DEPR(opencl20, "CL2.0")
-
-// CUDA
-LANGSTANDARD(cuda, "cuda", CUDA, "NVIDIA CUDA(tm)",
- LineComment | CPlusPlus | Digraphs)
-
-#undef LANGSTANDARD
-#undef LANGSTANDARD_ALIAS
-#undef LANGSTANDARD_ALIAS_DEPR
+//===-- LangStandards.def - Language Standard Data --------------*- C++ -*-===//\r
+//\r
+// The LLVM Compiler Infrastructure\r
+//\r
+// This file is distributed under the University of Illinois Open Source\r
+// License. See LICENSE.TXT for details.\r
+//\r
+//===----------------------------------------------------------------------===//\r
+\r
+#ifndef LANGSTANDARD\r
+#error "LANGSTANDARD must be defined before including this file"\r
+#endif\r
+\r
+/// LANGSTANDARD(IDENT, NAME, LANG, DESC, FEATURES)\r
+///\r
+/// \param IDENT - The name of the standard as a C++ identifier.\r
+/// \param NAME - The name of the standard.\r
+/// \param LANG - The InputKind::Language for which this is a standard.\r
+/// \param DESC - A short description of the standard.\r
+/// \param FEATURES - The standard features as flags, these are enums from the\r
+/// clang::frontend namespace, which is assumed to be be available.\r
+\r
+/// LANGSTANDARD_ALIAS(IDENT, ALIAS)\r
+/// \param IDENT - The name of the standard as a C++ identifier.\r
+/// \param ALIAS - The alias of the standard.\r
+\r
+/// LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS)\r
+/// Same as LANGSTANDARD_ALIAS, but for a deprecated alias.\r
+\r
+#ifndef LANGSTANDARD_ALIAS\r
+#define LANGSTANDARD_ALIAS(IDENT, ALIAS)\r
+#endif\r
+\r
+#ifndef LANGSTANDARD_ALIAS_DEPR\r
+#define LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS) LANGSTANDARD_ALIAS(IDENT, ALIAS)\r
+#endif\r
+\r
+// C89-ish modes.\r
+LANGSTANDARD(c89, "c89",\r
+ C, "ISO C 1990",\r
+ ImplicitInt)\r
+LANGSTANDARD_ALIAS(c89, "c90")\r
+LANGSTANDARD_ALIAS(c89, "iso9899:1990")\r
+\r
+LANGSTANDARD(c94, "iso9899:199409",\r
+ C, "ISO C 1990 with amendment 1",\r
+ Digraphs | ImplicitInt)\r
+\r
+LANGSTANDARD(gnu89, "gnu89",\r
+ C, "ISO C 1990 with GNU extensions",\r
+ LineComment | Digraphs | GNUMode | ImplicitInt)\r
+LANGSTANDARD_ALIAS(gnu89, "gnu90")\r
+\r
+// C99-ish modes\r
+LANGSTANDARD(c99, "c99",\r
+ C, "ISO C 1999",\r
+ LineComment | C99 | Digraphs | HexFloat)\r
+LANGSTANDARD_ALIAS(c99, "iso9899:1999")\r
+LANGSTANDARD_ALIAS_DEPR(c99, "c9x")\r
+LANGSTANDARD_ALIAS_DEPR(c99, "iso9899:199x")\r
+\r
+LANGSTANDARD(gnu99, "gnu99",\r
+ C, "ISO C 1999 with GNU extensions",\r
+ LineComment | C99 | Digraphs | GNUMode | HexFloat)\r
+LANGSTANDARD_ALIAS_DEPR(gnu99, "gnu9x")\r
+\r
+// C11 modes\r
+LANGSTANDARD(c11, "c11",\r
+ C, "ISO C 2011",\r
+ LineComment | C99 | C11 | Digraphs | HexFloat)\r
+LANGSTANDARD_ALIAS(c11, "iso9899:2011")\r
+LANGSTANDARD_ALIAS_DEPR(c11, "c1x")\r
+LANGSTANDARD_ALIAS_DEPR(c11, "iso9899:201x")\r
+\r
+LANGSTANDARD(gnu11, "gnu11",\r
+ C, "ISO C 2011 with GNU extensions",\r
+ LineComment | C99 | C11 | Digraphs | GNUMode | HexFloat)\r
+LANGSTANDARD_ALIAS_DEPR(gnu11, "gnu1x")\r
+\r
+// C17 modes\r
+LANGSTANDARD(c17, "c17",\r
+ C, "ISO C 2017",\r
+ LineComment | C99 | C11 | C17 | Digraphs | HexFloat)\r
+LANGSTANDARD_ALIAS(c17, "iso9899:2017")\r
+LANGSTANDARD(gnu17, "gnu17",\r
+ C, "ISO C 2017 with GNU extensions",\r
+ LineComment | C99 | C11 | C17 | Digraphs | GNUMode | HexFloat)\r
+\r
+// C++ modes\r
+LANGSTANDARD(cxx98, "c++98",\r
+ CXX, "ISO C++ 1998 with amendments",\r
+ LineComment | CPlusPlus | Digraphs)\r
+LANGSTANDARD_ALIAS(cxx98, "c++03")\r
+\r
+LANGSTANDARD(gnucxx98, "gnu++98",\r
+ CXX, "ISO C++ 1998 with amendments and GNU extensions",\r
+ LineComment | CPlusPlus | Digraphs | GNUMode)\r
+LANGSTANDARD_ALIAS(gnucxx98, "gnu++03")\r
+\r
+LANGSTANDARD(cxx11, "c++11",\r
+ CXX, "ISO C++ 2011 with amendments",\r
+ LineComment | CPlusPlus | CPlusPlus11 | Digraphs)\r
+LANGSTANDARD_ALIAS_DEPR(cxx11, "c++0x")\r
+\r
+LANGSTANDARD(gnucxx11, "gnu++11", CXX,\r
+ "ISO C++ 2011 with amendments and GNU extensions",\r
+ LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode)\r
+LANGSTANDARD_ALIAS_DEPR(gnucxx11, "gnu++0x")\r
+\r
+LANGSTANDARD(cxx14, "c++14",\r
+ CXX, "ISO C++ 2014 with amendments",\r
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs)\r
+LANGSTANDARD_ALIAS_DEPR(cxx14, "c++1y")\r
+\r
+LANGSTANDARD(gnucxx14, "gnu++14",\r
+ CXX, "ISO C++ 2014 with amendments and GNU extensions",\r
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs |\r
+ GNUMode)\r
+LANGSTANDARD_ALIAS_DEPR(gnucxx14, "gnu++1y")\r
+\r
+LANGSTANDARD(cxx17, "c++17",\r
+ CXX, "ISO C++ 2017 with amendments",\r
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |\r
+ Digraphs | HexFloat)\r
+LANGSTANDARD_ALIAS_DEPR(cxx17, "c++1z")\r
+\r
+LANGSTANDARD(gnucxx17, "gnu++17",\r
+ CXX, "ISO C++ 2017 with amendments and GNU extensions",\r
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |\r
+ Digraphs | HexFloat | GNUMode)\r
+LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z")\r
+\r
+LANGSTANDARD(cxx2a, "c++2a",\r
+ CXX, "Working draft for ISO C++ 2020",\r
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |\r
+ CPlusPlus2a | Digraphs | HexFloat)\r
+\r
+LANGSTANDARD(gnucxx2a, "gnu++2a",\r
+ CXX, "Working draft for ISO C++ 2020 with GNU extensions",\r
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |\r
+ CPlusPlus2a | Digraphs | HexFloat | GNUMode)\r
+\r
+// OpenCL\r
+LANGSTANDARD(opencl10, "cl1.0",\r
+ OpenCL, "OpenCL 1.0",\r
+ LineComment | C99 | Digraphs | HexFloat | OpenCL)\r
+LANGSTANDARD_ALIAS_DEPR(opencl10, "cl")\r
+\r
+LANGSTANDARD(opencl11, "cl1.1",\r
+ OpenCL, "OpenCL 1.1",\r
+ LineComment | C99 | Digraphs | HexFloat | OpenCL)\r
+LANGSTANDARD(opencl12, "cl1.2",\r
+ OpenCL, "OpenCL 1.2",\r
+ LineComment | C99 | Digraphs | HexFloat | OpenCL)\r
+LANGSTANDARD(opencl20, "cl2.0",\r
+ OpenCL, "OpenCL 2.0",\r
+ LineComment | C99 | Digraphs | HexFloat | OpenCL)\r
+\r
+LANGSTANDARD_ALIAS_DEPR(opencl10, "CL")\r
+LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1")\r
+LANGSTANDARD_ALIAS_DEPR(opencl12, "CL1.2")\r
+LANGSTANDARD_ALIAS_DEPR(opencl20, "CL2.0")\r
+\r
+// CUDA\r
+LANGSTANDARD(cuda, "cuda", CUDA, "NVIDIA CUDA(tm)",\r
+ LineComment | CPlusPlus | Digraphs)\r
+\r
+#undef LANGSTANDARD\r
+#undef LANGSTANDARD_ALIAS\r
+#undef LANGSTANDARD_ALIAS_DEPR\r
Opts.AddPath(Prefix.str() + A->getValue(), frontend::Angled, false, true);
}
- for (const Arg *A : Args.filtered(OPT_idirafter))
- Opts.AddPath(A->getValue(), frontend::After, false, true);
- for (const Arg *A : Args.filtered(OPT_iquote))
- Opts.AddPath(A->getValue(), frontend::Quoted, false, true);
- for (const Arg *A : Args.filtered(OPT_isystem, OPT_iwithsysroot))
- Opts.AddPath(A->getValue(), frontend::System, false,
- !A->getOption().matches(OPT_iwithsysroot));
- for (const Arg *A : Args.filtered(OPT_iframework))
- Opts.AddPath(A->getValue(), frontend::System, true, true);
- for (const Arg *A : Args.filtered(OPT_iframeworkwithsysroot))
- Opts.AddPath(A->getValue(), frontend::System, /*IsFramework=*/true,
- /*IgnoreSysRoot=*/false);
-
- // Add the paths for the various language specific isystem flags.
- for (const Arg *A : Args.filtered(OPT_c_isystem))
- Opts.AddPath(A->getValue(), frontend::CSystem, false, true);
- for (const Arg *A : Args.filtered(OPT_cxx_isystem))
- Opts.AddPath(A->getValue(), frontend::CXXSystem, false, true);
- for (const Arg *A : Args.filtered(OPT_objc_isystem))
- Opts.AddPath(A->getValue(), frontend::ObjCSystem, false,true);
- for (const Arg *A : Args.filtered(OPT_objcxx_isystem))
- Opts.AddPath(A->getValue(), frontend::ObjCXXSystem, false, true);
-
- // Add the internal paths from a driver that detects standard include paths.
- for (const Arg *A :
- Args.filtered(OPT_internal_isystem, OPT_internal_externc_isystem)) {
- frontend::IncludeDirGroup Group = frontend::System;
- if (A->getOption().matches(OPT_internal_externc_isystem))
- Group = frontend::ExternCSystem;
- Opts.AddPath(A->getValue(), Group, false, true);
- }
-
- // Add the path prefixes which are implicitly treated as being system headers.
- for (const Arg *A :
- Args.filtered(OPT_system_header_prefix, OPT_no_system_header_prefix))
- Opts.AddSystemHeaderPrefix(
- A->getValue(), A->getOption().matches(OPT_system_header_prefix));
-
- for (const Arg *A : Args.filtered(OPT_ivfsoverlay))
- Opts.AddVFSOverlayFile(A->getValue());
-}
-
-void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
- const llvm::Triple &T,
- PreprocessorOptions &PPOpts,
- LangStandard::Kind LangStd) {
- // Set some properties which depend solely on the input kind; it would be nice
- // to move these to the language standard, and have the driver resolve the
- // input kind + language standard.
- //
- // FIXME: Perhaps a better model would be for a single source file to have
- // multiple language standards (C / C++ std, ObjC std, OpenCL std, OpenMP std)
- // simultaneously active?
- if (IK.getLanguage() == InputKind::Asm) {
- Opts.AsmPreprocessor = 1;
- } else if (IK.isObjectiveC()) {
- Opts.ObjC1 = Opts.ObjC2 = 1;
- }
-
- if (LangStd == LangStandard::lang_unspecified) {
- // Based on the base language, pick one.
- switch (IK.getLanguage()) {
- case InputKind::Unknown:
- case InputKind::LLVM_IR:
- llvm_unreachable("Invalid input kind!");
- case InputKind::OpenCL:
- LangStd = LangStandard::lang_opencl10;
- break;
- case InputKind::CUDA:
- LangStd = LangStandard::lang_cuda;
- break;
- case InputKind::Asm:
- case InputKind::C:
- // The PS4 uses C99 as the default C standard.
- if (T.isPS4())
- LangStd = LangStandard::lang_gnu99;
- else
- LangStd = LangStandard::lang_gnu11;
- break;
- case InputKind::ObjC:
- LangStd = LangStandard::lang_gnu11;
- break;
- case InputKind::CXX:
- case InputKind::ObjCXX:
- // The PS4 uses C++11 as the default C++ standard.
- if (T.isPS4())
- LangStd = LangStandard::lang_gnucxx11;
- else
- LangStd = LangStandard::lang_gnucxx98;
- break;
- case InputKind::RenderScript:
- LangStd = LangStandard::lang_c99;
- break;
- }
- }
-
- const LangStandard &Std = LangStandard::getLangStandardForKind(LangStd);
- Opts.LineComment = Std.hasLineComments();
- Opts.C99 = Std.isC99();
- Opts.C11 = Std.isC11();
- Opts.CPlusPlus = Std.isCPlusPlus();
- Opts.CPlusPlus11 = Std.isCPlusPlus11();
- Opts.CPlusPlus14 = Std.isCPlusPlus14();
- Opts.CPlusPlus17 = Std.isCPlusPlus17();
- Opts.CPlusPlus2a = Std.isCPlusPlus2a();
- Opts.Digraphs = Std.hasDigraphs();
- Opts.GNUMode = Std.isGNUMode();
- Opts.GNUInline = !Opts.C99 && !Opts.CPlusPlus;
- Opts.HexFloats = Std.hasHexFloats();
- Opts.ImplicitInt = Std.hasImplicitInt();
-
- // Set OpenCL Version.
- Opts.OpenCL = Std.isOpenCL();
- if (LangStd == LangStandard::lang_opencl10)
- Opts.OpenCLVersion = 100;
- else if (LangStd == LangStandard::lang_opencl11)
- Opts.OpenCLVersion = 110;
- else if (LangStd == LangStandard::lang_opencl12)
- Opts.OpenCLVersion = 120;
- else if (LangStd == LangStandard::lang_opencl20)
- Opts.OpenCLVersion = 200;
-
- // OpenCL has some additional defaults.
- if (Opts.OpenCL) {
- Opts.AltiVec = 0;
- Opts.ZVector = 0;
- Opts.LaxVectorConversions = 0;
- Opts.setDefaultFPContractMode(LangOptions::FPC_On);
- Opts.NativeHalfType = 1;
- Opts.NativeHalfArgsAndReturns = 1;
- // Include default header file for OpenCL.
- if (Opts.IncludeDefaultHeader) {
- PPOpts.Includes.push_back("opencl-c.h");
- }
- }
-
- Opts.CUDA = IK.getLanguage() == InputKind::CUDA;
- if (Opts.CUDA)
- // Set default FP_CONTRACT to FAST.
- Opts.setDefaultFPContractMode(LangOptions::FPC_Fast);
-
- Opts.RenderScript = IK.getLanguage() == InputKind::RenderScript;
- if (Opts.RenderScript) {
- Opts.NativeHalfType = 1;
- Opts.NativeHalfArgsAndReturns = 1;
- }
-
- // OpenCL and C++ both have bool, true, false keywords.
- Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
-
- // OpenCL has half keyword
- Opts.Half = Opts.OpenCL;
-
- // C++ has wchar_t keyword.
- Opts.WChar = Opts.CPlusPlus;
-
- Opts.GNUKeywords = Opts.GNUMode;
- Opts.CXXOperatorNames = Opts.CPlusPlus;
-
- Opts.AlignedAllocation = Opts.CPlusPlus17;
-
- Opts.DollarIdents = !Opts.AsmPreprocessor;
-}
-
-/// Attempt to parse a visibility value out of the given argument.
-static Visibility parseVisibility(Arg *arg, ArgList &args,
- DiagnosticsEngine &diags) {
- StringRef value = arg->getValue();
- if (value == "default") {
- return DefaultVisibility;
- } else if (value == "hidden" || value == "internal") {
- return HiddenVisibility;
- } else if (value == "protected") {
- // FIXME: diagnose if target does not support protected visibility
- return ProtectedVisibility;
- }
-
- diags.Report(diag::err_drv_invalid_value)
- << arg->getAsString(args) << value;
- return DefaultVisibility;
-}
-
-/// Check if input file kind and language standard are compatible.
-static bool IsInputCompatibleWithStandard(InputKind IK,
- const LangStandard &S) {
- switch (IK.getLanguage()) {
- case InputKind::Unknown:
- case InputKind::LLVM_IR:
- llvm_unreachable("should not parse language flags for this input");
-
- case InputKind::C:
- case InputKind::ObjC:
- case InputKind::RenderScript:
- return S.getLanguage() == InputKind::C;
-
- case InputKind::OpenCL:
- return S.getLanguage() == InputKind::OpenCL;
-
- case InputKind::CXX:
- case InputKind::ObjCXX:
+ for (const Arg *A : Args.filtered(OPT_idirafter))\r
+ Opts.AddPath(A->getValue(), frontend::After, false, true);\r
+ for (const Arg *A : Args.filtered(OPT_iquote))\r
+ Opts.AddPath(A->getValue(), frontend::Quoted, false, true);\r
+ for (const Arg *A : Args.filtered(OPT_isystem, OPT_iwithsysroot))\r
+ Opts.AddPath(A->getValue(), frontend::System, false,\r
+ !A->getOption().matches(OPT_iwithsysroot));\r
+ for (const Arg *A : Args.filtered(OPT_iframework))\r
+ Opts.AddPath(A->getValue(), frontend::System, true, true);\r
+ for (const Arg *A : Args.filtered(OPT_iframeworkwithsysroot))\r
+ Opts.AddPath(A->getValue(), frontend::System, /*IsFramework=*/true,\r
+ /*IgnoreSysRoot=*/false);\r
+\r
+ // Add the paths for the various language specific isystem flags.\r
+ for (const Arg *A : Args.filtered(OPT_c_isystem))\r
+ Opts.AddPath(A->getValue(), frontend::CSystem, false, true);\r
+ for (const Arg *A : Args.filtered(OPT_cxx_isystem))\r
+ Opts.AddPath(A->getValue(), frontend::CXXSystem, false, true);\r
+ for (const Arg *A : Args.filtered(OPT_objc_isystem))\r
+ Opts.AddPath(A->getValue(), frontend::ObjCSystem, false,true);\r
+ for (const Arg *A : Args.filtered(OPT_objcxx_isystem))\r
+ Opts.AddPath(A->getValue(), frontend::ObjCXXSystem, false, true);\r
+\r
+ // Add the internal paths from a driver that detects standard include paths.\r
+ for (const Arg *A :\r
+ Args.filtered(OPT_internal_isystem, OPT_internal_externc_isystem)) {\r
+ frontend::IncludeDirGroup Group = frontend::System;\r
+ if (A->getOption().matches(OPT_internal_externc_isystem))\r
+ Group = frontend::ExternCSystem;\r
+ Opts.AddPath(A->getValue(), Group, false, true);\r
+ }\r
+\r
+ // Add the path prefixes which are implicitly treated as being system headers.\r
+ for (const Arg *A :\r
+ Args.filtered(OPT_system_header_prefix, OPT_no_system_header_prefix))\r
+ Opts.AddSystemHeaderPrefix(\r
+ A->getValue(), A->getOption().matches(OPT_system_header_prefix));\r
+\r
+ for (const Arg *A : Args.filtered(OPT_ivfsoverlay))\r
+ Opts.AddVFSOverlayFile(A->getValue());\r
+}\r
+\r
+void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,\r
+ const llvm::Triple &T,\r
+ PreprocessorOptions &PPOpts,\r
+ LangStandard::Kind LangStd) {\r
+ // Set some properties which depend solely on the input kind; it would be nice\r
+ // to move these to the language standard, and have the driver resolve the\r
+ // input kind + language standard.\r
+ //\r
+ // FIXME: Perhaps a better model would be for a single source file to have\r
+ // multiple language standards (C / C++ std, ObjC std, OpenCL std, OpenMP std)\r
+ // simultaneously active?\r
+ if (IK.getLanguage() == InputKind::Asm) {\r
+ Opts.AsmPreprocessor = 1;\r
+ } else if (IK.isObjectiveC()) {\r
+ Opts.ObjC1 = Opts.ObjC2 = 1;\r
+ }\r
+\r
+ if (LangStd == LangStandard::lang_unspecified) {\r
+ // Based on the base language, pick one.\r
+ switch (IK.getLanguage()) {\r
+ case InputKind::Unknown:\r
+ case InputKind::LLVM_IR:\r
+ llvm_unreachable("Invalid input kind!");\r
+ case InputKind::OpenCL:\r
+ LangStd = LangStandard::lang_opencl10;\r
+ break;\r
+ case InputKind::CUDA:\r
+ LangStd = LangStandard::lang_cuda;\r
+ break;\r
+ case InputKind::Asm:\r
+ case InputKind::C:\r
+ // The PS4 uses C99 as the default C standard.\r
+ if (T.isPS4())\r
+ LangStd = LangStandard::lang_gnu99;\r
+ else\r
+ LangStd = LangStandard::lang_gnu11;\r
+ break;\r
+ case InputKind::ObjC:\r
+ LangStd = LangStandard::lang_gnu11;\r
+ break;\r
+ case InputKind::CXX:\r
+ case InputKind::ObjCXX:\r
+ // The PS4 uses C++11 as the default C++ standard.\r
+ if (T.isPS4())\r
+ LangStd = LangStandard::lang_gnucxx11;\r
+ else\r
+ LangStd = LangStandard::lang_gnucxx98;\r
+ break;\r
+ case InputKind::RenderScript:\r
+ LangStd = LangStandard::lang_c99;\r
+ break;\r
+ }\r
+ }\r
+\r
+ const LangStandard &Std = LangStandard::getLangStandardForKind(LangStd);\r
+ Opts.LineComment = Std.hasLineComments();\r
+ Opts.C99 = Std.isC99();\r
+ Opts.C11 = Std.isC11();\r
+ Opts.C17 = Std.isC17();\r
+ Opts.CPlusPlus = Std.isCPlusPlus();\r
+ Opts.CPlusPlus11 = Std.isCPlusPlus11();\r
+ Opts.CPlusPlus14 = Std.isCPlusPlus14();\r
+ Opts.CPlusPlus17 = Std.isCPlusPlus17();\r
+ Opts.CPlusPlus2a = Std.isCPlusPlus2a();\r
+ Opts.Digraphs = Std.hasDigraphs();\r
+ Opts.GNUMode = Std.isGNUMode();\r
+ Opts.GNUInline = !Opts.C99 && !Opts.CPlusPlus;\r
+ Opts.HexFloats = Std.hasHexFloats();\r
+ Opts.ImplicitInt = Std.hasImplicitInt();\r
+\r
+ // Set OpenCL Version.\r
+ Opts.OpenCL = Std.isOpenCL();\r
+ if (LangStd == LangStandard::lang_opencl10)\r
+ Opts.OpenCLVersion = 100;\r
+ else if (LangStd == LangStandard::lang_opencl11)\r
+ Opts.OpenCLVersion = 110;\r
+ else if (LangStd == LangStandard::lang_opencl12)\r
+ Opts.OpenCLVersion = 120;\r
+ else if (LangStd == LangStandard::lang_opencl20)\r
+ Opts.OpenCLVersion = 200;\r
+\r
+ // OpenCL has some additional defaults.\r
+ if (Opts.OpenCL) {\r
+ Opts.AltiVec = 0;\r
+ Opts.ZVector = 0;\r
+ Opts.LaxVectorConversions = 0;\r
+ Opts.setDefaultFPContractMode(LangOptions::FPC_On);\r
+ Opts.NativeHalfType = 1;\r
+ Opts.NativeHalfArgsAndReturns = 1;\r
+ // Include default header file for OpenCL.\r
+ if (Opts.IncludeDefaultHeader) {\r
+ PPOpts.Includes.push_back("opencl-c.h");\r
+ }\r
+ }\r
+\r
+ Opts.CUDA = IK.getLanguage() == InputKind::CUDA;\r
+ if (Opts.CUDA)\r
+ // Set default FP_CONTRACT to FAST.\r
+ Opts.setDefaultFPContractMode(LangOptions::FPC_Fast);\r
+\r
+ Opts.RenderScript = IK.getLanguage() == InputKind::RenderScript;\r
+ if (Opts.RenderScript) {\r
+ Opts.NativeHalfType = 1;\r
+ Opts.NativeHalfArgsAndReturns = 1;\r
+ }\r
+\r
+ // OpenCL and C++ both have bool, true, false keywords.\r
+ Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;\r
+\r
+ // OpenCL has half keyword\r
+ Opts.Half = Opts.OpenCL;\r
+\r
+ // C++ has wchar_t keyword.\r
+ Opts.WChar = Opts.CPlusPlus;\r
+\r
+ Opts.GNUKeywords = Opts.GNUMode;\r
+ Opts.CXXOperatorNames = Opts.CPlusPlus;\r
+\r
+ Opts.AlignedAllocation = Opts.CPlusPlus17;\r
+\r
+ Opts.DollarIdents = !Opts.AsmPreprocessor;\r
+}\r
+\r
+/// Attempt to parse a visibility value out of the given argument.\r
+static Visibility parseVisibility(Arg *arg, ArgList &args,\r
+ DiagnosticsEngine &diags) {\r
+ StringRef value = arg->getValue();\r
+ if (value == "default") {\r
+ return DefaultVisibility;\r
+ } else if (value == "hidden" || value == "internal") {\r
+ return HiddenVisibility;\r
+ } else if (value == "protected") {\r
+ // FIXME: diagnose if target does not support protected visibility\r
+ return ProtectedVisibility;\r
+ }\r
+\r
+ diags.Report(diag::err_drv_invalid_value)\r
+ << arg->getAsString(args) << value;\r
+ return DefaultVisibility;\r
+}\r
+\r
+/// Check if input file kind and language standard are compatible.\r
+static bool IsInputCompatibleWithStandard(InputKind IK,\r
+ const LangStandard &S) {\r
+ switch (IK.getLanguage()) {\r
+ case InputKind::Unknown:\r
+ case InputKind::LLVM_IR:\r
+ llvm_unreachable("should not parse language flags for this input");\r
+\r
+ case InputKind::C:\r
+ case InputKind::ObjC:\r
+ case InputKind::RenderScript:\r
+ return S.getLanguage() == InputKind::C;\r
+\r
+ case InputKind::OpenCL:\r
+ return S.getLanguage() == InputKind::OpenCL;\r
+\r
+ case InputKind::CXX:\r
+ case InputKind::ObjCXX:\r
return S.getLanguage() == InputKind::CXX;
case InputKind::CUDA:
DefineTypeSize(Prefix + Twine(TypeWidth) + "_MAX__", Ty, TI, Builder);
DefineFmt(Prefix + Twine(TypeWidth), Ty, TI, Builder);
}
-
-static void DefineFastIntType(unsigned TypeWidth, bool IsSigned,
- const TargetInfo &TI, MacroBuilder &Builder) {
- // stdint.h currently defines the fast int types as equivalent to the least
- // types.
- TargetInfo::IntType Ty = TI.getLeastIntTypeByWidth(TypeWidth, IsSigned);
- if (Ty == TargetInfo::NoInt)
- return;
-
- const char *Prefix = IsSigned ? "__INT_FAST" : "__UINT_FAST";
- DefineType(Prefix + Twine(TypeWidth) + "_TYPE__", Ty, Builder);
- DefineTypeSize(Prefix + Twine(TypeWidth) + "_MAX__", Ty, TI, Builder);
-
- DefineFmt(Prefix + Twine(TypeWidth), Ty, TI, Builder);
-}
-
-
-/// Get the value the ATOMIC_*_LOCK_FREE macro should have for a type with
-/// the specified properties.
-static const char *getLockFreeValue(unsigned TypeWidth, unsigned TypeAlign,
- unsigned InlineWidth) {
- // Fully-aligned, power-of-2 sizes no larger than the inline
- // width will be inlined as lock-free operations.
- if (TypeWidth == TypeAlign && (TypeWidth & (TypeWidth - 1)) == 0 &&
- TypeWidth <= InlineWidth)
- return "2"; // "always lock free"
- // We cannot be certain what operations the lib calls might be
- // able to implement as lock-free on future processors.
- return "1"; // "sometimes lock free"
-}
-
-/// \brief Add definitions required for a smooth interaction between
-/// Objective-C++ automated reference counting and libstdc++ (4.2).
-static void AddObjCXXARCLibstdcxxDefines(const LangOptions &LangOpts,
- MacroBuilder &Builder) {
- Builder.defineMacro("_GLIBCXX_PREDEFINED_OBJC_ARC_IS_SCALAR");
-
- std::string Result;
- {
- // Provide specializations for the __is_scalar type trait so that
- // lifetime-qualified objects are not considered "scalar" types, which
- // libstdc++ uses as an indicator of the presence of trivial copy, assign,
- // default-construct, and destruct semantics (none of which hold for
- // lifetime-qualified objects in ARC).
- llvm::raw_string_ostream Out(Result);
-
- Out << "namespace std {\n"
- << "\n"
- << "struct __true_type;\n"
- << "struct __false_type;\n"
- << "\n";
-
- Out << "template<typename _Tp> struct __is_scalar;\n"
- << "\n";
-
- if (LangOpts.ObjCAutoRefCount) {
- Out << "template<typename _Tp>\n"
- << "struct __is_scalar<__attribute__((objc_ownership(strong))) _Tp> {\n"
- << " enum { __value = 0 };\n"
- << " typedef __false_type __type;\n"
- << "};\n"
- << "\n";
- }
-
- if (LangOpts.ObjCWeak) {
- Out << "template<typename _Tp>\n"
- << "struct __is_scalar<__attribute__((objc_ownership(weak))) _Tp> {\n"
- << " enum { __value = 0 };\n"
- << " typedef __false_type __type;\n"
- << "};\n"
- << "\n";
- }
-
- if (LangOpts.ObjCAutoRefCount) {
- Out << "template<typename _Tp>\n"
- << "struct __is_scalar<__attribute__((objc_ownership(autoreleasing)))"
- << " _Tp> {\n"
- << " enum { __value = 0 };\n"
- << " typedef __false_type __type;\n"
- << "};\n"
- << "\n";
- }
-
- Out << "}\n";
- }
- Builder.append(Result);
-}
-
-static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
- const LangOptions &LangOpts,
- const FrontendOptions &FEOpts,
- MacroBuilder &Builder) {
- if (!LangOpts.MSVCCompat && !LangOpts.TraditionalCPP)
- Builder.defineMacro("__STDC__");
- if (LangOpts.Freestanding)
- Builder.defineMacro("__STDC_HOSTED__", "0");
- else
- Builder.defineMacro("__STDC_HOSTED__");
-
- if (!LangOpts.CPlusPlus) {
- if (LangOpts.C11)
- Builder.defineMacro("__STDC_VERSION__", "201112L");
- else if (LangOpts.C99)
- Builder.defineMacro("__STDC_VERSION__", "199901L");
- else if (!LangOpts.GNUMode && LangOpts.Digraphs)
- Builder.defineMacro("__STDC_VERSION__", "199409L");
- } else {
- // FIXME: Use correct value for C++20.
- if (LangOpts.CPlusPlus2a)
- Builder.defineMacro("__cplusplus", "201707L");
- // C++17 [cpp.predefined]p1:
- // The name __cplusplus is defined to the value 201703L when compiling a
- // C++ translation unit.
- else if (LangOpts.CPlusPlus17)
- Builder.defineMacro("__cplusplus", "201703L");
- // C++1y [cpp.predefined]p1:
- // The name __cplusplus is defined to the value 201402L when compiling a
- // C++ translation unit.
- else if (LangOpts.CPlusPlus14)
- Builder.defineMacro("__cplusplus", "201402L");
- // C++11 [cpp.predefined]p1:
- // The name __cplusplus is defined to the value 201103L when compiling a
- // C++ translation unit.
- else if (LangOpts.CPlusPlus11)
- Builder.defineMacro("__cplusplus", "201103L");
- // C++03 [cpp.predefined]p1:
- // The name __cplusplus is defined to the value 199711L when compiling a
- // C++ translation unit.
- else
- Builder.defineMacro("__cplusplus", "199711L");
-
- // C++1z [cpp.predefined]p1:
- // An integer literal of type std::size_t whose value is the alignment
- // guaranteed by a call to operator new(std::size_t)
- //
- // We provide this in all language modes, since it seems generally useful.
- Builder.defineMacro("__STDCPP_DEFAULT_NEW_ALIGNMENT__",
- Twine(TI.getNewAlign() / TI.getCharWidth()) +
- TI.getTypeConstantSuffix(TI.getSizeType()));
- }
-
- // In C11 these are environment macros. In C++11 they are only defined
- // as part of <cuchar>. To prevent breakage when mixing C and C++
- // code, define these macros unconditionally. We can define them
- // unconditionally, as Clang always uses UTF-16 and UTF-32 for 16-bit
- // and 32-bit character literals.
- Builder.defineMacro("__STDC_UTF_16__", "1");
- Builder.defineMacro("__STDC_UTF_32__", "1");
-
- if (LangOpts.ObjC1)
- Builder.defineMacro("__OBJC__");
-
- // OpenCL v1.0/1.1 s6.9, v1.2/2.0 s6.10: Preprocessor Directives and Macros.
- if (LangOpts.OpenCL) {
- // OpenCL v1.0 and v1.1 do not have a predefined macro to indicate the
- // language standard with which the program is compiled. __OPENCL_VERSION__
- // is for the OpenCL version supported by the OpenCL device, which is not
- // necessarily the language standard with which the program is compiled.
- // A shared OpenCL header file requires a macro to indicate the language
- // standard. As a workaround, __OPENCL_C_VERSION__ is defined for
- // OpenCL v1.0 and v1.1.
- switch (LangOpts.OpenCLVersion) {
- case 100:
- Builder.defineMacro("__OPENCL_C_VERSION__", "100");
- break;
- case 110:
- Builder.defineMacro("__OPENCL_C_VERSION__", "110");
- break;
- case 120:
- Builder.defineMacro("__OPENCL_C_VERSION__", "120");
- break;
- case 200:
- Builder.defineMacro("__OPENCL_C_VERSION__", "200");
- break;
- default:
- llvm_unreachable("Unsupported OpenCL version");
- }
- Builder.defineMacro("CL_VERSION_1_0", "100");
- Builder.defineMacro("CL_VERSION_1_1", "110");
- Builder.defineMacro("CL_VERSION_1_2", "120");
- Builder.defineMacro("CL_VERSION_2_0", "200");
-
- if (TI.isLittleEndian())
- Builder.defineMacro("__ENDIAN_LITTLE__");
-
- if (LangOpts.FastRelaxedMath)
- Builder.defineMacro("__FAST_RELAXED_MATH__");
- }
- // Not "standard" per se, but available even with the -undef flag.
- if (LangOpts.AsmPreprocessor)
- Builder.defineMacro("__ASSEMBLER__");
- if (LangOpts.CUDA)
- Builder.defineMacro("__CUDA__");
-}
-
-/// Initialize the predefined C++ language feature test macros defined in
-/// ISO/IEC JTC1/SC22/WG21 (C++) SD-6: "SG10 Feature Test Recommendations".
-static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
- MacroBuilder &Builder) {
- // C++98 features.
- if (LangOpts.RTTI)
+\r
+static void DefineFastIntType(unsigned TypeWidth, bool IsSigned,\r
+ const TargetInfo &TI, MacroBuilder &Builder) {\r
+ // stdint.h currently defines the fast int types as equivalent to the least\r
+ // types.\r
+ TargetInfo::IntType Ty = TI.getLeastIntTypeByWidth(TypeWidth, IsSigned);\r
+ if (Ty == TargetInfo::NoInt)\r
+ return;\r
+\r
+ const char *Prefix = IsSigned ? "__INT_FAST" : "__UINT_FAST";\r
+ DefineType(Prefix + Twine(TypeWidth) + "_TYPE__", Ty, Builder);\r
+ DefineTypeSize(Prefix + Twine(TypeWidth) + "_MAX__", Ty, TI, Builder);\r
+\r
+ DefineFmt(Prefix + Twine(TypeWidth), Ty, TI, Builder);\r
+}\r
+\r
+\r
+/// Get the value the ATOMIC_*_LOCK_FREE macro should have for a type with\r
+/// the specified properties.\r
+static const char *getLockFreeValue(unsigned TypeWidth, unsigned TypeAlign,\r
+ unsigned InlineWidth) {\r
+ // Fully-aligned, power-of-2 sizes no larger than the inline\r
+ // width will be inlined as lock-free operations.\r
+ if (TypeWidth == TypeAlign && (TypeWidth & (TypeWidth - 1)) == 0 &&\r
+ TypeWidth <= InlineWidth)\r
+ return "2"; // "always lock free"\r
+ // We cannot be certain what operations the lib calls might be\r
+ // able to implement as lock-free on future processors.\r
+ return "1"; // "sometimes lock free"\r
+}\r
+\r
+/// \brief Add definitions required for a smooth interaction between\r
+/// Objective-C++ automated reference counting and libstdc++ (4.2).\r
+static void AddObjCXXARCLibstdcxxDefines(const LangOptions &LangOpts, \r
+ MacroBuilder &Builder) {\r
+ Builder.defineMacro("_GLIBCXX_PREDEFINED_OBJC_ARC_IS_SCALAR");\r
+ \r
+ std::string Result;\r
+ {\r
+ // Provide specializations for the __is_scalar type trait so that \r
+ // lifetime-qualified objects are not considered "scalar" types, which\r
+ // libstdc++ uses as an indicator of the presence of trivial copy, assign,\r
+ // default-construct, and destruct semantics (none of which hold for\r
+ // lifetime-qualified objects in ARC).\r
+ llvm::raw_string_ostream Out(Result);\r
+ \r
+ Out << "namespace std {\n"\r
+ << "\n"\r
+ << "struct __true_type;\n"\r
+ << "struct __false_type;\n"\r
+ << "\n";\r
+ \r
+ Out << "template<typename _Tp> struct __is_scalar;\n"\r
+ << "\n";\r
+\r
+ if (LangOpts.ObjCAutoRefCount) {\r
+ Out << "template<typename _Tp>\n"\r
+ << "struct __is_scalar<__attribute__((objc_ownership(strong))) _Tp> {\n"\r
+ << " enum { __value = 0 };\n"\r
+ << " typedef __false_type __type;\n"\r
+ << "};\n"\r
+ << "\n";\r
+ }\r
+ \r
+ if (LangOpts.ObjCWeak) {\r
+ Out << "template<typename _Tp>\n"\r
+ << "struct __is_scalar<__attribute__((objc_ownership(weak))) _Tp> {\n"\r
+ << " enum { __value = 0 };\n"\r
+ << " typedef __false_type __type;\n"\r
+ << "};\n"\r
+ << "\n";\r
+ }\r
+ \r
+ if (LangOpts.ObjCAutoRefCount) {\r
+ Out << "template<typename _Tp>\n"\r
+ << "struct __is_scalar<__attribute__((objc_ownership(autoreleasing)))"\r
+ << " _Tp> {\n"\r
+ << " enum { __value = 0 };\n"\r
+ << " typedef __false_type __type;\n"\r
+ << "};\n"\r
+ << "\n";\r
+ }\r
+ \r
+ Out << "}\n";\r
+ }\r
+ Builder.append(Result);\r
+}\r
+\r
+static void InitializeStandardPredefinedMacros(const TargetInfo &TI,\r
+ const LangOptions &LangOpts,\r
+ const FrontendOptions &FEOpts,\r
+ MacroBuilder &Builder) {\r
+ if (!LangOpts.MSVCCompat && !LangOpts.TraditionalCPP)\r
+ Builder.defineMacro("__STDC__");\r
+ if (LangOpts.Freestanding)\r
+ Builder.defineMacro("__STDC_HOSTED__", "0");\r
+ else\r
+ Builder.defineMacro("__STDC_HOSTED__");\r
+\r
+ if (!LangOpts.CPlusPlus) {\r
+ if (LangOpts.C17)\r
+ Builder.defineMacro("__STDC_VERSION__", "201710L");\r
+ else if (LangOpts.C11)\r
+ Builder.defineMacro("__STDC_VERSION__", "201112L");\r
+ else if (LangOpts.C99)\r
+ Builder.defineMacro("__STDC_VERSION__", "199901L");\r
+ else if (!LangOpts.GNUMode && LangOpts.Digraphs)\r
+ Builder.defineMacro("__STDC_VERSION__", "199409L");\r
+ } else {\r
+ // FIXME: Use correct value for C++20.\r
+ if (LangOpts.CPlusPlus2a)\r
+ Builder.defineMacro("__cplusplus", "201707L");\r
+ // C++17 [cpp.predefined]p1:\r
+ // The name __cplusplus is defined to the value 201703L when compiling a\r
+ // C++ translation unit.\r
+ else if (LangOpts.CPlusPlus17)\r
+ Builder.defineMacro("__cplusplus", "201703L");\r
+ // C++1y [cpp.predefined]p1:\r
+ // The name __cplusplus is defined to the value 201402L when compiling a\r
+ // C++ translation unit.\r
+ else if (LangOpts.CPlusPlus14)\r
+ Builder.defineMacro("__cplusplus", "201402L");\r
+ // C++11 [cpp.predefined]p1:\r
+ // The name __cplusplus is defined to the value 201103L when compiling a\r
+ // C++ translation unit.\r
+ else if (LangOpts.CPlusPlus11)\r
+ Builder.defineMacro("__cplusplus", "201103L");\r
+ // C++03 [cpp.predefined]p1:\r
+ // The name __cplusplus is defined to the value 199711L when compiling a\r
+ // C++ translation unit.\r
+ else\r
+ Builder.defineMacro("__cplusplus", "199711L");\r
+\r
+ // C++1z [cpp.predefined]p1:\r
+ // An integer literal of type std::size_t whose value is the alignment\r
+ // guaranteed by a call to operator new(std::size_t)\r
+ //\r
+ // We provide this in all language modes, since it seems generally useful.\r
+ Builder.defineMacro("__STDCPP_DEFAULT_NEW_ALIGNMENT__",\r
+ Twine(TI.getNewAlign() / TI.getCharWidth()) +\r
+ TI.getTypeConstantSuffix(TI.getSizeType()));\r
+ }\r
+\r
+ // In C11 these are environment macros. In C++11 they are only defined\r
+ // as part of <cuchar>. To prevent breakage when mixing C and C++\r
+ // code, define these macros unconditionally. We can define them\r
+ // unconditionally, as Clang always uses UTF-16 and UTF-32 for 16-bit\r
+ // and 32-bit character literals.\r
+ Builder.defineMacro("__STDC_UTF_16__", "1");\r
+ Builder.defineMacro("__STDC_UTF_32__", "1");\r
+\r
+ if (LangOpts.ObjC1)\r
+ Builder.defineMacro("__OBJC__");\r
+\r
+ // OpenCL v1.0/1.1 s6.9, v1.2/2.0 s6.10: Preprocessor Directives and Macros.\r
+ if (LangOpts.OpenCL) {\r
+ // OpenCL v1.0 and v1.1 do not have a predefined macro to indicate the\r
+ // language standard with which the program is compiled. __OPENCL_VERSION__\r
+ // is for the OpenCL version supported by the OpenCL device, which is not\r
+ // necessarily the language standard with which the program is compiled.\r
+ // A shared OpenCL header file requires a macro to indicate the language\r
+ // standard. As a workaround, __OPENCL_C_VERSION__ is defined for\r
+ // OpenCL v1.0 and v1.1.\r
+ switch (LangOpts.OpenCLVersion) {\r
+ case 100:\r
+ Builder.defineMacro("__OPENCL_C_VERSION__", "100");\r
+ break;\r
+ case 110:\r
+ Builder.defineMacro("__OPENCL_C_VERSION__", "110");\r
+ break;\r
+ case 120:\r
+ Builder.defineMacro("__OPENCL_C_VERSION__", "120");\r
+ break;\r
+ case 200:\r
+ Builder.defineMacro("__OPENCL_C_VERSION__", "200");\r
+ break;\r
+ default:\r
+ llvm_unreachable("Unsupported OpenCL version");\r
+ }\r
+ Builder.defineMacro("CL_VERSION_1_0", "100");\r
+ Builder.defineMacro("CL_VERSION_1_1", "110");\r
+ Builder.defineMacro("CL_VERSION_1_2", "120");\r
+ Builder.defineMacro("CL_VERSION_2_0", "200");\r
+\r
+ if (TI.isLittleEndian())\r
+ Builder.defineMacro("__ENDIAN_LITTLE__");\r
+\r
+ if (LangOpts.FastRelaxedMath)\r
+ Builder.defineMacro("__FAST_RELAXED_MATH__");\r
+ }\r
+ // Not "standard" per se, but available even with the -undef flag.\r
+ if (LangOpts.AsmPreprocessor)\r
+ Builder.defineMacro("__ASSEMBLER__");\r
+ if (LangOpts.CUDA)\r
+ Builder.defineMacro("__CUDA__");\r
+}\r
+\r
+/// Initialize the predefined C++ language feature test macros defined in\r
+/// ISO/IEC JTC1/SC22/WG21 (C++) SD-6: "SG10 Feature Test Recommendations".\r
+static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,\r
+ MacroBuilder &Builder) {\r
+ // C++98 features.\r
+ if (LangOpts.RTTI)\r
Builder.defineMacro("__cpp_rtti", "199711");
if (LangOpts.CXXExceptions)
Builder.defineMacro("__cpp_exceptions", "199711");
-// This file checks output given when processing C/ObjC files.
-// When user selects invalid language standard
-// print out supported values with short description.
-
-// RUN: not %clang %s -std=foobar -c 2>&1 | FileCheck --match-full-lines %s
-// RUN: not %clang -x objective-c %s -std=foobar -c 2>&1 | FileCheck --match-full-lines %s
-// RUN: not %clang -x renderscript %s -std=foobar -c 2>&1 | FileCheck --match-full-lines %s
-
-// CHECK: error: invalid value 'foobar' in '-std=foobar'
-// CHECK-NEXT: note: use 'c89', 'c90', or 'iso9899:1990' for 'ISO C 1990' standard
-// CHECK-NEXT: note: use 'iso9899:199409' for 'ISO C 1990 with amendment 1' standard
-// CHECK-NEXT: note: use 'gnu89' or 'gnu90' for 'ISO C 1990 with GNU extensions' standard
-// CHECK-NEXT: note: use 'c99' or 'iso9899:1999' for 'ISO C 1999' standard
-// CHECK-NEXT: note: use 'gnu99' for 'ISO C 1999 with GNU extensions' standard
-// CHECK-NEXT: note: use 'c11' or 'iso9899:2011' for 'ISO C 2011' standard
-// CHECK-NEXT: note: use 'gnu11' for 'ISO C 2011 with GNU extensions' standard
-
-// Make sure that no other output is present.
-// CHECK-NOT: {{^.+$}}
-
+// This file checks output given when processing C/ObjC files.\r
+// When user selects invalid language standard\r
+// print out supported values with short description.\r
+\r
+// RUN: not %clang %s -std=foobar -c 2>&1 | FileCheck --match-full-lines %s\r
+// RUN: not %clang -x objective-c %s -std=foobar -c 2>&1 | FileCheck --match-full-lines %s\r
+// RUN: not %clang -x renderscript %s -std=foobar -c 2>&1 | FileCheck --match-full-lines %s\r
+\r
+// CHECK: error: invalid value 'foobar' in '-std=foobar'\r
+// CHECK-NEXT: note: use 'c89', 'c90', or 'iso9899:1990' for 'ISO C 1990' standard\r
+// CHECK-NEXT: note: use 'iso9899:199409' for 'ISO C 1990 with amendment 1' standard\r
+// CHECK-NEXT: note: use 'gnu89' or 'gnu90' for 'ISO C 1990 with GNU extensions' standard\r
+// CHECK-NEXT: note: use 'c99' or 'iso9899:1999' for 'ISO C 1999' standard\r
+// CHECK-NEXT: note: use 'gnu99' for 'ISO C 1999 with GNU extensions' standard\r
+// CHECK-NEXT: note: use 'c11' or 'iso9899:2011' for 'ISO C 2011' standard\r
+// CHECK-NEXT: note: use 'gnu11' for 'ISO C 2011 with GNU extensions' standard\r
+// CHECK-NEXT: note: use 'c17' or 'iso9899:2017' for 'ISO C 2017' standard\r
+// CHECK-NEXT: note: use 'gnu17' for 'ISO C 2017 with GNU extensions' standard\r
+\r
+// Make sure that no other output is present.\r
+// CHECK-NOT: {{^.+$}}\r
+\r