aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/LangOptions.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Basic/LangOptions.h')
-rw-r--r--include/clang/Basic/LangOptions.h83
1 files changed, 72 insertions, 11 deletions
diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h
index a1396f84352f..9cff7c516043 100644
--- a/include/clang/Basic/LangOptions.h
+++ b/include/clang/Basic/LangOptions.h
@@ -54,6 +54,11 @@ public:
enum GCMode { NonGC, GCOnly, HybridGC };
enum StackProtectorMode { SSPOff, SSPOn, SSPStrong, SSPReq };
+ // Automatic variables live on the stack, and when trivial they're usually
+ // uninitialized because it's undefined behavior to use them without
+ // initializing them.
+ enum class TrivialAutoVarInitKind { Uninitialized, Zero, Pattern };
+
enum SignedOverflowBehaviorTy {
// Default C standard behavior.
SOB_Undefined,
@@ -73,8 +78,11 @@ public:
/// Compiling a module from a module map.
CMK_ModuleMap,
+ /// Compiling a module from a list of header files.
+ CMK_HeaderModule,
+
/// Compiling a C++ modules TS module interface unit.
- CMK_ModuleInterface
+ CMK_ModuleInterface,
};
enum PragmaMSPointersToMembersKind {
@@ -95,11 +103,14 @@ public:
enum AddrSpaceMapMangling { ASMM_Target, ASMM_On, ASMM_Off };
+ // Corresponds to _MSC_VER
enum MSVCMajorVersion {
- MSVC2010 = 16,
- MSVC2012 = 17,
- MSVC2013 = 18,
- MSVC2015 = 19
+ MSVC2010 = 1600,
+ MSVC2012 = 1700,
+ MSVC2013 = 1800,
+ MSVC2015 = 1900,
+ MSVC2017 = 1910,
+ MSVC2017_5 = 1912
};
/// Clang versions with different platform ABI conformance.
@@ -121,11 +132,34 @@ public:
/// whether we reuse base class tail padding in some ABIs.
Ver6,
+ /// Attempt to be ABI-compatible with code generated by Clang 7.0.x
+ /// (SVN r338536). This causes alignof (C++) and _Alignof (C11) to be
+ /// compatible with __alignof (i.e., return the preferred alignment)
+ /// rather than returning the required alignment.
+ Ver7,
+
/// Conform to the underlying platform's C and C++ ABIs as closely
/// as we can.
Latest
};
+ enum class CoreFoundationABI {
+ /// No interoperability ABI has been specified
+ Unspecified,
+ /// CoreFoundation does not have any language interoperability
+ Standalone,
+ /// Interoperability with the ObjectiveC runtime
+ ObjectiveC,
+ /// Interoperability with the latest known version of the Swift runtime
+ Swift,
+ /// Interoperability with the Swift 5.0 runtime
+ Swift5_0,
+ /// Interoperability with the Swift 4.2 runtime
+ Swift4_2,
+ /// Interoperability with the Swift 4.1 runtime
+ Swift4_1,
+ };
+
enum FPContractModeKind {
// Form fused FP ops only where result will not be affected.
FPC_Off,
@@ -137,6 +171,14 @@ public:
FPC_Fast
};
+ // TODO: merge FEnvAccessModeKind and FPContractModeKind
+ enum FEnvAccessModeKind {
+ FEA_Off,
+
+ FEA_On
+ };
+
+
public:
/// Set of enabled sanitizers.
SanitizerSet Sanitize;
@@ -164,6 +206,8 @@ public:
clang::ObjCRuntime ObjCRuntime;
+ CoreFoundationABI CFRuntime = CoreFoundationABI::Unspecified;
+
std::string ObjCConstantStringClass;
/// The name of the handler function to be called when -ftrapv is
@@ -235,7 +279,7 @@ public:
}
bool isCompatibleWithMSVC(MSVCMajorVersion MajorVersion) const {
- return MSCompatibilityVersion >= MajorVersion * 10000000U;
+ return MSCompatibilityVersion >= MajorVersion * 100000U;
}
/// Reset all of the options that are not considered when building a
@@ -262,14 +306,19 @@ public:
/// Floating point control options
class FPOptions {
public:
- FPOptions() : fp_contract(LangOptions::FPC_Off) {}
+ FPOptions() : fp_contract(LangOptions::FPC_Off),
+ fenv_access(LangOptions::FEA_Off) {}
// Used for serializing.
explicit FPOptions(unsigned I)
- : fp_contract(static_cast<LangOptions::FPContractModeKind>(I)) {}
+ : fp_contract(static_cast<LangOptions::FPContractModeKind>(I & 3)),
+ fenv_access(static_cast<LangOptions::FEnvAccessModeKind>((I >> 2) & 1))
+ {}
explicit FPOptions(const LangOptions &LangOpts)
- : fp_contract(LangOpts.getDefaultFPContractMode()) {}
+ : fp_contract(LangOpts.getDefaultFPContractMode()),
+ fenv_access(LangOptions::FEA_Off) {}
+ // FIXME: Use getDefaultFEnvAccessMode() when available.
bool allowFPContractWithinStatement() const {
return fp_contract == LangOptions::FPC_On;
@@ -289,12 +338,24 @@ public:
void setDisallowFPContract() { fp_contract = LangOptions::FPC_Off; }
+ bool allowFEnvAccess() const {
+ return fenv_access == LangOptions::FEA_On;
+ }
+
+ void setAllowFEnvAccess() {
+ fenv_access = LangOptions::FEA_On;
+ }
+
+ void setDisallowFEnvAccess() { fenv_access = LangOptions::FEA_Off; }
+
/// Used to serialize this.
- unsigned getInt() const { return fp_contract; }
+ unsigned getInt() const { return fp_contract | (fenv_access << 2); }
private:
- /// Adjust BinaryOperator::FPFeatures to match the bit-field size of this.
+ /// Adjust BinaryOperator::FPFeatures to match the total bit-field size
+ /// of these two.
unsigned fp_contract : 2;
+ unsigned fenv_access : 1;
};
/// Describes the kind of translation unit being processed.