clang: clang::LangOptions Class Reference (original) (raw)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that is accepted. More...
#include "[clang/Basic/LangOptions.h](LangOptions%5F8h%5Fsource.html)"
| Public Member Functions | |
|---|---|
| LangOptions () | |
| bool | isCompilingModule () const |
| Are we compiling a module? | |
| bool | isCompilingModuleImplementation () const |
| Are we compiling a module implementation? | |
| bool | trackLocalOwningModule () const |
| Do we need to track the owning module for a local declaration? | |
| bool | isSignedOverflowDefined () const |
| bool | isSubscriptPointerArithmetic () const |
| bool | isCompatibleWithMSVC () const |
| bool | isCompatibleWithMSVC (MSVCMajorVersion MajorVersion) const |
| bool | isOverflowPatternExcluded (OverflowPatternExclusionKind Kind) const |
| void | resetNonModularOptions () |
| Reset all of the options that are not considered when building a module. | |
| bool | isNoBuiltinFunc (StringRef Name) const |
| Is this a libc/libm function that is no longer recognized as a builtin because a -fno-builtin-* option has been specified? | |
| bool | allowsNonTrivialObjCLifetimeQualifiers () const |
| True if any ObjC types may have non-trivial lifetime qualifiers. | |
| bool | assumeFunctionsAreConvergent () const |
| bool | threadPrivateMemoryAtomicsAreUndefined () const |
| Return true if atomicrmw operations targeting allocations in private memory are undefined. | |
| VersionTuple | getOpenCLVersionTuple () const |
| Return the OpenCL C or C++ version as a VersionTuple. | |
| unsigned | getOpenCLCompatibleVersion () const |
| Return the OpenCL version that kernel language is compatible with. | |
| std::string | getOpenCLVersionString () const |
| Return the OpenCL C or C++ for OpenCL language name and version as a string. | |
| bool | requiresStrictPrototypes () const |
| Returns true if functions without prototypes or functions with an identifier list (aka K&R C functions) are not allowed. | |
| bool | implicitFunctionsAllowed () const |
| Returns true if implicit function declarations are allowed in the current language mode. | |
| bool | hasAtExit () const |
| Returns true if the language supports calling the 'atexit' function. | |
| bool | isImplicitIntRequired () const |
| Returns true if implicit int is part of the language requirements. | |
| bool | isImplicitIntAllowed () const |
| Returns true if implicit int is supported at all. | |
| bool | hasSignReturnAddress () const |
| Check if return address signing is enabled. | |
| bool | isSignReturnAddressWithAKey () const |
| Check if return address signing uses AKey. | |
| bool | isSignReturnAddressScopeAll () const |
| Check if leaf functions are also signed. | |
| bool | isSYCL () const |
| bool | hasDefaultVisibilityExportMapping () const |
| bool | isExplicitDefaultVisibilityExportMapping () const |
| bool | isAllDefaultVisibilityExportMapping () const |
| bool | hasGlobalAllocationFunctionVisibility () const |
| bool | hasDefaultGlobalAllocationFunctionVisibility () const |
| bool | hasProtectedGlobalAllocationFunctionVisibility () const |
| bool | hasHiddenGlobalAllocationFunctionVisibility () const |
| bool | allowArrayReturnTypes () const |
| void | remapPathPrefix (SmallVectorImpl< char > &Path) const |
| Remap path prefix according to -fmacro-prefix-path option. | |
| RoundingMode | getDefaultRoundingMode () const |
| FPExceptionModeKind | getDefaultExceptionMode () const |
| bool | isTargetDevice () const |
| True when compiling for an offloading target device. | |
| std::optional< uint32_t > | getCLangStd () const |
| Returns the most applicable C standard-compliant language version code. | |
| std::optional< uint32_t > | getCPlusPlusLangStd () const |
| Returns the most applicable C++ standard-compliant language version code. |
| Public Attributes | |
|---|---|
| LangStandard::Kind | LangStd |
| The used language standard. | |
| SanitizerSet | Sanitize |
| Set of enabled sanitizers. | |
| bool | SanitizeCoverage = false |
| Is at least one coverage instrumentation type enabled. | |
| std::vector< std::string > | NoSanitizeFiles |
| Paths to files specifying which objects (files, functions, variables) should not be instrumented. | |
| std::vector< std::string > | XRayAlwaysInstrumentFiles |
| Paths to the XRay "always instrument" files specifying which objects (files, functions, variables) should be imbued with the XRay "always instrument" attribute. | |
| std::vector< std::string > | XRayNeverInstrumentFiles |
| Paths to the XRay "never instrument" files specifying which objects (files, functions, variables) should be imbued with the XRay "never instrument" attribute. | |
| std::vector< std::string > | XRayAttrListFiles |
| Paths to the XRay attribute list files, specifying which objects (files, functions, variables) should be imbued with the appropriate XRay attribute(s). | |
| std::vector< std::string > | ProfileListFiles |
| Paths to special case list files specifying which entities (files, functions) should or should not be instrumented. | |
| clang::ObjCRuntime | ObjCRuntime |
| CoreFoundationABI | CFRuntime = CoreFoundationABI::Unspecified |
| std::string | ObjCConstantStringClass |
| std::string | OverflowHandler |
| The name of the handler function to be called when -ftrapv is specified. | |
| std::string | ModuleName |
| The module currently being compiled as specified by -fmodule-name. | |
| std::string | CurrentModule |
| The name of the current module, of which the main source file is a part. | |
| std::vector< std::string > | ModuleFeatures |
| The names of any features to enable in module 'requires' decls in addition to the hard-coded list in Module.cpp and the target features. | |
| CommentOptions | CommentOpts |
| Options for parsing comments. | |
| std::vector< std::string > | NoBuiltinFuncs |
| A list of all -fno-builtin-* function names (e.g., memset). | |
| std::map< std::string, std::string, std::greater< std::string > > | MacroPrefixMap |
| A prefix map for FILE, BASE_FILE and __builtin_FILE(). | |
| std::vector< llvm::Triple > | OMPTargetTriples |
| Triples of the OpenMP targets that the host code codegen should take into account in order to generate accurate offloading descriptors. | |
| std::string | OMPHostIRFile |
| Name of the IR file that contains the result of the OpenMP target host code generation. | |
| std::string | CUID |
| The user provided compilation unit ID, if non-empty. | |
| std::optional< TargetCXXABI::Kind > | CXXABI |
| C++ ABI to compile with, if specified by the frontend through -fc++-abi=. | |
| bool | IsHeaderFile = false |
| Indicates whether the front-end is explicitly told that the input is a header file (i.e. | |
| GPUDefaultStreamKind | GPUDefaultStream |
| The default stream kind used for HIP kernel launching. | |
| unsigned | OverflowPatternExclusionMask = 0 |
| Which overflow patterns should be excluded from sanitizer instrumentation. | |
| std::vector< std::string > | OverflowPatternExclusionValues |
| std::string | RandstructSeed |
| The seed used by the randomize structure layout feature. | |
| bool | UseTargetPathSeparator = false |
| Indicates whether to use target's platform-specific file separator when FILE macro is used and when concatenating filename with directory or to use build environment environment's platform-specific file separator. | |
| bool | CheckNew = false |
| llvm::dxbc::RootSignatureVersion | HLSLRootSigVer |
| The HLSL root signature version for dxil. | |
| std::string | HLSLRootSigOverride |
| The HLSL root signature that will be used to overide the root signature used for the shader entry point. | |
| bool | NoWasmOpt = false |
| bool | AtomicRemoteMemory = false |
| Atomic code-generation options. | |
| bool | AtomicFineGrainedMemory = false |
| bool | AtomicIgnoreDenormalMode = false |
| std::optional< uint64_t > | AllocTokenMax |
| Maximum number of allocation tokens (0 = target SIZE_MAX), nullopt if none set (use target SIZE_MAX). | |
| std::optional< llvm::AllocTokenMode > | AllocTokenMode |
| The allocation token mode. |
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that is accepted.
Definition at line 442 of file LangOptions.h.
| LangOptions::LangOptions | ( | ) |
|---|
◆ allowArrayReturnTypes()
| bool clang::LangOptions::allowArrayReturnTypes ( ) const | inline |
|---|
◆ allowsNonTrivialObjCLifetimeQualifiers()
| bool clang::LangOptions::allowsNonTrivialObjCLifetimeQualifiers ( ) const | inline |
|---|
True if any ObjC types may have non-trivial lifetime qualifiers.
Definition at line 656 of file LangOptions.h.
◆ assumeFunctionsAreConvergent()
| bool clang::LangOptions::assumeFunctionsAreConvergent ( ) const | inline |
|---|
◆ getCLangStd()
| std::optional< uint32_t > LangOptions::getCLangStd | ( | ) | const |
|---|
Returns the most applicable C standard-compliant language version code.
If none could be determined, returns std::nullopt.
Definition at line 275 of file LangOptions.cpp.
References clang::C11, clang::C17, clang::C23, clang::C2y, clang::C99, clang::Digraphs, clang::LangStandard::getLangStandardForKind(), clang::LangStandard::getVersion(), and clang::GNUMode.
Referenced by GetDISourceLanguageName(), and InitializeStandardPredefinedMacros().
◆ getCPlusPlusLangStd()
| std::optional< uint32_t > LangOptions::getCPlusPlusLangStd | ( | ) | const |
|---|
Returns the most applicable C++ standard-compliant language version code.
If none could be determined, returns std::nullopt.
Definition at line 252 of file LangOptions.cpp.
References clang::CPlusPlus, clang::CPlusPlus11, clang::CPlusPlus14, clang::CPlusPlus17, clang::CPlusPlus20, clang::CPlusPlus23, clang::CPlusPlus26, clang::LangStandard::getLangStandardForKind(), and clang::LangStandard::getVersion().
Referenced by GetDISourceLanguageName(), and InitializeStandardPredefinedMacros().
◆ getDefaultExceptionMode()
◆ getDefaultRoundingMode()
| RoundingMode clang::LangOptions::getDefaultRoundingMode ( ) const | inline |
|---|
◆ getOpenCLCompatibleVersion()
| unsigned LangOptions::getOpenCLCompatibleVersion | ( | ) | const |
|---|
Return the OpenCL version that kernel language is compatible with.
Definition at line 66 of file LangOptions.cpp.
Referenced by clang::Sema::ActOnNumericConstant(), clang::TargetInfo::adjust(), clang::OpenCLOptions::areProgramScopeVariablesSupported(), builtinIsSupported(), CheckExtVectorComponent(), ConvertDeclSpecToType(), FixupInvocation(), GetFullTypeForDeclarator(), getOpenCLKernelParameterType(), clang::SemaOpenCL::handleAccessAttr(), clang::Sema::Initialize(), clang::OpenCLOptions::OpenCLOptionInfo::isAvailableIn(), setLangDefaults(), clang::DeclSpec::SetStorageClassSpec(), and clang::TargetInfo::validateOpenCLTarget().
◆ getOpenCLVersionString()
| std::string LangOptions::getOpenCLVersionString | ( | ) | const |
|---|
◆ getOpenCLVersionTuple()
| VersionTuple LangOptions::getOpenCLVersionTuple | ( | ) | const |
|---|
◆ hasAtExit()
| bool clang::LangOptions::hasAtExit ( ) const | inline |
|---|
Returns true if the language supports calling the 'atexit' function.
Definition at line 695 of file LangOptions.h.
◆ hasDefaultGlobalAllocationFunctionVisibility()
| bool clang::LangOptions::hasDefaultGlobalAllocationFunctionVisibility ( ) const | inline |
|---|
◆ hasDefaultVisibilityExportMapping()
| bool clang::LangOptions::hasDefaultVisibilityExportMapping ( ) const | inline |
|---|
◆ hasGlobalAllocationFunctionVisibility()
| bool clang::LangOptions::hasGlobalAllocationFunctionVisibility ( ) const | inline |
|---|
◆ hasHiddenGlobalAllocationFunctionVisibility()
| bool clang::LangOptions::hasHiddenGlobalAllocationFunctionVisibility ( ) const | inline |
|---|
◆ hasProtectedGlobalAllocationFunctionVisibility()
| bool clang::LangOptions::hasProtectedGlobalAllocationFunctionVisibility ( ) const | inline |
|---|
◆ hasSignReturnAddress()
| bool clang::LangOptions::hasSignReturnAddress ( ) const | inline |
|---|
◆ implicitFunctionsAllowed()
| bool clang::LangOptions::implicitFunctionsAllowed ( ) const | inline |
|---|
◆ isAllDefaultVisibilityExportMapping()
| bool clang::LangOptions::isAllDefaultVisibilityExportMapping ( ) const | inline |
|---|
◆ isCompatibleWithMSVC() [1/2]
| bool clang::LangOptions::isCompatibleWithMSVC ( ) const | inline |
|---|
◆ isCompatibleWithMSVC() [2/2]
◆ isCompilingModule()
| bool clang::LangOptions::isCompilingModule ( ) const | inline |
|---|
◆ isCompilingModuleImplementation()
| bool clang::LangOptions::isCompilingModuleImplementation ( ) const | inline |
|---|
◆ isExplicitDefaultVisibilityExportMapping()
| bool clang::LangOptions::isExplicitDefaultVisibilityExportMapping ( ) const | inline |
|---|
◆ isImplicitIntAllowed()
| bool clang::LangOptions::isImplicitIntAllowed ( ) const | inline |
|---|
◆ isImplicitIntRequired()
| bool clang::LangOptions::isImplicitIntRequired ( ) const | inline |
|---|
◆ isNoBuiltinFunc()
| bool LangOptions::isNoBuiltinFunc | ( | StringRef | Name | ) | const |
|---|
◆ isOverflowPatternExcluded()
◆ isSignedOverflowDefined()
| bool clang::LangOptions::isSignedOverflowDefined ( ) const | inline |
|---|
◆ isSignReturnAddressScopeAll()
| bool clang::LangOptions::isSignReturnAddressScopeAll ( ) const | inline |
|---|
◆ isSignReturnAddressWithAKey()
| bool clang::LangOptions::isSignReturnAddressWithAKey ( ) const | inline |
|---|
◆ isSubscriptPointerArithmetic()
| bool clang::LangOptions::isSubscriptPointerArithmetic ( ) const | inline |
|---|
◆ isSYCL()
| bool clang::LangOptions::isSYCL ( ) const | inline |
|---|
◆ isTargetDevice()
| bool clang::LangOptions::isTargetDevice ( ) const | inline |
|---|
◆ remapPathPrefix()
◆ requiresStrictPrototypes()
| bool clang::LangOptions::requiresStrictPrototypes ( ) const | inline |
|---|
◆ resetNonModularOptions()
| void LangOptions::resetNonModularOptions | ( | ) |
|---|
◆ setLangDefaults()
Set language defaults for the given input language and language standard in the given LangOptions object.
Parameters
| Opts | - The LangOptions object to set up. |
|---|---|
| Lang | - The input language. |
| T | - The target triple. |
| Includes | - If the language requires extra headers to be implicitly included, they will be appended to this list. |
| LangStd | - The input language standard. |
Definition at line 92 of file LangOptions.cpp.
References clang::Asm, clang::CUDA, clang::LangOptionsBase::FPM_Fast, clang::LangOptionsBase::FPM_FastHonorPragmas, clang::LangOptionsBase::FPM_On, clang::getDefaultLanguageStandard(), clang::LangStandard::getLangStandardForKind(), getOpenCLCompatibleVersion(), clang::LangStandard::hasDigraphs(), clang::LangStandard::hasHexFloats(), clang::LangStandard::hasLineComments(), clang::LangStandard::hasRawStringLiterals(), clang::HIP, clang::HLSL, clang::LangOptionsBase::HLSL_2015, clang::LangOptionsBase::HLSL_2016, clang::LangOptionsBase::HLSL_2017, clang::LangOptionsBase::HLSL_2018, clang::LangOptionsBase::HLSL_2021, clang::LangOptionsBase::HLSL_202x, clang::LangOptionsBase::HLSL_202y, clang::LangStandard::isC11(), clang::LangStandard::isC17(), clang::LangStandard::isC23(), clang::LangStandard::isC2y(), clang::LangStandard::isC99(), clang::LangStandard::isCPlusPlus(), clang::LangStandard::isCPlusPlus11(), clang::LangStandard::isCPlusPlus14(), clang::LangStandard::isCPlusPlus17(), clang::LangStandard::isCPlusPlus20(), clang::LangStandard::isCPlusPlus23(), clang::LangStandard::isCPlusPlus26(), clang::LangStandard::isGNUMode(), clang::LangStandard::isOpenCL(), clang::LangStandard::lang_unspecified, LangOptions(), LangStd, clang::ObjC, clang::ObjCXX, and clang::T.
◆ threadPrivateMemoryAtomicsAreUndefined()
| bool clang::LangOptions::threadPrivateMemoryAtomicsAreUndefined ( ) const | inline |
|---|
◆ trackLocalOwningModule()
| bool clang::LangOptions::trackLocalOwningModule ( ) const | inline |
|---|
◆ AllocTokenMax
std::optional<uint64_t> clang::LangOptions::AllocTokenMax
◆ AllocTokenMode
std::optionalllvm::AllocTokenMode clang::LangOptions::AllocTokenMode
◆ AtomicFineGrainedMemory
bool clang::LangOptions::AtomicFineGrainedMemory = false
◆ AtomicIgnoreDenormalMode
bool clang::LangOptions::AtomicIgnoreDenormalMode = false
◆ AtomicRemoteMemory
bool clang::LangOptions::AtomicRemoteMemory = false
Atomic code-generation options.
These flags are set directly from the command-line options.
Definition at line 572 of file LangOptions.h.
◆ CFRuntime
◆ CheckNew
◆ CommentOpts
◆ CUID
std::string clang::LangOptions::CUID
◆ CurrentModule
std::string clang::LangOptions::CurrentModule
The name of the current module, of which the main source file is a part.
If CompilingModule is set, we are compiling the interface of this module, otherwise we are compiling an implementation file of it. This starts as ModuleName in case -fmodule-name is provided and changes during compilation to reflect the current module.
Definition at line 497 of file LangOptions.h.
Referenced by clang::Sema::ActOnModuleDecl(), clang::Sema::ActOnModuleImport(), clang::FrontendAction::BeginSourceFile(), clang::DumpModuleInfoAction::ExecuteAction(), FixupInvocation(), clang::FrontendAction::getCurrentModule(), clang::Preprocessor::getModuleForLocation(), clang::Module::isForBuilding(), prepareToBuildModule(), and resetNonModularOptions().
◆ CXXABI
◆ GPUDefaultStream
◆ HLSLRootSigOverride
std::string clang::LangOptions::HLSLRootSigOverride
◆ HLSLRootSigVer
llvm::dxbc::RootSignatureVersion clang::LangOptions::HLSLRootSigVer
◆ IsHeaderFile
bool clang::LangOptions::IsHeaderFile = false
◆ LangStd
◆ MacroPrefixMap
std::map<std::string, std::string, std::greaterstd::string > clang::LangOptions::MacroPrefixMap
◆ ModuleFeatures
std::vectorstd::string clang::LangOptions::ModuleFeatures
◆ ModuleName
std::string clang::LangOptions::ModuleName
◆ NoBuiltinFuncs
std::vectorstd::string clang::LangOptions::NoBuiltinFuncs
◆ NoSanitizeFiles
std::vectorstd::string clang::LangOptions::NoSanitizeFiles
◆ NoWasmOpt
◆ ObjCConstantStringClass
std::string clang::LangOptions::ObjCConstantStringClass
◆ ObjCRuntime
Definition at line 477 of file LangOptions.h.
Referenced by checkArithmeticOnObjCPointer(), checkLanguageOptions(), CheckObjCTraitOperandConstraints(), CheckProtocolMethodDefs(), clang::CodeGen::CreateGNUObjCRuntime(), DiagnoseUnimplementedAccessor(), EncodeBitField(), getObjCPersonality(), getObjCPersonality(), getObjCXXPersonality(), getObjCXXPersonality(), hasUnwindExceptions(), clang::SemaObjC::ImplMethodsVsClassMethods(), InitializePredefinedMacros(), isSubscriptPointerArithmetic(), setARCRuntimeFunctionLinkage(), tryEmitSpecializedAllocInit(), tryGenerateSpecializedMessageSend(), and UseOptimizedSetter().
◆ OMPHostIRFile
std::string clang::LangOptions::OMPHostIRFile
Name of the IR file that contains the result of the OpenMP target host code generation.
Definition at line 520 of file LangOptions.h.
◆ OMPTargetTriples
std::vectorllvm::Triple clang::LangOptions::OMPTargetTriples
◆ OverflowHandler
std::string clang::LangOptions::OverflowHandler
The name of the handler function to be called when -ftrapv is specified.
If none is specified, abort (GCC-compatible behaviour).
Definition at line 487 of file LangOptions.h.
◆ OverflowPatternExclusionMask
unsigned clang::LangOptions::OverflowPatternExclusionMask = 0
◆ OverflowPatternExclusionValues
std::vectorstd::string clang::LangOptions::OverflowPatternExclusionValues
◆ ProfileListFiles
std::vectorstd::string clang::LangOptions::ProfileListFiles
Paths to special case list files specifying which entities (files, functions) should or should not be instrumented.
Definition at line 475 of file LangOptions.h.
◆ RandstructSeed
std::string clang::LangOptions::RandstructSeed
The seed used by the randomize structure layout feature.
Definition at line 545 of file LangOptions.h.
◆ Sanitize
◆ SanitizeCoverage
bool clang::LangOptions::SanitizeCoverage = false
◆ UseTargetPathSeparator
bool clang::LangOptions::UseTargetPathSeparator = false
Indicates whether to use target's platform-specific file separator when FILE macro is used and when concatenating filename with directory or to use build environment environment's platform-specific file separator.
The plaform-specific path separator is the backslash() for Windows and forward slash (/) elsewhere.
Definition at line 553 of file LangOptions.h.
◆ XRayAlwaysInstrumentFiles
std::vectorstd::string clang::LangOptions::XRayAlwaysInstrumentFiles
Paths to the XRay "always instrument" files specifying which objects (files, functions, variables) should be imbued with the XRay "always instrument" attribute.
WARNING: This is a deprecated field and will go away in the future.
Definition at line 460 of file LangOptions.h.
Referenced by resetNonModularOptions().
◆ XRayAttrListFiles
std::vectorstd::string clang::LangOptions::XRayAttrListFiles
Paths to the XRay attribute list files, specifying which objects (files, functions, variables) should be imbued with the appropriate XRay attribute(s).
Definition at line 471 of file LangOptions.h.
◆ XRayNeverInstrumentFiles
std::vectorstd::string clang::LangOptions::XRayNeverInstrumentFiles
Paths to the XRay "never instrument" files specifying which objects (files, functions, variables) should be imbued with the XRay "never instrument" attribute.
WARNING: This is a deprecated field and will go away in the future.
Definition at line 466 of file LangOptions.h.
Referenced by resetNonModularOptions().
The documentation for this class was generated from the following files:
- include/clang/Basic/LangOptions.h
- lib/Basic/LangOptions.cpp