clang  16.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
clang::LangOptions Class Reference

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"

Inheritance diagram for clang::LangOptions:
Inheritance graph
[legend]
Collaboration diagram for clang::LangOptions:
Collaboration graph
[legend]

Public Types

enum  GCMode { NonGC, GCOnly, HybridGC }
 
enum  StackProtectorMode { SSPOff, SSPOn, SSPStrong, SSPReq }
 
enum  TrivialAutoVarInitKind { TrivialAutoVarInitKind::Uninitialized, TrivialAutoVarInitKind::Zero, TrivialAutoVarInitKind::Pattern }
 
enum  SignedOverflowBehaviorTy { SOB_Undefined, SOB_Defined, SOB_Trapping }
 
enum  CompilingModuleKind {
  CMK_None, CMK_ModuleMap, CMK_HeaderModule, CMK_HeaderUnit,
  CMK_ModuleInterface
}
 
enum  PragmaMSPointersToMembersKind { PPTMK_BestCase, PPTMK_FullGeneralitySingleInheritance, PPTMK_FullGeneralityMultipleInheritance, PPTMK_FullGeneralityVirtualInheritance }
 
enum  DefaultCallingConvention {
  DCC_None, DCC_CDecl, DCC_FastCall, DCC_StdCall,
  DCC_VectorCall, DCC_RegCall
}
 
enum  AddrSpaceMapMangling { ASMM_Target, ASMM_On, ASMM_Off }
 
enum  MSVCMajorVersion {
  MSVC2010 = 1600, MSVC2012 = 1700, MSVC2013 = 1800, MSVC2015 = 1900,
  MSVC2017 = 1910, MSVC2017_5 = 1912, MSVC2017_7 = 1914, MSVC2019 = 1920,
  MSVC2019_5 = 1925, MSVC2019_8 = 1928
}
 
enum  SYCLMajorVersion { SYCL_None, SYCL_2017, SYCL_2020, SYCL_Default = SYCL_2020 }
 
enum  HLSLLangStd {
  HLSL_Unset = 0, HLSL_2015 = 2015, HLSL_2016 = 2016, HLSL_2017 = 2017,
  HLSL_2018 = 2018, HLSL_2021 = 2021, HLSL_202x = 2029
}
 
enum  ClangABI {
  ClangABI::Ver3_8, ClangABI::Ver4, ClangABI::Ver6, ClangABI::Ver7,
  ClangABI::Ver9, ClangABI::Ver11, ClangABI::Ver12, ClangABI::Ver14,
  ClangABI::Ver15, ClangABI::Latest
}
 Clang versions with different platform ABI conformance. More...
 
enum  CoreFoundationABI {
  CoreFoundationABI::Unspecified, CoreFoundationABI::Standalone, CoreFoundationABI::ObjectiveC, CoreFoundationABI::Swift,
  CoreFoundationABI::Swift5_0, CoreFoundationABI::Swift4_2, CoreFoundationABI::Swift4_1
}
 
enum  FPModeKind { FPM_Off, FPM_On, FPM_Fast, FPM_FastHonorPragmas }
 
enum  FPExceptionModeKind { FPE_Ignore, FPE_MayTrap, FPE_Strict, FPE_Default }
 Possible floating point exception behavior. More...
 
enum  FPEvalMethodKind {
  FEM_Indeterminable = -1, FEM_Source = 0, FEM_Double = 1, FEM_Extended = 2,
  FEM_UnsetOnCommandLine = 3
}
 Possible float expression evaluation method choices. More...
 
enum  ExceptionHandlingKind {
  ExceptionHandlingKind::None, ExceptionHandlingKind::SjLj, ExceptionHandlingKind::WinEH, ExceptionHandlingKind::DwarfCFI,
  ExceptionHandlingKind::Wasm
}
 Possible exception handling behavior. More...
 
enum  LaxVectorConversionKind { LaxVectorConversionKind::None, LaxVectorConversionKind::Integer, LaxVectorConversionKind::All }
 
enum  AltivecSrcCompatKind { AltivecSrcCompatKind::Mixed, AltivecSrcCompatKind::GCC, AltivecSrcCompatKind::XL, AltivecSrcCompatKind::Default = Mixed }
 
enum  SignReturnAddressScopeKind { SignReturnAddressScopeKind::None, SignReturnAddressScopeKind::NonLeaf, SignReturnAddressScopeKind::All }
 
enum  SignReturnAddressKeyKind { SignReturnAddressKeyKind::AKey, SignReturnAddressKeyKind::BKey }
 
enum  ThreadModelKind { ThreadModelKind::POSIX, ThreadModelKind::Single }
 
enum  ExtendArgsKind { ExtendArgsKind::ExtendTo32, ExtendArgsKind::ExtendTo64 }
 
enum  GPUDefaultStreamKind { GPUDefaultStreamKind::Legacy, GPUDefaultStreamKind::PerThread }
 
enum  DefaultVisiblityExportMapping { DefaultVisiblityExportMapping::None, DefaultVisiblityExportMapping::Explicit, DefaultVisiblityExportMapping::All }
 
using Visibility = clang::Visibility
 
using RoundingMode = llvm::RoundingMode
 
using MSVtorDispMode = clang::MSVtorDispMode
 

Public Member Functions

 LangOptions ()
 
bool isCompilingModule () const
 Are we compiling a module? More...
 
bool isCompilingModuleInterface () const
 Are we compiling a standard c++ module interface? More...
 
bool isCompilingModuleImplementation () const
 Are we compiling a module implementation? More...
 
bool trackLocalOwningModule () const
 Do we need to track the owning module for a local declaration? More...
 
bool isSignedOverflowDefined () const
 
bool isSubscriptPointerArithmetic () const
 
bool isCompatibleWithMSVC (MSVCMajorVersion MajorVersion) const
 
void resetNonModularOptions ()
 Reset all of the options that are not considered when building a module. More...
 
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? More...
 
bool allowsNonTrivialObjCLifetimeQualifiers () const
 True if any ObjC types may have non-trivial lifetime qualifiers. More...
 
bool assumeFunctionsAreConvergent () const
 
VersionTuple getOpenCLVersionTuple () const
 Return the OpenCL C or C++ version as a VersionTuple. More...
 
unsigned getOpenCLCompatibleVersion () const
 Return the OpenCL version that kernel language is compatible with. More...
 
std::string getOpenCLVersionString () const
 Return the OpenCL C or C++ for OpenCL language name and version as a string. More...
 
bool requiresStrictPrototypes () const
 Returns true if functions without prototypes or functions with an identifier list (aka K&R C functions) are not allowed. More...
 
bool implicitFunctionsAllowed () const
 Returns true if implicit function declarations are allowed in the current language mode. More...
 
bool isImplicitIntRequired () const
 Returns true if implicit int is part of the language requirements. More...
 
bool isImplicitIntAllowed () const
 Returns true if implicit int is supported at all. More...
 
bool hasSignReturnAddress () const
 Check if return address signing is enabled. More...
 
bool isSignReturnAddressWithAKey () const
 Check if return address signing uses AKey. More...
 
bool isSignReturnAddressScopeAll () const
 Check if leaf functions are also signed. More...
 
bool hasSjLjExceptions () const
 
bool hasSEHExceptions () const
 
bool hasDWARFExceptions () const
 
bool hasWasmExceptions () const
 
bool isSYCL () const
 
bool hasDefaultVisibilityExportMapping () const
 
bool isExplicitDefaultVisibilityExportMapping () const
 
bool isAllDefaultVisibilityExportMapping () const
 
void remapPathPrefix (SmallVectorImpl< char > &Path) const
 Remap path prefix according to -fmacro-prefix-path option. More...
 
RoundingMode getDefaultRoundingMode () const
 
FPExceptionModeKind getDefaultExceptionMode () const
 

Static Public Member Functions

static void setLangDefaults (LangOptions &Opts, Language Lang, const llvm::Triple &T, std::vector< std::string > &Includes, LangStandard::Kind LangStd=LangStandard::lang_unspecified)
 Set language defaults for the given input language and language standard in the given LangOptions object. More...
 

Public Attributes

LangStandard::Kind LangStd
 The used language standard. More...
 
SanitizerSet Sanitize
 Set of enabled sanitizers. More...
 
bool SanitizeCoverage = false
 Is at least one coverage instrumentation type enabled. More...
 
std::vector< std::stringNoSanitizeFiles
 Paths to files specifying which objects (files, functions, variables) should not be instrumented. More...
 
std::vector< std::stringXRayAlwaysInstrumentFiles
 Paths to the XRay "always instrument" files specifying which objects (files, functions, variables) should be imbued with the XRay "always instrument" attribute. More...
 
std::vector< std::stringXRayNeverInstrumentFiles
 Paths to the XRay "never instrument" files specifying which objects (files, functions, variables) should be imbued with the XRay "never instrument" attribute. More...
 
std::vector< std::stringXRayAttrListFiles
 Paths to the XRay attribute list files, specifying which objects (files, functions, variables) should be imbued with the appropriate XRay attribute(s). More...
 
std::vector< std::stringProfileListFiles
 Paths to special case list files specifying which entities (files, functions) should or should not be instrumented. More...
 
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. More...
 
std::string ModuleName
 The module currently being compiled as specified by -fmodule-name. More...
 
std::string CurrentModule
 The name of the current module, of which the main source file is a part. More...
 
std::vector< std::stringModuleFeatures
 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. More...
 
CommentOptions CommentOpts
 Options for parsing comments. More...
 
std::vector< std::stringNoBuiltinFuncs
 A list of all -fno-builtin-* function names (e.g., memset). More...
 
std::map< std::string, std::string, std::greater< std::string > > MacroPrefixMap
 A prefix map for FILE, BASE_FILE and __builtin_FILE(). More...
 
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. More...
 
std::string OMPHostIRFile
 Name of the IR file that contains the result of the OpenMP target host code generation. More...
 
std::string CUID
 The user provided compilation unit ID, if non-empty. More...
 
llvm::Optional< TargetCXXABI::KindCXXABI
 C++ ABI to compile with, if specified by the frontend through -fc++-abi=. More...
 
bool IsHeaderFile = false
 Indicates whether the front-end is explicitly told that the input is a header file (i.e. More...
 
GPUDefaultStreamKind GPUDefaultStream
 The default stream kind used for HIP kernel launching. More...
 
std::string RandstructSeed
 The seed used by the randomize structure layout feature. More...
 
bool UseTargetPathSeparator = false
 Indicates whether the FILE macro should use the target's platform-specific file separator or whether it should use the build environment's platform-specific file separator. More...
 

Detailed Description

Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that is accepted.

Definition at line 78 of file LangOptions.h.

Member Typedef Documentation

◆ MSVtorDispMode

Definition at line 127 of file LangOptions.h.

◆ RoundingMode

using clang::LangOptions::RoundingMode = llvm::RoundingMode

Definition at line 81 of file LangOptions.h.

◆ Visibility

Definition at line 80 of file LangOptions.h.

Member Enumeration Documentation

◆ AddrSpaceMapMangling

Enumerator
ASMM_Target 
ASMM_On 
ASMM_Off 

Definition at line 138 of file LangOptions.h.

◆ AltivecSrcCompatKind

Enumerator
Mixed 
GCC 
XL 
Default 

Definition at line 311 of file LangOptions.h.

◆ ClangABI

Clang versions with different platform ABI conformance.

Enumerator
Ver3_8 

Attempt to be ABI-compatible with code generated by Clang 3.8.x (SVN r257626).

This causes <1 x long long> to be passed in an integer register instead of an SSE register on x64_64.

Ver4 

Attempt to be ABI-compatible with code generated by Clang 4.0.x (SVN r291814).

This causes move operations to be ignored when determining whether a class type can be passed or returned directly.

Ver6 

Attempt to be ABI-compatible with code generated by Clang 6.0.x (SVN r321711).

This causes determination of whether a type is standard-layout to ignore collisions between empty base classes and between base classes and member subobjects, which affects whether we reuse base class tail padding in some ABIs.

Ver7 

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.

Ver9 

Attempt to be ABI-compatible with code generated by Clang 9.0.x (SVN r351319).

This causes vectors of __int128 to be passed in memory instead of passing in multiple scalar registers on x86_64 on Linux and NetBSD.

Ver11 

Attempt to be ABI-compatible with code generated by Clang 11.0.x (git 2e10b7a39b93).

This causes clang to pass unions with a 256-bit vector member on the stack instead of using registers, to not properly mangle substitutions for template names in some cases, and to mangle declaration template arguments without a cast to the parameter type even when that can lead to mangling collisions.

Ver12 

Attempt to be ABI-compatible with code generated by Clang 12.0.x (git 8e464dd76bef).

This causes clang to mangle lambdas within global-scope inline variables incorrectly.

Ver14 

Attempt to be ABI-compatible with code generated by Clang 14.0.x.

This causes clang to:

  • mangle dependent nested names incorrectly.
  • pack non-POD members of packed structs.
  • make trivial only those defaulted copy constructors with a parameter-type-list equivalent to the parameter-type-list of an implicit declaration.
Ver15 

Attempt to be ABI-compatible with code generated by Clang 15.0.x.

This causes clang to:

  • Reverse the implementation for DR692, DR1395 and DR1432.
Latest 

Conform to the underlying platform's C and C++ ABIs as closely as we can.

Definition at line 174 of file LangOptions.h.

◆ CompilingModuleKind

Enumerator
CMK_None 

Not compiling a module interface at all.

CMK_ModuleMap 

Compiling a module from a module map.

CMK_HeaderModule 

Compiling a module from a list of header files.

CMK_HeaderUnit 

Compiling a module header unit.

CMK_ModuleInterface 

Compiling a C++ modules interface unit.

Definition at line 103 of file LangOptions.h.

◆ CoreFoundationABI

Enumerator
Unspecified 

No interoperability ABI has been specified.

Standalone 

CoreFoundation does not have any language interoperability.

ObjectiveC 

Interoperability with the ObjectiveC runtime.

Swift 

Interoperability with the latest known version of the Swift runtime.

Swift5_0 

Interoperability with the Swift 5.0 runtime.

Swift4_2 

Interoperability with the Swift 4.2 runtime.

Swift4_1 

Interoperability with the Swift 4.1 runtime.

Definition at line 236 of file LangOptions.h.

◆ DefaultCallingConvention

Enumerator
DCC_None 
DCC_CDecl 
DCC_FastCall 
DCC_StdCall 
DCC_VectorCall 
DCC_RegCall 

Definition at line 129 of file LangOptions.h.

◆ DefaultVisiblityExportMapping

Enumerator
None 
Explicit 

map only explicit default visibilities to exported

All 

map all default visibilities to exported

Definition at line 360 of file LangOptions.h.

◆ ExceptionHandlingKind

Possible exception handling behavior.

Enumerator
None 
SjLj 
WinEH 
DwarfCFI 
Wasm 

Definition at line 298 of file LangOptions.h.

◆ ExtendArgsKind

Enumerator
ExtendTo32 

Integer arguments are sign or zero extended to 32/64 bits during default argument promotions.

ExtendTo64 

Definition at line 346 of file LangOptions.h.

◆ FPEvalMethodKind

Possible float expression evaluation method choices.

Enumerator
FEM_Indeterminable 

The evaluation method cannot be determined or is inconsistent for this target.

FEM_Source 

Use the declared type for fp arithmetic.

FEM_Double 

Use the type double for fp arithmetic.

FEM_Extended 

Use extended type for fp arithmetic.

FEM_UnsetOnCommandLine 

Used only for FE option processing; this is only used to indicate that the user did not specify an explicit evaluation method on the command line and so the target should be queried for its default evaluation method instead.

Definition at line 280 of file LangOptions.h.

◆ FPExceptionModeKind

Possible floating point exception behavior.

Enumerator
FPE_Ignore 

Assume that floating-point exceptions are masked.

FPE_MayTrap 

Transformations do not cause new exceptions but may hide some.

FPE_Strict 

Strictly preserve the floating-point exception semantics.

FPE_Default 

Used internally to represent initial unspecified value.

Definition at line 268 of file LangOptions.h.

◆ FPModeKind

Enumerator
FPM_Off 
FPM_On 
FPM_Fast 
FPM_FastHonorPragmas 

Definition at line 253 of file LangOptions.h.

◆ GCMode

Enumerator
NonGC 
GCOnly 
HybridGC 

Definition at line 83 of file LangOptions.h.

◆ GPUDefaultStreamKind

Enumerator
Legacy 

Legacy default stream.

PerThread 

Per-thread default stream.

Definition at line 353 of file LangOptions.h.

◆ HLSLLangStd

Enumerator
HLSL_Unset 
HLSL_2015 
HLSL_2016 
HLSL_2017 
HLSL_2018 
HLSL_2021 
HLSL_202x 

Definition at line 163 of file LangOptions.h.

◆ LaxVectorConversionKind

Enumerator
None 

Permit no implicit vector bitcasts.

Integer 

Permit vector bitcasts between integer vectors with different numbers of elements but the same total bit-width.

All 

Permit vector bitcasts between all vectors with the same total bit-width.

Definition at line 300 of file LangOptions.h.

◆ MSVCMajorVersion

Enumerator
MSVC2010 
MSVC2012 
MSVC2013 
MSVC2015 
MSVC2017 
MSVC2017_5 
MSVC2017_7 
MSVC2019 
MSVC2019_5 
MSVC2019_8 

Definition at line 141 of file LangOptions.h.

◆ PragmaMSPointersToMembersKind

Enumerator
PPTMK_BestCase 
PPTMK_FullGeneralitySingleInheritance 
PPTMK_FullGeneralityMultipleInheritance 
PPTMK_FullGeneralityVirtualInheritance 

Definition at line 120 of file LangOptions.h.

◆ SignedOverflowBehaviorTy

Enumerator
SOB_Undefined 
SOB_Defined 
SOB_Trapping 

Definition at line 91 of file LangOptions.h.

◆ SignReturnAddressKeyKind

Enumerator
AKey 

Return address signing uses APIA key.

BKey 

Return address signing uses APIB key.

Definition at line 332 of file LangOptions.h.

◆ SignReturnAddressScopeKind

Enumerator
None 

No signing for any function.

NonLeaf 

Sign the return address of functions that spill LR.

All 

Sign the return address of all functions,.

Definition at line 323 of file LangOptions.h.

◆ StackProtectorMode

Enumerator
SSPOff 
SSPOn 
SSPStrong 
SSPReq 

Definition at line 84 of file LangOptions.h.

◆ SYCLMajorVersion

Enumerator
SYCL_None 
SYCL_2017 
SYCL_2020 
SYCL_Default 

Definition at line 154 of file LangOptions.h.

◆ ThreadModelKind

Enumerator
POSIX 

POSIX Threads.

Single 

Single Threaded Environment.

Definition at line 339 of file LangOptions.h.

◆ TrivialAutoVarInitKind

Enumerator
Uninitialized 
Zero 
Pattern 

Definition at line 89 of file LangOptions.h.

Constructor & Destructor Documentation

◆ LangOptions()

LangOptions::LangOptions ( )

Definition at line 19 of file LangOptions.cpp.

Member Function Documentation

◆ allowsNonTrivialObjCLifetimeQualifiers()

bool clang::LangOptions::allowsNonTrivialObjCLifetimeQualifiers ( ) const
inline

True if any ObjC types may have non-trivial lifetime qualifiers.

Definition at line 540 of file LangOptions.h.

Referenced by clang::Sema::PerformImplicitConversion().

◆ assumeFunctionsAreConvergent()

bool clang::LangOptions::assumeFunctionsAreConvergent ( ) const
inline

Definition at line 544 of file LangOptions.h.

◆ getDefaultExceptionMode()

FPExceptionModeKind clang::LangOptions::getDefaultExceptionMode ( ) const
inline

Definition at line 632 of file LangOptions.h.

◆ getDefaultRoundingMode()

RoundingMode clang::LangOptions::getDefaultRoundingMode ( ) const
inline

Definition at line 627 of file LangOptions.h.

Referenced by clang::CodeGen::CodeGenFunction::StartFunction().

◆ getOpenCLCompatibleVersion()

unsigned LangOptions::getOpenCLCompatibleVersion ( ) const

◆ getOpenCLVersionString()

std::string LangOptions::getOpenCLVersionString ( ) const

Return the OpenCL C or C++ for OpenCL language name and version as a string.

Definition at line 71 of file LangOptions.cpp.

References string().

◆ getOpenCLVersionTuple()

VersionTuple LangOptions::getOpenCLVersionTuple ( ) const

Return the OpenCL C or C++ version as a VersionTuple.

Definition at line 48 of file LangOptions.cpp.

◆ hasDefaultVisibilityExportMapping()

bool clang::LangOptions::hasDefaultVisibilityExportMapping ( ) const
inline

Definition at line 609 of file LangOptions.h.

References None.

Referenced by clang::CodeGen::CodeGenModule::shouldMapVisibilityToDLLExport().

◆ hasDWARFExceptions()

bool clang::LangOptions::hasDWARFExceptions ( ) const
inline

Definition at line 599 of file LangOptions.h.

References DwarfCFI.

Referenced by getCPersonality(), and getCXXPersonality().

◆ hasSEHExceptions()

bool clang::LangOptions::hasSEHExceptions ( ) const
inline

Definition at line 595 of file LangOptions.h.

References WinEH.

Referenced by getCPersonality(), getCXXPersonality(), and getObjCPersonality().

◆ hasSignReturnAddress()

bool clang::LangOptions::hasSignReturnAddress ( ) const
inline

Check if return address signing is enabled.

Definition at line 577 of file LangOptions.h.

References None.

Referenced by clang::CodeGen::CodeGenModule::Release().

◆ hasSjLjExceptions()

bool clang::LangOptions::hasSjLjExceptions ( ) const
inline

Definition at line 591 of file LangOptions.h.

References SjLj.

Referenced by getCPersonality(), getCXXPersonality(), and getObjCPersonality().

◆ hasWasmExceptions()

bool clang::LangOptions::hasWasmExceptions ( ) const
inline

◆ implicitFunctionsAllowed()

bool clang::LangOptions::implicitFunctionsAllowed ( ) const
inline

Returns true if implicit function declarations are allowed in the current language mode.

Definition at line 566 of file LangOptions.h.

References clang::OpenCL, and requiresStrictPrototypes().

◆ isAllDefaultVisibilityExportMapping()

bool clang::LangOptions::isAllDefaultVisibilityExportMapping ( ) const
inline

Definition at line 619 of file LangOptions.h.

References All.

Referenced by clang::CodeGen::CodeGenModule::shouldMapVisibilityToDLLExport().

◆ isCompatibleWithMSVC()

bool clang::LangOptions::isCompatibleWithMSVC ( MSVCMajorVersion  MajorVersion) const
inline

◆ isCompilingModule()

bool clang::LangOptions::isCompilingModule ( ) const
inline

◆ isCompilingModuleImplementation()

bool clang::LangOptions::isCompilingModuleImplementation ( ) const
inline

Are we compiling a module implementation?

Definition at line 509 of file LangOptions.h.

References isCompilingModule(), and ModuleName.

◆ isCompilingModuleInterface()

bool clang::LangOptions::isCompilingModuleInterface ( ) const
inline

Are we compiling a standard c++ module interface?

Definition at line 504 of file LangOptions.h.

References CMK_ModuleInterface.

◆ isExplicitDefaultVisibilityExportMapping()

bool clang::LangOptions::isExplicitDefaultVisibilityExportMapping ( ) const
inline

Definition at line 614 of file LangOptions.h.

References Explicit.

Referenced by clang::CodeGen::CodeGenModule::shouldMapVisibilityToDLLExport().

◆ isImplicitIntAllowed()

bool clang::LangOptions::isImplicitIntAllowed ( ) const
inline

Returns true if implicit int is supported at all.

Definition at line 574 of file LangOptions.h.

References clang::C2x, and clang::CPlusPlus.

◆ isImplicitIntRequired()

bool clang::LangOptions::isImplicitIntRequired ( ) const
inline

Returns true if implicit int is part of the language requirements.

Definition at line 571 of file LangOptions.h.

References clang::C99, and clang::CPlusPlus.

◆ isNoBuiltinFunc()

bool LangOptions::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?

Definition at line 41 of file LangOptions.cpp.

References NoBuiltinFuncs.

◆ isSignedOverflowDefined()

bool clang::LangOptions::isSignedOverflowDefined ( ) const
inline

Definition at line 518 of file LangOptions.h.

References SOB_Defined.

Referenced by emitPointerArithmetic().

◆ isSignReturnAddressScopeAll()

bool clang::LangOptions::isSignReturnAddressScopeAll ( ) const
inline

Check if leaf functions are also signed.

Definition at line 587 of file LangOptions.h.

References All.

Referenced by clang::CodeGen::CodeGenModule::Release().

◆ isSignReturnAddressWithAKey()

bool clang::LangOptions::isSignReturnAddressWithAKey ( ) const
inline

Check if return address signing uses AKey.

Definition at line 582 of file LangOptions.h.

References AKey.

Referenced by clang::CodeGen::CodeGenModule::Release().

◆ isSubscriptPointerArithmetic()

bool clang::LangOptions::isSubscriptPointerArithmetic ( ) const
inline

Definition at line 522 of file LangOptions.h.

References clang::ObjCRuntime::isSubscriptPointerArithmetic().

◆ isSYCL()

bool clang::LangOptions::isSYCL ( ) const
inline

Definition at line 607 of file LangOptions.h.

◆ remapPathPrefix()

void LangOptions::remapPathPrefix ( SmallVectorImpl< char > &  Path) const

Remap path prefix according to -fmacro-prefix-path option.

Definition at line 65 of file LangOptions.cpp.

References MacroPrefixMap.

◆ requiresStrictPrototypes()

bool clang::LangOptions::requiresStrictPrototypes ( ) const
inline

Returns true if functions without prototypes or functions with an identifier list (aka K&R C functions) are not allowed.

Definition at line 560 of file LangOptions.h.

References clang::C2x, and clang::CPlusPlus.

Referenced by implicitFunctionsAllowed().

◆ resetNonModularOptions()

void LangOptions::resetNonModularOptions ( )

Reset all of the options that are not considered when building a module.

Definition at line 25 of file LangOptions.cpp.

References CurrentModule, IsHeaderFile, NoSanitizeFiles, XRayAlwaysInstrumentFiles, and XRayNeverInstrumentFiles.

Referenced by clang::CompilerInvocation::resetNonModularOptions().

◆ setLangDefaults()

void LangOptions::setLangDefaults ( LangOptions Opts,
Language  Lang,
const llvm::Triple &  T,
std::vector< std::string > &  Includes,
LangStandard::Kind  LangStd = LangStandard::lang_unspecified 
)
static

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 81 of file LangOptions.cpp.

References clang::Asm, clang::CUDA, FPM_Fast, FPM_FastHonorPragmas, FPM_On, clang::getDefaultLanguageStandard(), clang::LangStandard::getLangStandardForKind(), getOpenCLCompatibleVersion(), clang::HIP, clang::HLSL, HLSL_2015, HLSL_2016, HLSL_2017, HLSL_2018, HLSL_2021, HLSL_202x, clang::LangStandard::lang_unspecified, LangStd, clang::ObjC, clang::ObjCXX, clang::RenderScript, and Std.

◆ trackLocalOwningModule()

bool clang::LangOptions::trackLocalOwningModule ( ) const
inline

Do we need to track the owning module for a local declaration?

Definition at line 514 of file LangOptions.h.

References isCompilingModule().

Referenced by clang::Decl::hasLocalOwningModuleStorage().

Member Data Documentation

◆ CFRuntime

CoreFoundationABI clang::LangOptions::CFRuntime = CoreFoundationABI::Unspecified

◆ CommentOpts

CommentOptions clang::LangOptions::CommentOpts

◆ CUID

std::string clang::LangOptions::CUID

The user provided compilation unit ID, if non-empty.

This is used to externalize static variables which is needed to support accessing static device variables in host code for single source offloading languages like CUDA/HIP.

Definition at line 451 of file LangOptions.h.

Referenced by clang::ASTContext::getCUIDHash(), and clang::CodeGen::CodeGenModule::printPostfixForExternalizedDecl().

◆ 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 422 of file LangOptions.h.

Referenced by clang::FrontendAction::getCurrentModule(), clang::Preprocessor::getModuleForLocation(), clang::PCHGenerator::HandleTranslationUnit(), prepareToBuildModule(), and resetNonModularOptions().

◆ CXXABI

llvm::Optional<TargetCXXABI::Kind> clang::LangOptions::CXXABI

C++ ABI to compile with, if specified by the frontend through -fc++-abi=.

This overrides the default ABI used by the target.

Definition at line 455 of file LangOptions.h.

Referenced by clang::ASTContext::getCXXABIKind().

◆ GPUDefaultStream

GPUDefaultStreamKind clang::LangOptions::GPUDefaultStream

The default stream kind used for HIP kernel launching.

Definition at line 462 of file LangOptions.h.

◆ IsHeaderFile

bool clang::LangOptions::IsHeaderFile = false

Indicates whether the front-end is explicitly told that the input is a header file (i.e.

-x c-header).

Definition at line 459 of file LangOptions.h.

Referenced by resetNonModularOptions().

◆ LangStd

LangStandard::Kind clang::LangOptions::LangStd

The used language standard.

Definition at line 370 of file LangOptions.h.

Referenced by setLangDefaults().

◆ MacroPrefixMap

std::map<std::string, std::string, std::greater<std::string> > clang::LangOptions::MacroPrefixMap

A prefix map for FILE, BASE_FILE and __builtin_FILE().

Definition at line 437 of file LangOptions.h.

Referenced by remapPathPrefix().

◆ ModuleFeatures

std::vector<std::string> clang::LangOptions::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.

This list is sorted.

Definition at line 428 of file LangOptions.h.

◆ ModuleName

std::string clang::LangOptions::ModuleName

The module currently being compiled as specified by -fmodule-name.

Definition at line 415 of file LangOptions.h.

Referenced by isCompilingModuleImplementation(), and loadModuleMapForModuleBuild().

◆ NoBuiltinFuncs

std::vector<std::string> clang::LangOptions::NoBuiltinFuncs

A list of all -fno-builtin-* function names (e.g., memset).

Definition at line 434 of file LangOptions.h.

Referenced by isNoBuiltinFunc().

◆ NoSanitizeFiles

std::vector<std::string> clang::LangOptions::NoSanitizeFiles

Paths to files specifying which objects (files, functions, variables) should not be instrumented.

Definition at line 379 of file LangOptions.h.

Referenced by resetNonModularOptions().

◆ ObjCConstantStringClass

std::string clang::LangOptions::ObjCConstantStringClass

Definition at line 406 of file LangOptions.h.

◆ ObjCRuntime

clang::ObjCRuntime clang::LangOptions::ObjCRuntime

◆ 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 445 of file LangOptions.h.

Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::CGOpenMPRuntimeGPU().

◆ OMPTargetTriples

std::vector<llvm::Triple> clang::LangOptions::OMPTargetTriples

Triples of the OpenMP targets that the host code codegen should take into account in order to generate accurate offloading descriptors.

Definition at line 441 of file LangOptions.h.

Referenced by clang::CodeGen::CGOpenMPRuntime::emitDeclareTargetVarDefinition(), and clang::CodeGen::CGOpenMPRuntime::emitRequiresDirectiveRegFun().

◆ 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 412 of file LangOptions.h.

◆ ProfileListFiles

std::vector<std::string> clang::LangOptions::ProfileListFiles

Paths to special case list files specifying which entities (files, functions) should or should not be instrumented.

Definition at line 400 of file LangOptions.h.

◆ RandstructSeed

std::string clang::LangOptions::RandstructSeed

The seed used by the randomize structure layout feature.

Definition at line 465 of file LangOptions.h.

Referenced by clang::randstruct::randomizeStructureLayout().

◆ Sanitize

SanitizerSet clang::LangOptions::Sanitize

◆ SanitizeCoverage

bool clang::LangOptions::SanitizeCoverage = false

Is at least one coverage instrumentation type enabled.

Definition at line 375 of file LangOptions.h.

◆ UseTargetPathSeparator

bool clang::LangOptions::UseTargetPathSeparator = false

Indicates whether the FILE macro should use the target's platform-specific file separator or whether it should use the build environment's platform-specific file separator.

The plaform-specific path separator is the backslash() for Windows and forward slash (/) elsewhere.

Definition at line 473 of file LangOptions.h.

◆ XRayAlwaysInstrumentFiles

std::vector<std::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 385 of file LangOptions.h.

Referenced by resetNonModularOptions().

◆ XRayAttrListFiles

std::vector<std::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 396 of file LangOptions.h.

◆ XRayNeverInstrumentFiles

std::vector<std::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 391 of file LangOptions.h.

Referenced by resetNonModularOptions().


The documentation for this class was generated from the following files: