clang: clang::CompilerInvocation Class Reference (original) (raw)

Helper class for holding the data necessary to invoke the compiler. More...

#include "[clang/Frontend/CompilerInvocation.h](CompilerInvocation%5F8h%5Fsource.html)"

Public Member Functions
CompilerInvocation ()=default
CompilerInvocation (const CompilerInvocation &X)
CompilerInvocation (CompilerInvocation &&)=default
CompilerInvocation & operator= (const CompilerInvocation &X)
~CompilerInvocation ()=default
CompilerInvocation (const CowCompilerInvocation &X)
CompilerInvocation & operator= (const CowCompilerInvocation &X)
std::string getModuleHash () const
Retrieve a module hash string that is suitable for uniquely identifying the conditions under which the module was built.
void resetNonModularOptions ()
Reset all of the options that are not considered when building a module.
void clearImplicitModuleBuildOptions ()
Disable implicit modules and canonicalize options that are only used by implicit modules.
LangOptions & getLangOpts ()
Mutable getters.
TargetOptions & getTargetOpts ()
DiagnosticOptions & getDiagnosticOpts ()
HeaderSearchOptions & getHeaderSearchOpts ()
PreprocessorOptions & getPreprocessorOpts ()
AnalyzerOptions & getAnalyzerOpts ()
MigratorOptions & getMigratorOpts ()
APINotesOptions & getAPINotesOpts ()
CodeGenOptions & getCodeGenOpts ()
FileSystemOptions & getFileSystemOpts ()
FrontendOptions & getFrontendOpts ()
DependencyOutputOptions & getDependencyOutputOpts ()
PreprocessorOutputOptions & getPreprocessorOutputOpts ()
const LangOptions & getLangOpts () const
Const getters.
const TargetOptions & getTargetOpts () const
const DiagnosticOptions & getDiagnosticOpts () const
const HeaderSearchOptions & getHeaderSearchOpts () const
const PreprocessorOptions & getPreprocessorOpts () const
const AnalyzerOptions & getAnalyzerOpts () const
const MigratorOptions & getMigratorOpts () const
const APINotesOptions & getAPINotesOpts () const
const CodeGenOptions & getCodeGenOpts () const
const FileSystemOptions & getFileSystemOpts () const
const FrontendOptions & getFrontendOpts () const
const DependencyOutputOptions & getDependencyOutputOpts () const
const PreprocessorOutputOptions & getPreprocessorOutputOpts () const
- Public Member Functions inherited from clang::CompilerInvocationBase
const LangOptions & getLangOpts () const
Const getters.
const TargetOptions & getTargetOpts () const
const DiagnosticOptions & getDiagnosticOpts () const
const HeaderSearchOptions & getHeaderSearchOpts () const
const PreprocessorOptions & getPreprocessorOpts () const
const AnalyzerOptions & getAnalyzerOpts () const
const MigratorOptions & getMigratorOpts () const
const APINotesOptions & getAPINotesOpts () const
const CodeGenOptions & getCodeGenOpts () const
const FileSystemOptions & getFileSystemOpts () const
const FrontendOptions & getFrontendOpts () const
const DependencyOutputOptions & getDependencyOutputOpts () const
const PreprocessorOutputOptions & getPreprocessorOutputOpts () const
void generateCC1CommandLine (llvm::SmallVectorImpl< const char * > &Args, StringAllocator SA) const
Generate cc1-compatible command line arguments from this instance.
void generateCC1CommandLine (ArgumentConsumer Consumer) const
Generate cc1-compatible command line arguments from this instance.
std::vector< std::string > getCC1CommandLine () const
Generate cc1-compatible command line arguments from this instance, wrapping the result as a std::vectorstd::string.
Static Public Member Functions
static bool CreateFromArgs (CompilerInvocation &Res, ArrayRef< const char * > CommandLineArgs, DiagnosticsEngine &Diags, const char *Argv0=nullptr)
Create a compiler invocation from a list of input options.
static std::string GetResourcesPath (const char *Argv0, void *MainAddr)
Get the directory where the compiler headers reside, relative to the compiler binary (found by the passed in arguments).
static void setDefaultPointerAuthOptions (PointerAuthOptions &Opts, const LangOptions &LangOpts, const llvm::Triple &Triple)
Populate Opts with the default set of pointer authentication-related options given LangOpts and Triple.
static bool checkCC1RoundTrip (ArrayRef< const char * > Args, DiagnosticsEngine &Diags, const char *Argv0=nullptr)
Check that Args can be parsed and re-serialized without change, emiting diagnostics for any differences.
std::shared_ptr< HeaderSearchOptions > getHeaderSearchOptsPtr ()
std::shared_ptr< PreprocessorOptions > getPreprocessorOptsPtr ()
std::shared_ptr< LangOptions > getLangOptsPtr ()
std::shared_ptr< LangOptions > LangOpts
Base class internals.
std::shared_ptr< TargetOptions > TargetOpts
Options controlling the target.
IntrusiveRefCntPtr< DiagnosticOptions > DiagnosticOpts
Options controlling the diagnostic engine.
Additional Inherited Members
- Public Types inherited from clang::CompilerInvocationBase
using StringAllocator = llvm::function_ref< const char *(const Twine &)>
Command line generation.
using ArgumentConsumer = llvm::function_ref< void(const Twine &)>
- Protected Member Functions inherited from clang::CompilerInvocationBase
CompilerInvocationBase ()
CompilerInvocationBase (EmptyConstructor)
CompilerInvocationBase (const CompilerInvocationBase &X)=delete
CompilerInvocationBase (CompilerInvocationBase &&X)=default
CompilerInvocationBase & operator= (const CompilerInvocationBase &X)=delete
CompilerInvocationBase & deep_copy_assign (const CompilerInvocationBase &X)
CompilerInvocationBase & shallow_copy_assign (const CompilerInvocationBase &X)
CompilerInvocationBase & operator= (CompilerInvocationBase &&X)=default
~CompilerInvocationBase ()=default
- Protected Attributes inherited from clang::CompilerInvocationBase
std::shared_ptr< LangOptions > LangOpts
Options controlling the language variant.
std::shared_ptr< TargetOptions > TargetOpts
Options controlling the target.
IntrusiveRefCntPtr< DiagnosticOptions > DiagnosticOpts
Options controlling the diagnostic engine.
std::shared_ptr< HeaderSearchOptions > HSOpts
Options controlling the #include directive.
std::shared_ptr< PreprocessorOptions > PPOpts
Options controlling the preprocessor (aside from #include handling).
AnalyzerOptionsRef AnalyzerOpts
Options controlling the static analyzer.
std::shared_ptr< MigratorOptions > MigratorOpts
std::shared_ptr< APINotesOptions > APINotesOpts
Options controlling API notes.
std::shared_ptr< CodeGenOptions > CodeGenOpts
Options controlling IRgen and the backend.
std::shared_ptr< FileSystemOptions > FSOpts
Options controlling file system operations.
std::shared_ptr< FrontendOptions > FrontendOpts
Options controlling the frontend itself.
std::shared_ptr< DependencyOutputOptions > DependencyOutputOpts
Options controlling dependency output.
std::shared_ptr< PreprocessorOutputOptions > PreprocessorOutputOpts
Options controlling preprocessed output.

Helper class for holding the data necessary to invoke the compiler.

This class is designed to represent an abstract "invocation" of the compiler, including data such as the include paths, the code generation options, the warning flags, and so on.

Definition at line 211 of file CompilerInvocation.h.

clang::CompilerInvocation::CompilerInvocation ( ) default

CompilerInvocation() [2/4]

CompilerInvocation() [3/4]

~CompilerInvocation()

clang::CompilerInvocation::~CompilerInvocation ( ) default

CompilerInvocation() [4/4]

checkCC1RoundTrip()

clearImplicitModuleBuildOptions()

void CompilerInvocation::clearImplicitModuleBuildOptions ( )

CreateFromArgs()

getAnalyzerOpts() [1/2]

getAnalyzerOpts() [2/2]

const AnalyzerOptions & clang::CompilerInvocationBase::getAnalyzerOpts ( ) const inline

getAPINotesOpts() [1/2]

getAPINotesOpts() [2/2]

const APINotesOptions & clang::CompilerInvocationBase::getAPINotesOpts ( ) const inline

getCodeGenOpts() [1/2]

getCodeGenOpts() [2/2]

const CodeGenOptions & clang::CompilerInvocationBase::getCodeGenOpts ( ) const inline

getDependencyOutputOpts() [1/2]

getDependencyOutputOpts() [2/2]

getDiagnosticOpts() [1/2]

getDiagnosticOpts() [2/2]

const DiagnosticOptions & clang::CompilerInvocationBase::getDiagnosticOpts ( ) const inline

getFileSystemOpts() [1/2]

getFileSystemOpts() [2/2]

const FileSystemOptions & clang::CompilerInvocationBase::getFileSystemOpts ( ) const inline

getFrontendOpts() [1/2]

getFrontendOpts() [2/2]

const FrontendOptions & clang::CompilerInvocationBase::getFrontendOpts ( ) const inline

getHeaderSearchOpts() [1/2]

getHeaderSearchOpts() [2/2]

const HeaderSearchOptions & clang::CompilerInvocationBase::getHeaderSearchOpts ( ) const inline

getHeaderSearchOptsPtr()

std::shared_ptr< HeaderSearchOptions > clang::CompilerInvocation::getHeaderSearchOptsPtr ( ) inline

getLangOpts() [1/2]

LangOptions & clang::CompilerInvocation::getLangOpts ( ) inline

getLangOpts() [2/2]

const LangOptions & clang::CompilerInvocationBase::getLangOpts ( ) const inline

getLangOptsPtr()

std::shared_ptr< LangOptions > clang::CompilerInvocation::getLangOptsPtr ( ) inline

getMigratorOpts() [1/2]

getMigratorOpts() [2/2]

const MigratorOptions & clang::CompilerInvocationBase::getMigratorOpts ( ) const inline

getModuleHash()

std::string CompilerInvocation::getModuleHash ( ) const

Retrieve a module hash string that is suitable for uniquely identifying the conditions under which the module was built.

Definition at line 5062 of file CompilerInvocation.cpp.

References clang::CompilerInvocationBase::APINotesOpts, clang::SanitizerSet::clear(), clang::PreprocessorOptions::DetailedRecord, clang::SanitizerSet::empty(), getAPINotesOpts(), clang::getClangFullRepositoryVersion(), getCodeGenOpts(), getDiagnosticOpts(), getFrontendOpts(), getHeaderSearchOpts(), getLangOpts(), clang::getPPTransparentSanitizers(), getPreprocessorOpts(), getTargetOpts(), clang::SanitizerSet::Mask, clang::HeaderSearchOptions::ModuleFormat, clang::HeaderSearchOptions::ModulesIgnoreMacros, clang::HeaderSearchOptions::ModulesStrictContextHash, clang::HeaderSearchOptions::ModulesValidateDiagnosticOptions, clang::HeaderSearchOptions::ModuleUserBuildPath, clang::HeaderSearchOptions::ResourceDir, clang::Result, clang::LangOptions::Sanitize, clang::HeaderSearchOptions::Sysroot, clang::HeaderSearchOptions::SystemHeaderPrefixes, toString(), clang::HeaderSearchOptions::UseBuiltinIncludes, clang::HeaderSearchOptions::UseDebugInfo, clang::HeaderSearchOptions::UseLibcxx, clang::PreprocessorOptions::UsePredefines, clang::HeaderSearchOptions::UserEntries, clang::HeaderSearchOptions::UseStandardCXXIncludes, clang::HeaderSearchOptions::UseStandardSystemIncludes, clang::serialization::VERSION_MAJOR, clang::serialization::VERSION_MINOR, and clang::HeaderSearchOptions::VFSOverlayFiles.

Referenced by clang::CompilerInstance::createPreprocessor(), and clang::tooling::dependencies::ModuleDepCollectorPP::LexedFileChanged().

getPreprocessorOpts() [1/2]

getPreprocessorOpts() [2/2]

const PreprocessorOptions & clang::CompilerInvocationBase::getPreprocessorOpts ( ) const inline

getPreprocessorOptsPtr()

std::shared_ptr< PreprocessorOptions > clang::CompilerInvocation::getPreprocessorOptsPtr ( ) inline

getPreprocessorOutputOpts() [1/2]

getPreprocessorOutputOpts() [2/2]

GetResourcesPath()

std::string CompilerInvocation::GetResourcesPath ( const char * Argv0, void * MainAddr ) static

Get the directory where the compiler headers reside, relative to the compiler binary (found by the passed in arguments).

Parameters

Argv0 - The program path (from argv[0]), for finding the builtin compiler path.
MainAddr - The address of main (or some other function in the main executable), for finding the builtin compiler path.

Definition at line 3229 of file CompilerInvocation.cpp.

References clang::driver::Driver::GetResourcesPath().

Referenced by injectResourceDir().

getTargetOpts() [1/2]

TargetOptions & clang::CompilerInvocation::getTargetOpts ( ) inline

getTargetOpts() [2/2]

const TargetOptions & clang::CompilerInvocationBase::getTargetOpts ( ) const inline

operator=() [1/2]

operator=() [2/2]

resetNonModularOptions()

void CompilerInvocation::resetNonModularOptions ( )

setDefaultPointerAuthOptions()

void CompilerInvocation::setDefaultPointerAuthOptions ( PointerAuthOptions & Opts, const LangOptions & LangOpts, const llvm::Triple & Triple ) static

Populate Opts with the default set of pointer authentication-related options given LangOpts and Triple.

Note: This is intended to be used by tools which must be aware of pointer authentication-related code generation, e.g. lldb.

Definition at line 1524 of file CompilerInvocation.cpp.

References clang::PointerAuthOptions::AArch64JumpTableHardening, clang::PointerAuthOptions::AuthTraps, clang::PointerAuthOptions::CXXMemberFunctionPointers, clang::PointerAuthOptions::CXXTypeInfoVTablePointer, clang::PointerAuthOptions::CXXVirtualFunctionPointers, clang::PointerAuthOptions::CXXVirtualVariadicFunctionPointers, clang::PointerAuthOptions::CXXVTablePointers, clang::PointerAuthOptions::CXXVTTVTablePointers, clang::PointerAuthOptions::FunctionPointers, clang::PointerAuthOptions::IndirectGotos, clang::InitFiniPointerConstantDiscriminator, clang::PointerAuthOptions::InitFiniPointers, LangOpts, clang::PointerAuthOptions::ReturnAddresses, and clang::StdTypeInfoVTablePointerConstantDiscrimination.

Referenced by parsePointerAuthOptions().

DiagnosticOpts

LangOpts

std::shared_ptr<LangOptions> clang::CompilerInvocationBase::LangOpts

TargetOpts

std::shared_ptr<TargetOptions> clang::CompilerInvocationBase::TargetOpts


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