clang  6.0.0svn
Public Member Functions | List of all members
clang::CompilerInvocation Class Reference

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

#include "clang/Frontend/CompilerInvocation.h"

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

Public Member Functions

 CompilerInvocation ()
 
Option Subgroups
AnalyzerOptionsRef getAnalyzerOpts () const
 
MigratorOptionsgetMigratorOpts ()
 
const MigratorOptionsgetMigratorOpts () const
 
CodeGenOptionsgetCodeGenOpts ()
 
const CodeGenOptionsgetCodeGenOpts () const
 
DependencyOutputOptionsgetDependencyOutputOpts ()
 
const DependencyOutputOptionsgetDependencyOutputOpts () const
 
FileSystemOptionsgetFileSystemOpts ()
 
const FileSystemOptionsgetFileSystemOpts () const
 
FrontendOptionsgetFrontendOpts ()
 
const FrontendOptionsgetFrontendOpts () const
 
PreprocessorOutputOptionsgetPreprocessorOutputOpts ()
 
const PreprocessorOutputOptionsgetPreprocessorOutputOpts () const
 
- Public Member Functions inherited from clang::CompilerInvocationBase
 CompilerInvocationBase ()
 
 ~CompilerInvocationBase ()
 
 CompilerInvocationBase (const CompilerInvocationBase &X)
 
LangOptionsgetLangOpts ()
 
const LangOptionsgetLangOpts () const
 
TargetOptionsgetTargetOpts ()
 
const TargetOptionsgetTargetOpts () const
 
DiagnosticOptionsgetDiagnosticOpts () const
 
HeaderSearchOptionsgetHeaderSearchOpts ()
 
const HeaderSearchOptionsgetHeaderSearchOpts () const
 
std::shared_ptr< HeaderSearchOptionsgetHeaderSearchOptsPtr () const
 
std::shared_ptr< PreprocessorOptionsgetPreprocessorOptsPtr ()
 
PreprocessorOptionsgetPreprocessorOpts ()
 
const PreprocessorOptionsgetPreprocessorOpts () const
 

Utility Methods

std::string getModuleHash () const
 Retrieve a module hash string that is suitable for uniquely identifying the conditions under which the module was built. More...
 
static bool CreateFromArgs (CompilerInvocation &Res, const char *const *ArgBegin, const char *const *ArgEnd, DiagnosticsEngine &Diags)
 Create a compiler invocation from a list of input options. More...
 
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). More...
 
static void setLangDefaults (LangOptions &Opts, InputKind IK, const llvm::Triple &T, PreprocessorOptions &PPOpts, LangStandard::Kind LangStd=LangStandard::lang_unspecified)
 Set language defaults for the given input language and language standard in the given LangOptions object. More...
 

Additional Inherited Members

- Public Attributes inherited from clang::CompilerInvocationBase
std::shared_ptr< LangOptionsLangOpts
 Options controlling the language variant. More...
 
std::shared_ptr< TargetOptionsTargetOpts
 Options controlling the target. More...
 
IntrusiveRefCntPtr< DiagnosticOptionsDiagnosticOpts
 Options controlling the diagnostic engine. More...
 
std::shared_ptr< HeaderSearchOptionsHeaderSearchOpts
 Options controlling the #include directive. More...
 
std::shared_ptr< PreprocessorOptionsPreprocessorOpts
 Options controlling the preprocessor (aside from #include handling). More...
 

Detailed Description

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 110 of file CompilerInvocation.h.

Constructor & Destructor Documentation

◆ CompilerInvocation()

clang::CompilerInvocation::CompilerInvocation ( )
inline

Definition at line 132 of file CompilerInvocation.h.

References clang::T.

Member Function Documentation

◆ CreateFromArgs()

bool CompilerInvocation::CreateFromArgs ( CompilerInvocation Res,
const char *const *  ArgBegin,
const char *const *  ArgEnd,
DiagnosticsEngine Diags 
)
static

Create a compiler invocation from a list of input options.

Returns
true on success.
Parameters
[out]Res- The resulting invocation.
ArgBegin- The first element in the argument vector.
ArgEnd- The last element in the argument vector.
Diags- The diagnostic engine to use for errors.

Definition at line 2730 of file CompilerInvocation.cpp.

References clang::FrontendOptions::AuxTriple, clang::driver::options::CC1Option, clang::LangOptions::CommentOpts, clang::driver::createDriverOptTable(), clang::SanitizerSet::empty(), getAnalyzerOpts(), getCodeGenOpts(), getDependencyOutputOpts(), clang::CompilerInvocationBase::getDiagnosticOpts(), getFileSystemOpts(), getFrontendOpts(), clang::CompilerInvocationBase::getHeaderSearchOpts(), clang::CompilerInvocationBase::getLangOpts(), clang::getLastArgIntValue(), getMigratorOpts(), clang::CompilerInvocationBase::getPreprocessorOpts(), getPreprocessorOutputOpts(), clang::CompilerInvocationBase::getTargetOpts(), clang::SanitizerSet::has(), clang::TargetOptions::HostTriple, clang::LangOptions::IsHeaderFile, clang::CompilerInvocationBase::LangOpts, clang::InputKind::LLVM_IR, ParseAnalyzerArgs(), ParseCodeGenArgs(), ParseCommentArgs(), ParseDependencyOutputArgs(), clang::ParseDiagnosticArgs(), ParseFileSystemArgs(), ParseFrontendArgs(), ParseHeaderSearchArgs(), ParseLangArgs(), ParseMigratorArgs(), ParsePreprocessorArgs(), ParsePreprocessorOutputArgs(), parseSanitizerKinds(), ParseTargetArgs(), clang::InputKind::Precompiled, clang::FrontendOptions::ProgramAction, clang::DiagnosticsEngine::Report(), clang::frontend::RewriteObjC, clang::LangOptions::Sanitize, clang::T, clang::TargetOptions::Triple, clang::DiagnosticOptions::Warnings, and clang::FileSystemOptions::WorkingDir.

Referenced by clang::createInvocationFromCommandLine(), and clang::tooling::newInvocation().

◆ getAnalyzerOpts()

AnalyzerOptionsRef clang::CompilerInvocation::getAnalyzerOpts ( ) const
inline

Definition at line 179 of file CompilerInvocation.h.

Referenced by CreateFromArgs().

◆ getCodeGenOpts() [1/2]

CodeGenOptions& clang::CompilerInvocation::getCodeGenOpts ( )
inline

Definition at line 188 of file CompilerInvocation.h.

Referenced by CreateFromArgs().

◆ getCodeGenOpts() [2/2]

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

Definition at line 189 of file CompilerInvocation.h.

◆ getDependencyOutputOpts() [1/2]

DependencyOutputOptions& clang::CompilerInvocation::getDependencyOutputOpts ( )
inline

Definition at line 193 of file CompilerInvocation.h.

Referenced by CreateFromArgs().

◆ getDependencyOutputOpts() [2/2]

const DependencyOutputOptions& clang::CompilerInvocation::getDependencyOutputOpts ( ) const
inline

Definition at line 196 of file CompilerInvocation.h.

◆ getFileSystemOpts() [1/2]

FileSystemOptions& clang::CompilerInvocation::getFileSystemOpts ( )
inline

Definition at line 200 of file CompilerInvocation.h.

Referenced by CreateFromArgs(), and createInvocationForMigration().

◆ getFileSystemOpts() [2/2]

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

Definition at line 201 of file CompilerInvocation.h.

◆ getFrontendOpts() [1/2]

FrontendOptions& clang::CompilerInvocation::getFrontendOpts ( )
inline

◆ getFrontendOpts() [2/2]

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

Definition at line 206 of file CompilerInvocation.h.

◆ getMigratorOpts() [1/2]

MigratorOptions& clang::CompilerInvocation::getMigratorOpts ( )
inline

Definition at line 183 of file CompilerInvocation.h.

Referenced by CreateFromArgs().

◆ getMigratorOpts() [2/2]

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

Definition at line 184 of file CompilerInvocation.h.

◆ getModuleHash()

std::string CompilerInvocation::getModuleHash ( ) const

◆ getPreprocessorOutputOpts() [1/2]

PreprocessorOutputOptions& clang::CompilerInvocation::getPreprocessorOutputOpts ( )
inline

Definition at line 210 of file CompilerInvocation.h.

Referenced by CreateFromArgs().

◆ getPreprocessorOutputOpts() [2/2]

const PreprocessorOutputOptions& clang::CompilerInvocation::getPreprocessorOutputOpts ( ) const
inline

Definition at line 213 of file CompilerInvocation.h.

References clang::createVFSFromCompilerInvocation().

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

References P.

Referenced by clang::tooling::injectResourceDir().

◆ setLangDefaults()

void CompilerInvocation::setLangDefaults ( LangOptions Opts,
InputKind  IK,
const llvm::Triple &  T,
PreprocessorOptions PPOpts,
LangStandard::Kind  LangStd = LangStandard::lang_unspecified 
)
static

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