clang API Documentation
Helper class for holding the data necessary to invoke the compiler. More...
#include <CompilerInvocation.h>
Public Member Functions | |
CompilerInvocation () | |
AnalyzerOptionsRef | getAnalyzerOpts () const |
MigratorOptions & | getMigratorOpts () |
const MigratorOptions & | getMigratorOpts () const |
CodeGenOptions & | getCodeGenOpts () |
const CodeGenOptions & | getCodeGenOpts () const |
DependencyOutputOptions & | getDependencyOutputOpts () |
const DependencyOutputOptions & | getDependencyOutputOpts () const |
FileSystemOptions & | getFileSystemOpts () |
const FileSystemOptions & | getFileSystemOpts () const |
FrontendOptions & | getFrontendOpts () |
const FrontendOptions & | getFrontendOpts () const |
PreprocessorOutputOptions & | getPreprocessorOutputOpts () |
const PreprocessorOutputOptions & | getPreprocessorOutputOpts () 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. | |
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. | |
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 | setLangDefaults (LangOptions &Opts, InputKind IK, LangStandard::Kind LangStd=LangStandard::lang_unspecified) |
Set language defaults for the given input language and language standard in the given LangOptions object. |
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 102 of file CompilerInvocation.h.
clang::CompilerInvocation::CompilerInvocation | ( | ) | [inline] |
Definition at line 124 of file CompilerInvocation.h.
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.
[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 1789 of file CompilerInvocation.cpp.
References clang::driver::options::CC1Option, clang::LangOptions::CommentOpts, clang::driver::createDriverOptTable(), getAnalyzerOpts(), getCodeGenOpts(), getDependencyOutputOpts(), clang::CompilerInvocationBase::getDiagnosticOpts(), getFileSystemOpts(), getFrontendOpts(), clang::CompilerInvocationBase::getHeaderSearchOpts(), clang::CompilerInvocationBase::getLangOpts(), getMigratorOpts(), clang::CompilerInvocationBase::getPreprocessorOpts(), getPreprocessorOutputOpts(), clang::CompilerInvocationBase::getTargetOpts(), clang::IK_AST, clang::IK_LLVM_IR, ParseAnalyzerArgs(), ParseCodeGenArgs(), ParseCommentArgs(), ParseDependencyOutputArgs(), clang::ParseDiagnosticArgs(), ParseFileSystemArgs(), ParseFrontendArgs(), ParseHeaderSearchArgs(), ParseLangArgs(), ParseMigratorArgs(), ParsePreprocessorArgs(), ParsePreprocessorOutputArgs(), ParseTargetArgs(), clang::FrontendOptions::ProgramAction, clang::DiagnosticsEngine::Report(), clang::frontend::RewriteObjC, and clang::format::Success.
Referenced by clang::createInvocationFromCommandLine(), and clang::tooling::newInvocation().
AnalyzerOptionsRef clang::CompilerInvocation::getAnalyzerOpts | ( | ) | const [inline] |
Definition at line 166 of file CompilerInvocation.h.
Referenced by CreateFromArgs().
CodeGenOptions& clang::CompilerInvocation::getCodeGenOpts | ( | ) | [inline] |
Definition at line 175 of file CompilerInvocation.h.
Referenced by CreateFromArgs().
const CodeGenOptions& clang::CompilerInvocation::getCodeGenOpts | ( | ) | const [inline] |
Definition at line 176 of file CompilerInvocation.h.
Definition at line 180 of file CompilerInvocation.h.
Referenced by CreateFromArgs().
const DependencyOutputOptions& clang::CompilerInvocation::getDependencyOutputOpts | ( | ) | const [inline] |
Definition at line 183 of file CompilerInvocation.h.
Definition at line 187 of file CompilerInvocation.h.
Referenced by clang::ASTUnit::create(), CreateFromArgs(), createInvocationForMigration(), and clang::ASTUnit::LoadFromCompilerInvocation().
const FileSystemOptions& clang::CompilerInvocation::getFileSystemOpts | ( | ) | const [inline] |
Definition at line 188 of file CompilerInvocation.h.
FrontendOptions& clang::CompilerInvocation::getFrontendOpts | ( | ) | [inline] |
Definition at line 192 of file CompilerInvocation.h.
Referenced by applyTransforms(), CreateFromArgs(), clang::ASTUnit::getMainFileName(), and clang::ASTUnit::LoadFromCompilerInvocationAction().
const FrontendOptions& clang::CompilerInvocation::getFrontendOpts | ( | ) | const [inline] |
Definition at line 193 of file CompilerInvocation.h.
MigratorOptions& clang::CompilerInvocation::getMigratorOpts | ( | ) | [inline] |
Definition at line 170 of file CompilerInvocation.h.
Referenced by applyTransforms(), clang::arcmt::checkForManualIssues(), and CreateFromArgs().
const MigratorOptions& clang::CompilerInvocation::getMigratorOpts | ( | ) | const [inline] |
Definition at line 171 of file CompilerInvocation.h.
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 1899 of file CompilerInvocation.cpp.
References clang::PreprocessorOptions::DetailedRecord, clang::getClangFullRepositoryVersion(), clang::HeaderSearchOptions::ModulesIgnoreMacros, clang::HeaderSearchOptions::ModuleUserBuildPath, clang::HeaderSearchOptions::ResourceDir, clang::HeaderSearchOptions::Sysroot, clang::HeaderSearchOptions::UseBuiltinIncludes, clang::HeaderSearchOptions::UseLibcxx, clang::PreprocessorOptions::UsePredefines, clang::HeaderSearchOptions::UseStandardCXXIncludes, and clang::HeaderSearchOptions::UseStandardSystemIncludes.
Referenced by compileModuleImpl().
Definition at line 197 of file CompilerInvocation.h.
Referenced by CreateFromArgs().
const PreprocessorOutputOptions& clang::CompilerInvocation::getPreprocessorOutputOpts | ( | ) | const [inline] |
Definition at line 200 of file CompilerInvocation.h.
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).
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 975 of file CompilerInvocation.cpp.
References CLANG_VERSION_STRING, and P.
void CompilerInvocation::setLangDefaults | ( | LangOptions & | Opts, |
InputKind | IK, | ||
LangStandard::Kind | LangStd = LangStandard::lang_unspecified |
||
) | [static] |
Set language defaults for the given input language and language standard in the given LangOptions object.
Opts | - The LangOptions object to set up. |
IK | - The input language. |
LangStd | - The input language standard. |
Definition at line 1113 of file CompilerInvocation.cpp.
References clang::LangStandard::getLangStandardForKind(), clang::LangStandard::hasDigraphs(), clang::LangStandard::hasHexFloats(), clang::LangStandard::hasImplicitInt(), clang::LangStandard::hasLineComments(), clang::IK_Asm, clang::IK_AST, clang::IK_C, clang::IK_CUDA, clang::IK_CXX, clang::IK_LLVM_IR, clang::IK_None, clang::IK_ObjC, clang::IK_ObjCXX, clang::IK_OpenCL, clang::IK_PreprocessedC, clang::IK_PreprocessedCXX, clang::IK_PreprocessedObjC, clang::IK_PreprocessedObjCXX, clang::LangStandard::isC11(), clang::LangStandard::isC99(), clang::LangStandard::isCPlusPlus(), clang::LangStandard::isCPlusPlus11(), clang::LangStandard::isCPlusPlus14(), clang::LangStandard::isCPlusPlus1z(), and clang::LangStandard::isGNUMode().
Referenced by ParseLangArgs().