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 visitPaths (llvm::function_ref< bool(StringRef)> Callback) const
Visitation.
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 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.
Additional Inherited Members
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
void visitPathsImpl (llvm::function_ref< bool(std::string &)> Predicate)
Visits paths stored in the invocation.
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.
std::shared_ptr< 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).
std::shared_ptr< AnalyzerOptions > 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 229 of file CompilerInvocation.h.

clang::CompilerInvocation::CompilerInvocation ( ) default

CompilerInvocation() [2/4]

CompilerInvocation() [3/4]

References CompilerInvocation().

~CompilerInvocation()

clang::CompilerInvocation::~CompilerInvocation ( ) default

References CompilerInvocation(), clang::CompilerInvocationBase::getAnalyzerOpts(), clang::CompilerInvocationBase::getAPINotesOpts(), clang::CompilerInvocationBase::getCodeGenOpts(), clang::CompilerInvocationBase::getDependencyOutputOpts(), clang::CompilerInvocationBase::getDiagnosticOpts(), clang::CompilerInvocationBase::getFileSystemOpts(), clang::CompilerInvocationBase::getFrontendOpts(), clang::CompilerInvocationBase::getHeaderSearchOpts(), clang::CompilerInvocationBase::getLangOpts(), clang::CompilerInvocationBase::getMigratorOpts(), clang::CompilerInvocationBase::getPreprocessorOpts(), clang::CompilerInvocationBase::getPreprocessorOutputOpts(), clang::CompilerInvocationBase::getTargetOpts(), and X.

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

getLangOpts() [1/2]

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

getLangOpts() [2/2]

const LangOptions & clang::CompilerInvocationBase::getLangOpts ( ) const 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 5144 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::Macro, clang::Macros, 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().

getPreprocessorOpts() [1/2]

getPreprocessorOpts() [2/2]

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

getPreprocessorOutputOpts() [1/2]

getPreprocessorOutputOpts() [2/2]

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 1428 of file CompilerInvocation.cpp.

References clang::PointerAuthOptions::AArch64JumpTableHardening, clang::PointerAuthOptions::AuthTraps, clang::PointerAuthOptions::BlockByrefHelperFunctionPointers, clang::BlockDescriptorConstantDiscriminator, clang::PointerAuthOptions::BlockDescriptorPointers, clang::PointerAuthOptions::BlockHelperFunctionPointers, clang::PointerAuthOptions::BlockInvocationFunctionPointers, clang::ClassROConstantDiscriminator, 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, clang::IsaPointerConstantDiscriminator, clang::CompilerInvocationBase::LangOpts, clang::MethodListPointerConstantDiscriminator, clang::PointerAuthOptions::ObjCClassROPointers, clang::PointerAuthOptions::ObjCIsaPointers, clang::PointerAuthOptions::ObjCMethodListFunctionPointers, clang::PointerAuthOptions::ObjCMethodListPointer, clang::PointerAuthOptions::ObjCSuperPointers, clang::PointerAuthOptions::ReturnAddresses, clang::StdTypeInfoVTablePointerConstantDiscrimination, and clang::SuperPointerConstantDiscriminator.

Referenced by parsePointerAuthOptions().


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