clang  8.0.0svn
Public Types | 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  SignedOverflowBehaviorTy { SOB_Undefined, SOB_Defined, SOB_Trapping }
 
enum  CompilingModuleKind { CMK_None, CMK_ModuleMap, CMK_HeaderModule, 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 = 16, MSVC2012 = 17, MSVC2013 = 18, MSVC2015 = 19 }
 
enum  ClangABI {
  ClangABI::Ver3_8, ClangABI::Ver4, ClangABI::Ver6, ClangABI::Ver7,
  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  FPContractModeKind { FPC_Off, FPC_On, FPC_Fast }
 
enum  FEnvAccessModeKind { FEA_Off, FEA_On }
 
using Visibility = clang::Visibility
 

Public Member Functions

 LangOptions ()
 
bool isCompilingModule () const
 Are we compiling a module interface (.cppm or module map)? 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...
 

Public Attributes

SanitizerSet Sanitize
 Set of enabled sanitizers. More...
 
std::vector< std::string > SanitizerBlacklistFiles
 Paths to blacklist files specifying which objects (files, functions, variables) should not be instrumented. More...
 
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. More...
 
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. More...
 
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). 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 speficied 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::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. More...
 
CommentOptions CommentOpts
 Options for parsing comments. More...
 
std::vector< std::string > NoBuiltinFuncs
 A list of all -fno-builtin-* function names (e.g., memset). 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...
 
bool IsHeaderFile = false
 Indicates whether the front-end is explicitly told that the input is a header file (i.e. 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 50 of file LangOptions.h.

Member Typedef Documentation

◆ Visibility

Definition at line 52 of file LangOptions.h.

Member Enumeration Documentation

◆ AddrSpaceMapMangling

Enumerator
ASMM_Target 
ASMM_On 
ASMM_Off 

Definition at line 99 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.

Latest 

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

Definition at line 109 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_ModuleInterface 

Compiling a C++ modules TS module interface unit.

Definition at line 69 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 138 of file LangOptions.h.

◆ DefaultCallingConvention

Enumerator
DCC_None 
DCC_CDecl 
DCC_FastCall 
DCC_StdCall 
DCC_VectorCall 
DCC_RegCall 

Definition at line 90 of file LangOptions.h.

◆ FEnvAccessModeKind

Enumerator
FEA_Off 
FEA_On 

Definition at line 167 of file LangOptions.h.

◆ FPContractModeKind

Enumerator
FPC_Off 
FPC_On 
FPC_Fast 

Definition at line 155 of file LangOptions.h.

◆ GCMode

Enumerator
NonGC 
GCOnly 
HybridGC 

Definition at line 54 of file LangOptions.h.

◆ MSVCMajorVersion

Enumerator
MSVC2010 
MSVC2012 
MSVC2013 
MSVC2015 

Definition at line 101 of file LangOptions.h.

◆ PragmaMSPointersToMembersKind

Enumerator
PPTMK_BestCase 
PPTMK_FullGeneralitySingleInheritance 
PPTMK_FullGeneralityMultipleInheritance 
PPTMK_FullGeneralityVirtualInheritance 

Definition at line 83 of file LangOptions.h.

◆ SignedOverflowBehaviorTy

Enumerator
SOB_Undefined 
SOB_Defined 
SOB_Trapping 

Definition at line 57 of file LangOptions.h.

◆ StackProtectorMode

Enumerator
SSPOff 
SSPOn 
SSPStrong 
SSPReq 

Definition at line 55 of file LangOptions.h.

Constructor & Destructor Documentation

◆ LangOptions()

LangOptions::LangOptions ( )

Definition at line 18 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 286 of file LangOptions.h.

Referenced by DiagnoseBadFunctionCast(), DiagnoseReinterpretUpDownCast(), clang::Sema::PerformImplicitConversion(), and TryReinterpretCast().

◆ assumeFunctionsAreConvergent()

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

Definition at line 290 of file LangOptions.h.

References clang::OpenCL.

◆ getOpenCLVersionTuple()

VersionTuple LangOptions::getOpenCLVersionTuple ( ) const

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

Definition at line 47 of file LangOptions.cpp.

◆ isCompatibleWithMSVC()

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

◆ isCompilingModule()

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

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

References NoBuiltinFuncs.

◆ isSignedOverflowDefined()

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

◆ isSubscriptPointerArithmetic()

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

Definition at line 268 of file LangOptions.h.

References clang::ObjCRuntime::isSubscriptPointerArithmetic().

◆ resetNonModularOptions()

void LangOptions::resetNonModularOptions ( )

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

Definition at line 24 of file LangOptions.cpp.

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

◆ trackLocalOwningModule()

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

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

Definition at line 260 of file LangOptions.h.

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

Member Data Documentation

◆ CFRuntime

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

◆ CommentOpts

CommentOptions clang::LangOptions::CommentOpts

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

Referenced by clang::Preprocessor::checkModuleIsAvailable(), clang::GenerateModuleAction::CreateASTConsumer(), clang::FrontendAction::getCurrentModule(), clang::Preprocessor::getModuleForLocation(), clang::PCHGenerator::HandleTranslationUnit(), isInCurrentModule(), isTargetEnvironment(), clang::CompilerInstance::loadModule(), prepareToBuildModule(), and resetNonModularOptions().

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

Referenced by clang::CompilerInvocation::CreateFromArgs(), EvaluateHasIncludeNext(), and resetNonModularOptions().

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

Referenced by checkLanguageOptions(), and hasFeature().

◆ ModuleName

std::string clang::LangOptions::ModuleName

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

Definition at line 212 of file LangOptions.h.

Referenced by clang::Preprocessor::checkModuleIsAvailable(), and compileModuleImpl().

◆ NoBuiltinFuncs

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

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

Definition at line 231 of file LangOptions.h.

Referenced by isNoBuiltinFunc().

◆ ObjCConstantStringClass

std::string clang::LangOptions::ObjCConstantStringClass

Definition at line 203 of file LangOptions.h.

Referenced by GetConstantStringEntry().

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

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

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

Referenced by clang::CodeGen::createOffloadingBinaryDescriptorRegistration(), and emitCommonOMPTargetDirective().

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

◆ Sanitize

SanitizerSet clang::LangOptions::Sanitize

◆ SanitizerBlacklistFiles

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

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

Definition at line 180 of file LangOptions.h.

Referenced by resetNonModularOptions().

◆ 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 186 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 197 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 192 of file LangOptions.h.

Referenced by resetNonModularOptions().


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