clang
9.0.0
|
CompilerInstance - Helper class for managing a single instance of the Clang compiler. More...
#include "clang/Frontend/CompilerInstance.h"
Public Member Functions | |
CompilerInstance (std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >(), InMemoryModuleCache *SharedModuleCache=nullptr) | |
~CompilerInstance () override | |
High-Level Operations | |
{ | |
bool | ExecuteAction (FrontendAction &Act) |
ExecuteAction - Execute the provided action against the compiler's CompilerInvocation object. More... | |
Compiler Invocation and Options | |
} { | |
bool | hasInvocation () const |
CompilerInvocation & | getInvocation () |
void | setInvocation (std::shared_ptr< CompilerInvocation > Value) |
setInvocation - Replace the current invocation. More... | |
bool | shouldBuildGlobalModuleIndex () const |
Indicates whether we should (re)build the global module index. More... | |
void | setBuildGlobalModuleIndex (bool Build) |
Set the flag indicating whether we should (re)build the global module index. More... | |
Forwarding Methods | |
} { | |
AnalyzerOptionsRef | getAnalyzerOpts () |
CodeGenOptions & | getCodeGenOpts () |
const CodeGenOptions & | getCodeGenOpts () const |
DependencyOutputOptions & | getDependencyOutputOpts () |
const DependencyOutputOptions & | getDependencyOutputOpts () const |
DiagnosticOptions & | getDiagnosticOpts () |
const DiagnosticOptions & | getDiagnosticOpts () const |
FileSystemOptions & | getFileSystemOpts () |
const FileSystemOptions & | getFileSystemOpts () const |
FrontendOptions & | getFrontendOpts () |
const FrontendOptions & | getFrontendOpts () const |
HeaderSearchOptions & | getHeaderSearchOpts () |
const HeaderSearchOptions & | getHeaderSearchOpts () const |
std::shared_ptr< HeaderSearchOptions > | getHeaderSearchOptsPtr () const |
LangOptions & | getLangOpts () |
const LangOptions & | getLangOpts () const |
PreprocessorOptions & | getPreprocessorOpts () |
const PreprocessorOptions & | getPreprocessorOpts () const |
PreprocessorOutputOptions & | getPreprocessorOutputOpts () |
const PreprocessorOutputOptions & | getPreprocessorOutputOpts () const |
TargetOptions & | getTargetOpts () |
const TargetOptions & | getTargetOpts () const |
Diagnostics Engine | |
} { | |
bool | hasDiagnostics () const |
DiagnosticsEngine & | getDiagnostics () const |
Get the current diagnostics engine. More... | |
void | setDiagnostics (DiagnosticsEngine *Value) |
setDiagnostics - Replace the current diagnostics engine. More... | |
DiagnosticConsumer & | getDiagnosticClient () const |
Target Info | |
} { | |
bool | hasTarget () const |
TargetInfo & | getTarget () const |
void | setTarget (TargetInfo *Value) |
Replace the current Target. More... | |
AuxTarget Info | |
} { | |
TargetInfo * | getAuxTarget () const |
void | setAuxTarget (TargetInfo *Value) |
Replace the current AuxTarget. More... | |
Virtual File System | |
} { | |
llvm::vfs::FileSystem & | getVirtualFileSystem () const |
File Manager | |
} { | |
bool | hasFileManager () const |
FileManager & | getFileManager () const |
Return the current file manager to the caller. More... | |
void | resetAndLeakFileManager () |
void | setFileManager (FileManager *Value) |
Replace the current file manager and virtual file system. More... | |
Source Manager | |
} { | |
bool | hasSourceManager () const |
SourceManager & | getSourceManager () const |
Return the current source manager. More... | |
void | resetAndLeakSourceManager () |
void | setSourceManager (SourceManager *Value) |
setSourceManager - Replace the current source manager. More... | |
Preprocessor | |
} { | |
bool | hasPreprocessor () const |
Preprocessor & | getPreprocessor () const |
Return the current preprocessor. More... | |
std::shared_ptr< Preprocessor > | getPreprocessorPtr () |
void | resetAndLeakPreprocessor () |
void | setPreprocessor (std::shared_ptr< Preprocessor > Value) |
Replace the current preprocessor. More... | |
ASTContext | |
} { | |
bool | hasASTContext () const |
ASTContext & | getASTContext () const |
void | resetAndLeakASTContext () |
void | setASTContext (ASTContext *Value) |
setASTContext - Replace the current AST context. More... | |
void | setSema (Sema *S) |
Replace the current Sema; the compiler instance takes ownership of S. More... | |
ASTConsumer | |
} { | |
bool | hasASTConsumer () const |
ASTConsumer & | getASTConsumer () const |
std::unique_ptr< ASTConsumer > | takeASTConsumer () |
takeASTConsumer - Remove the current AST consumer and give ownership to the caller. More... | |
void | setASTConsumer (std::unique_ptr< ASTConsumer > Value) |
setASTConsumer - Replace the current AST consumer; the compiler instance takes ownership of Value . More... | |
Semantic analysis | |
} { | |
bool | hasSema () const |
Sema & | getSema () const |
std::unique_ptr< Sema > | takeSema () |
void | resetAndLeakSema () |
Module Management | |
} { | |
IntrusiveRefCntPtr< ASTReader > | getModuleManager () const |
void | setModuleManager (IntrusiveRefCntPtr< ASTReader > Reader) |
std::shared_ptr< ModuleDependencyCollector > | getModuleDepCollector () const |
void | setModuleDepCollector (std::shared_ptr< ModuleDependencyCollector > Collector) |
std::shared_ptr< PCHContainerOperations > | getPCHContainerOperations () const |
const PCHContainerWriter & | getPCHContainerWriter () const |
Return the appropriate PCHContainerWriter depending on the current CodeGenOptions. More... | |
const PCHContainerReader & | getPCHContainerReader () const |
Return the appropriate PCHContainerReader depending on the current CodeGenOptions. More... | |
Code Completion | |
} { | |
bool | hasCodeCompletionConsumer () const |
CodeCompleteConsumer & | getCodeCompletionConsumer () const |
void | setCodeCompletionConsumer (CodeCompleteConsumer *Value) |
setCodeCompletionConsumer - Replace the current code completion consumer; the compiler instance takes ownership of Value . More... | |
Frontend timer | |
} { | |
bool | hasFrontendTimer () const |
llvm::Timer & | getFrontendTimer () const |
Output Files | |
} { | |
void | addOutputFile (OutputFile &&OutFile) |
addOutputFile - Add an output file onto the list of tracked output files. More... | |
void | clearOutputFiles (bool EraseFiles) |
clearOutputFiles - Clear the output file list. More... | |
![]() | |
ModuleLoader (bool BuildingModule=false) | |
virtual | ~ModuleLoader () |
bool | buildingModule () const |
Returns true if this instance is building a module. More... | |
void | setBuildingModule (bool BuildingModuleFlag) |
Flag indicating whether this instance is building a module. More... | |
Construction Utility Methods | |
{ | |
void | createDiagnostics (DiagnosticConsumer *Client=nullptr, bool ShouldOwnClient=true) |
Create the diagnostics engine using the invocation's diagnostic options and replace any existing one with it. More... | |
FileManager * | createFileManager (IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS=nullptr) |
Create the file manager and replace any existing one with it. More... | |
void | createSourceManager (FileManager &FileMgr) |
Create the source manager and replace any existing one with it. More... | |
void | createPreprocessor (TranslationUnitKind TUKind) |
Create the preprocessor, using the invocation, file, and source managers, and replace any existing one with it. More... | |
std::string | getSpecificModuleCachePath () |
void | createASTContext () |
Create the AST context. More... | |
void | createPCHExternalASTSource (StringRef Path, bool DisablePCHValidation, bool AllowPCHWithCompilerErrors, void *DeserializationListener, bool OwnDeserializationListener) |
Create an external AST source to read a PCH file and attach it to the AST context. More... | |
void | createCodeCompletionConsumer () |
Create a code completion consumer using the invocation; note that this will cause the source manager to truncate the input source file at the completion point. More... | |
void | createSema (TranslationUnitKind TUKind, CodeCompleteConsumer *CompletionConsumer) |
Create the Sema object to be used for parsing. More... | |
void | createFrontendTimer () |
Create the frontend timer and replace any existing one with it. More... | |
std::unique_ptr< raw_pwrite_stream > | createDefaultOutputFile (bool Binary=true, StringRef BaseInput="", StringRef Extension="") |
Create the default output file (from the invocation's options) and add it to the list of tracked output files. More... | |
std::unique_ptr< raw_pwrite_stream > | createOutputFile (StringRef OutputPath, bool Binary, bool RemoveFileOnSignal, StringRef BaseInput, StringRef Extension, bool UseTemporary, bool CreateMissingDirectories=false) |
Create a new output file and add it to the list of tracked output files, optionally deriving the output path name. More... | |
std::unique_ptr< raw_pwrite_stream > | createOutputFile (StringRef OutputPath, std::error_code &Error, bool Binary, bool RemoveFileOnSignal, StringRef BaseInput, StringRef Extension, bool UseTemporary, bool CreateMissingDirectories, std::string *ResultPathName, std::string *TempPathName) |
Create a new output file, optionally deriving the output path name. More... | |
std::unique_ptr< raw_pwrite_stream > | createNullOutputFile () |
static IntrusiveRefCntPtr< DiagnosticsEngine > | createDiagnostics (DiagnosticOptions *Opts, DiagnosticConsumer *Client=nullptr, bool ShouldOwnClient=true, const CodeGenOptions *CodeGenOpts=nullptr) |
Create a DiagnosticsEngine object with a the TextDiagnosticPrinter. More... | |
static IntrusiveRefCntPtr< ASTReader > | createPCHExternalASTSource (StringRef Path, StringRef Sysroot, bool DisablePCHValidation, bool AllowPCHWithCompilerErrors, Preprocessor &PP, InMemoryModuleCache &ModuleCache, ASTContext &Context, const PCHContainerReader &PCHContainerRdr, ArrayRef< std::shared_ptr< ModuleFileExtension >> Extensions, ArrayRef< std::shared_ptr< DependencyCollector >> DependencyCollectors, void *DeserializationListener, bool OwnDeserializationListener, bool Preamble, bool UseGlobalModuleIndex) |
Create an external AST source to read a PCH file. More... | |
static CodeCompleteConsumer * | createCodeCompletionConsumer (Preprocessor &PP, StringRef Filename, unsigned Line, unsigned Column, const CodeCompleteOptions &Opts, raw_ostream &OS) |
Create a code completion consumer to print code completion results, at Filename , Line , and Column , to the given output stream OS . More... | |
Initialization Utility Methods | |
{ | |
bool | InitializeSourceManager (const FrontendInputFile &Input) |
InitializeSourceManager - Initialize the source manager to set InputFile as the main file. More... | |
void | setOutputStream (std::unique_ptr< llvm::raw_pwrite_stream > OutStream) |
} More... | |
std::unique_ptr< llvm::raw_pwrite_stream > | takeOutputStream () |
void | createModuleManager () |
bool | loadModuleFile (StringRef FileName) |
ModuleLoadResult | loadModule (SourceLocation ImportLoc, ModuleIdPath Path, Module::NameVisibilityKind Visibility, bool IsInclusionDirective) override |
Attempt to load the given module. More... | |
void | loadModuleFromSource (SourceLocation ImportLoc, StringRef ModuleName, StringRef Source) override |
Attempt to load the given module from the specified source buffer. More... | |
void | makeModuleVisible (Module *Mod, Module::NameVisibilityKind Visibility, SourceLocation ImportLoc) override |
Make the given module visible. More... | |
bool | hadModuleLoaderFatalFailure () const |
GlobalModuleIndex * | loadGlobalModuleIndex (SourceLocation TriggerLoc) override |
Load, create, or return global module. More... | |
bool | lookupMissingImports (StringRef Name, SourceLocation TriggerLoc) override |
Check global module index for missing imports. More... | |
void | addDependencyCollector (std::shared_ptr< DependencyCollector > Listener) |
void | setExternalSemaSource (IntrusiveRefCntPtr< ExternalSemaSource > ESS) |
InMemoryModuleCache & | getModuleCache () const |
static bool | InitializeSourceManager (const FrontendInputFile &Input, DiagnosticsEngine &Diags, FileManager &FileMgr, SourceManager &SourceMgr, HeaderSearch *HS, DependencyOutputOptions &DepOpts, const FrontendOptions &Opts) |
InitializeSourceManager - Initialize the source manager to set InputFile as the main file. More... | |
Additional Inherited Members | |
![]() | |
bool | HadFatalFailure = false |
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
The CompilerInstance serves two purposes: (1) It manages the various objects which are necessary to run the compiler, for example the preprocessor, the target information, and the AST context. (2) It provides utility routines for constructing and manipulating the common Clang objects.
The compiler instance generally owns the instance of all the objects that it manages. However, clients can still share objects by manually setting the object and retaking ownership prior to destroying the CompilerInstance.
The compiler instance is intended to simplify clients, but not to lock them in to the compiler instance for everything. When possible, utility functions come in two forms; a short form that reuses the CompilerInstance objects, and a long form that takes explicit instances of any required objects.
Definition at line 72 of file CompilerInstance.h.
|
explicit |
Definition at line 59 of file CompilerInstance.cpp.
|
override |
Definition at line 68 of file CompilerInstance.cpp.
|
inline |
Definition at line 793 of file CompilerInstance.h.
Referenced by createPreprocessor().
void CompilerInstance::addOutputFile | ( | OutputFile && | OutFile | ) |
addOutputFile - Add an output file onto the list of tracked output files.
OutFile | - The output file info. |
Definition at line 625 of file CompilerInstance.cpp.
Referenced by createOutputFile().
void CompilerInstance::clearOutputFiles | ( | bool | EraseFiles | ) |
clearOutputFiles - Clear the output file list.
The underlying output streams must have been closed beforehand.
EraseFiles | - If true, attempt to erase the files from disk. |
Definition at line 629 of file CompilerInstance.cpp.
References getDiagnostics(), clang::tooling::remove(), and clang::DiagnosticsEngine::Report().
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().
void CompilerInstance::createASTContext | ( | ) |
Create the AST context.
Definition at line 473 of file CompilerInstance.cpp.
References getAuxTarget(), clang::Preprocessor::getBuiltinInfo(), clang::Preprocessor::getIdentifierTable(), getLangOpts(), getPreprocessor(), clang::Preprocessor::getSelectorTable(), clang::Preprocessor::getSourceManager(), getTarget(), and setASTContext().
Referenced by clang::FrontendAction::BeginSourceFile(), and createModuleManager().
void CompilerInstance::createCodeCompletionConsumer | ( | ) |
Create a code completion consumer using the invocation; note that this will cause the source manager to truncate the input source file at the completion point.
Definition at line 573 of file CompilerInstance.cpp.
References clang::FrontendOptions::CodeCompletionAt, clang::ParsedSourceLocation::Column, EnableCodeCompletion(), clang::ParsedSourceLocation::FileName, getFrontendOpts(), getPreprocessor(), clang::ParsedSourceLocation::Line, and setCodeCompletionConsumer().
Referenced by clang::ASTFrontendAction::ExecuteAction().
|
static |
Create a code completion consumer to print code completion results, at Filename
, Line
, and Column
, to the given output stream OS
.
Definition at line 599 of file CompilerInstance.cpp.
References EnableCodeCompletion().
std::unique_ptr< raw_pwrite_stream > CompilerInstance::createDefaultOutputFile | ( | bool | Binary = true , |
StringRef | BaseInput = "" , |
||
StringRef | Extension = "" |
||
) |
Create the default output file (from the invocation's options) and add it to the list of tracked output files.
The files created by this function always use temporary files to write to their result (that is, the data is written to a temporary file which will atomically replace the target output on success).
Definition at line 661 of file CompilerInstance.cpp.
References createOutputFile(), and getFrontendOpts().
Referenced by clang::RewriteIncludesAction::BeginSourceFileAction(), clang::HTMLPrintAction::CreateASTConsumer(), clang::ASTPrintAction::CreateASTConsumer(), clang::RewriteObjCAction::CreateASTConsumer(), clang::GenerateModuleAction::CreateASTConsumer(), clang::RewriteMacrosAction::ExecuteAction(), clang::RewriteTestAction::ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), GetOutputStream(), and InterfaceStubFunctionsConsumer::HandleTranslationUnit().
void CompilerInstance::createDiagnostics | ( | DiagnosticConsumer * | Client = nullptr , |
bool | ShouldOwnClient = true |
||
) |
Create the diagnostics engine using the invocation's diagnostic options and replace any existing one with it.
Note that this routine also replaces the diagnostic client, allocating one if one is not provided.
Client | If non-NULL, a diagnostic client that will be attached to (and, then, owned by) the DiagnosticsEngine inside this AST unit. |
ShouldOwnClient | If Client is non-NULL, specifies whether the diagnostic object should take ownership of the client. |
Definition at line 259 of file CompilerInstance.cpp.
References getCodeGenOpts(), and getDiagnosticOpts().
Referenced by clang::createInvocationFromCommandLine(), clang::tooling::ClangTool::run(), and clang::tooling::FrontendActionFactory::runInvocation().
|
static |
Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
If no diagnostic client is provided, this creates a DiagnosticConsumer that is owned by the returned diagnostic object, if using directly the caller is responsible for releasing the returned DiagnosticsEngine's client eventually.
Opts | - The diagnostic options; note that the created text diagnostic object contains a reference to these options. |
Client | If non-NULL, a diagnostic client that will be attached to (and, then, owned by) the returned DiagnosticsEngine object. |
CodeGenOpts | If non-NULL, the code gen options in use, which may be used by some diagnostics printers (for logging purposes only). |
Definition at line 266 of file CompilerInstance.cpp.
References clang::DiagnosticOptions::DiagnosticLogFile, clang::DiagnosticOptions::DiagnosticSerializationFile, clang::ProcessWarningOptions(), SetUpDiagnosticLog(), and SetupSerializedDiagnostics().
FileManager * CompilerInstance::createFileManager | ( | IntrusiveRefCntPtr< llvm::vfs::FileSystem > | VFS = nullptr | ) |
Create the file manager and replace any existing one with it.
Definition at line 301 of file CompilerInstance.cpp.
References clang::createVFSFromCompilerInvocation(), getDiagnostics(), getFileSystemOpts(), and getInvocation().
Referenced by clang::FrontendAction::BeginSourceFile().
void CompilerInstance::createFrontendTimer | ( | ) |
Create the frontend timer and replace any existing one with it.
Definition at line 590 of file CompilerInstance.cpp.
void CompilerInstance::createModuleManager | ( | ) |
Definition at line 1451 of file CompilerInstance.cpp.
References createASTContext(), clang::PreprocessorOptions::DisablePCHValidation, getASTConsumer(), getASTContext(), getFrontendOpts(), getHeaderSearchOpts(), getModuleCache(), getPCHContainerReader(), getPreprocessor(), getPreprocessorOpts(), getSema(), getSourceManager(), hasASTConsumer(), hasASTContext(), hasSema(), clang::HeaderSearchOptions::ModulesValidateSystemHeaders, pruneModuleCache(), clang::ASTContext::setASTMutationListener(), clang::ASTReader::setDeserializationListener(), clang::ASTContext::setExternalSource(), clang::HeaderSearchOptions::Sysroot, and clang::FrontendOptions::UseGlobalModuleIndex.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::RewriteIncludesAction::BeginSourceFileAction(), loadGlobalModuleIndex(), loadModule(), and makeModuleVisible().
std::unique_ptr< raw_pwrite_stream > CompilerInstance::createNullOutputFile | ( | ) |
Definition at line 668 of file CompilerInstance.cpp.
Referenced by GetOutputStream().
std::unique_ptr< raw_pwrite_stream > CompilerInstance::createOutputFile | ( | StringRef | OutputPath, |
bool | Binary, | ||
bool | RemoveFileOnSignal, | ||
StringRef | BaseInput, | ||
StringRef | Extension, | ||
bool | UseTemporary, | ||
bool | CreateMissingDirectories = false |
||
) |
Create a new output file and add it to the list of tracked output files, optionally deriving the output path name.
Definition at line 673 of file CompilerInstance.cpp.
References addOutputFile(), getDiagnostics(), and clang::DiagnosticsEngine::Report().
Referenced by clang::GenerateModuleAction::CreateASTConsumer(), createDefaultOutputFile(), and clang::GeneratePCHAction::CreateOutputFile().
std::unique_ptr< llvm::raw_pwrite_stream > CompilerInstance::createOutputFile | ( | StringRef | OutputPath, |
std::error_code & | Error, | ||
bool | Binary, | ||
bool | RemoveFileOnSignal, | ||
StringRef | BaseInput, | ||
StringRef | Extension, | ||
bool | UseTemporary, | ||
bool | CreateMissingDirectories, | ||
std::string * | ResultPathName, | ||
std::string * | TempPathName | ||
) |
Create a new output file, optionally deriving the output path name.
If OutputPath
is empty, then createOutputFile will derive an output path location as BaseInput
, with any suffix removed, and Extension
appended. If OutputPath
is not stdout and UseTemporary
is true, createOutputFile will create a new temporary file that must be renamed to OutputPath
in the end.
OutputPath | - If given, the path to the output file. |
Error | [out] - On failure, the error. |
BaseInput | - If OutputPath is empty, the input path name to use for deriving the output path. |
Extension | - The extension to use for derived output names. |
Binary | - The mode to open the file in. |
RemoveFileOnSignal | - Whether the file should be registered with llvm::sys::RemoveFileOnSignal. Note that this is not safe for multithreaded use, as the underlying signal mechanism is not reentrant |
UseTemporary | - Create a new temporary file that must be renamed to OutputPath in the end. |
CreateMissingDirectories | - When UseTemporary is true, create missing directories in the output path. |
ResultPathName | [out] - If given, the result path name will be stored here on success. |
TempPathName | [out] - If given, the temporary file path name will be stored here on success. |
Definition at line 696 of file CompilerInstance.cpp.
void CompilerInstance::createPCHExternalASTSource | ( | StringRef | Path, |
bool | DisablePCHValidation, | ||
bool | AllowPCHWithCompilerErrors, | ||
void * | DeserializationListener, | ||
bool | OwnDeserializationListener | ||
) |
Create an external AST source to read a PCH file and attach it to the AST context.
Definition at line 484 of file CompilerInstance.cpp.
References getASTContext(), getFrontendOpts(), getHeaderSearchOpts(), getModuleCache(), getPCHContainerReader(), getPreprocessor(), getPreprocessorOpts(), clang::Preamble, and clang::PreprocessorOptions::PrecompiledPreambleBytes.
Referenced by clang::FrontendAction::BeginSourceFile().
|
static |
Create an external AST source to read a PCH file.
Definition at line 497 of file CompilerInstance.cpp.
References clang::ASTReader::ARR_None, clang::ASTReader::ConfigurationMismatch, clang::ASTReader::Failure, clang::Preprocessor::getHeaderSearchInfo(), clang::HeaderSearch::getHeaderSearchOpts(), clang::ASTReader::HadErrors, clang::ASTReader::Missing, clang::serialization::MK_PCH, clang::serialization::MK_Preamble, clang::HeaderSearchOptions::ModulesValidateSystemHeaders, clang::ASTReader::OutOfDate, clang::ASTContext::setExternalSource(), clang::Preprocessor::setPredefines(), clang::ASTReader::Success, and clang::ASTReader::VersionMismatch.
void CompilerInstance::createPreprocessor | ( | TranslationUnitKind | TUKind | ) |
Create the preprocessor, using the invocation, file, and source managers, and replace any existing one with it.
Definition at line 370 of file CompilerInstance.cpp.
References addDependencyCollector(), clang::TargetInfo::adjust(), clang::ApplyHeaderSearchOptions(), clang::AttachDependencyGraphGen(), clang::AttachHeaderIncludeGen(), collectHeaderMaps(), collectIncludePCH(), collectVFSEntries(), clang::PreprocessorOptions::DetailedRecord, clang::DependencyOutputOptions::DOTOutputFile, getAuxTarget(), getDependencyOutputOpts(), getDiagnostics(), getFrontendOpts(), getHeaderSearchOpts(), getHeaderSearchOptsPtr(), getLangOpts(), getPCHContainerReader(), getPreprocessorOpts(), getPreprocessorOutputOpts(), getSourceManager(), getSpecificModuleCachePath(), getTarget(), clang::DependencyOutputOptions::HeaderIncludeOutputFile, InitializeFileRemapping(), clang::InitializePreprocessor(), clang::DependencyOutputOptions::ModuleDependencyOutputDir, clang::None, clang::DependencyOutputOptions::OutputFile, clang::DependencyOutputOptions::ShowHeaderIncludes, clang::DependencyOutputOptions::ShowIncludesDest, and clang::HeaderSearchOptions::Sysroot.
Referenced by clang::FrontendAction::BeginSourceFile().
void CompilerInstance::createSema | ( | TranslationUnitKind | TUKind, |
CodeCompleteConsumer * | CompletionConsumer | ||
) |
Create the Sema object to be used for parsing.
Definition at line 612 of file CompilerInstance.cpp.
References getASTConsumer(), getASTContext(), and getPreprocessor().
Referenced by clang::ASTFrontendAction::ExecuteAction().
void CompilerInstance::createSourceManager | ( | FileManager & | FileMgr | ) |
Create the source manager and replace any existing one with it.
Definition at line 314 of file CompilerInstance.cpp.
References getDiagnostics().
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::tooling::FrontendActionFactory::runInvocation().
bool CompilerInstance::ExecuteAction | ( | FrontendAction & | Act | ) |
ExecuteAction - Execute the provided action against the compiler's CompilerInvocation object.
This function makes the following assumptions:
Note that this routine may write output to 'stderr'.
Act | - The action to execute. |
Definition at line 882 of file CompilerInstance.cpp.
References clang::TargetInfo::adjust(), clang::TargetInfo::adjustTargetOptions(), clang::TargetInfo::CreateTargetInfo(), getAuxTarget(), getCodeGenOpts(), getDiagnostics(), getFrontendOpts(), getHeaderSearchOpts(), getInvocation(), getLangOpts(), getTarget(), getTargetOpts(), clang::TargetInfo::getTriple(), hasDiagnostics(), hasTarget(), normalize(), clang::TargetInfo::noSignedCharForObjCBool(), clang::FrontendAction::PrepareToExecute(), clang::frontend::RewriteObjC, setAuxTarget(), clang::TargetInfo::setAuxTarget(), and setTarget().
Referenced by clang::ExecuteCompilerInvocation(), and clang::tooling::FrontendActionFactory::runInvocation().
|
inline |
Definition at line 254 of file CompilerInstance.h.
Referenced by clang::ento::CreateAnalysisConsumer(), clang::ExecuteCompilerInvocation(), and clang::ento::ModelInjector::ModelInjector().
|
inline |
Definition at line 473 of file CompilerInstance.h.
Referenced by createModuleManager(), createSema(), clang::ASTMergeAction::ExecuteAction(), setASTConsumer(), and setASTContext().
|
inline |
Definition at line 450 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), createASTReader(), createModuleManager(), createPCHExternalASTSource(), createSema(), clang::VerifyPCHAction::ExecuteAction(), clang::ASTMergeAction::ExecuteAction(), makeStandaloneDiagnostic(), clang::ento::ModelInjector::ModelInjector(), setASTConsumer(), and setASTContext().
|
inline |
Definition at line 370 of file CompilerInstance.h.
Referenced by createASTContext(), createPreprocessor(), and ExecuteAction().
|
inline |
Definition at line 548 of file CompilerInstance.h.
Referenced by clang::ASTFrontendAction::ExecuteAction().
|
inline |
Definition at line 258 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::RewriteObjCAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), createDiagnostics(), clang::CodeGenAction::ExecuteAction(), and ExecuteAction().
|
inline |
Definition at line 261 of file CompilerInstance.h.
|
inline |
Definition at line 265 of file CompilerInstance.h.
Referenced by createPreprocessor(), and InitializeSourceManager().
|
inline |
Definition at line 268 of file CompilerInstance.h.
|
inline |
Definition at line 346 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), compileModuleImpl(), clang::FrontendAction::EndSourceFile(), clang::ento::ModelInjector::ModelInjector(), and clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
|
inline |
|
inline |
Definition at line 275 of file CompilerInstance.h.
|
inline |
Get the current diagnostics engine.
Definition at line 338 of file CompilerInstance.h.
Referenced by clang::arcmt::CheckAction::BeginInvocation(), clang::arcmt::ModifyAction::BeginInvocation(), clang::arcmt::MigrateSourceAction::BeginInvocation(), clang::arcmt::MigrateAction::BeginInvocation(), clang::FixItRecompile::BeginInvocation(), clang::arcmt::ObjCMigrateAction::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FixItAction::BeginSourceFileAction(), clearOutputFiles(), compileAndLoadModule(), compileModuleImpl(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::RewriteObjCAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::GenerateModuleAction::CreateASTConsumer(), createFileManager(), clang::CreateFrontendBaseAction(), createOutputFile(), createPreprocessor(), createSourceManager(), clang::CodeGenAction::ExecuteAction(), ExecuteAction(), clang::ASTMergeAction::ExecuteAction(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), clang::ExecuteCompilerInvocation(), clang::FrontendAction::getCurrentModule(), getInputBufferForModule(), InitializeSourceManager(), loadModule(), loadModuleFromSource(), prepareToBuildModule(), and clang::FrontendAction::shouldEraseOutputFiles().
|
inline |
Return the current file manager to the caller.
Definition at line 390 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), compileModuleImpl(), clang::arcmt::MigrateSourceAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::arcmt::ObjCMigrateAction::CreateASTConsumer(), clang::FrontendAction::Execute(), clang::DumpModuleInfoAction::ExecuteAction(), clang::ASTMergeAction::ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), getInputBufferForModule(), InitializeSourceManager(), loadGlobalModuleIndex(), clang::ento::ModelInjector::ModelInjector(), prepareToBuildModule(), and clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
|
inline |
Definition at line 279 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), createFileManager(), clang::ASTMergeAction::ExecuteAction(), and clang::cross_tu::CrossTranslationUnitContext::loadExternalAST().
|
inline |
Definition at line 282 of file CompilerInstance.h.
|
inline |
Definition at line 286 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FixItAction::BeginSourceFileAction(), compileModuleImpl(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::ento::CreateAnalysisConsumer(), clang::arcmt::MigrateSourceAction::CreateASTConsumer(), clang::ASTPrintAction::CreateASTConsumer(), clang::ASTDumpAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), clang::GenerateModuleAction::CreateASTConsumer(), clang::createChainedIncludesSource(), createCodeCompletionConsumer(), createDefaultOutputFile(), clang::CreateFrontendAction(), clang::CreateFrontendBaseAction(), createModuleManager(), clang::GeneratePCHAction::CreateOutputFile(), createPCHExternalASTSource(), createPreprocessor(), clang::FrontendAction::EndSourceFile(), clang::DumpModuleInfoAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), ExecuteAction(), clang::ASTFrontendAction::ExecuteAction(), clang::ExecuteCompilerInvocation(), clang::FrontendAction::getCurrentModule(), InitializeSourceManager(), prepareToBuildModule(), and shouldBuildGlobalModuleIndex().
|
inline |
Definition at line 289 of file CompilerInstance.h.
|
inline |
Definition at line 564 of file CompilerInstance.h.
References Filename, Line, and clang::Preamble.
Referenced by clang::FrontendAction::Execute().
|
inline |
Definition at line 293 of file CompilerInstance.h.
Referenced by clang::DumpModuleInfoAction::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), collectVFSEntries(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::CodeGenAction::CreateASTConsumer(), createModuleManager(), createPCHExternalASTSource(), createPreprocessor(), clang::CodeGenAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), ExecuteAction(), and getSpecificModuleCachePath().
|
inline |
Definition at line 296 of file CompilerInstance.h.
|
inline |
Definition at line 299 of file CompilerInstance.h.
Referenced by createPreprocessor().
|
inline |
Definition at line 233 of file CompilerInstance.h.
Referenced by clang::arcmt::CheckAction::BeginInvocation(), clang::arcmt::ModifyAction::BeginInvocation(), clang::arcmt::MigrateAction::BeginInvocation(), compileModuleImpl(), clang::createChainedIncludesSource(), createFileManager(), ExecuteAction(), getSpecificModuleCachePath(), makeStandaloneDiagnostic(), clang::ento::ModelInjector::ModelInjector(), and clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
|
inline |
Definition at line 303 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FixItAction::BeginSourceFileAction(), clang::GeneratePCHAction::BeginSourceFileAction(), compileModuleImpl(), clang::RewriteObjCAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), clang::GenerateModuleAction::CreateASTConsumer(), createASTContext(), createPreprocessor(), clang::FrontendAction::EndSourceFile(), clang::CodeGenAction::ExecuteAction(), ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), clang::ExecuteCompilerInvocation(), clang::FrontendAction::getCurrentModule(), getInputBufferForModule(), InterfaceStubFunctionsConsumer::HandleTranslationUnit(), loadModule(), prepareToBuildModule(), and ReadOriginalFileName().
|
inline |
Definition at line 306 of file CompilerInstance.h.
|
inline |
Definition at line 799 of file CompilerInstance.h.
Referenced by compileModuleImpl(), clang::GeneratePCHAction::CreateASTConsumer(), clang::GenerateModuleAction::CreateASTConsumer(), createASTReader(), createModuleManager(), createPCHExternalASTSource(), clang::VerifyPCHAction::ExecuteAction(), and clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
std::shared_ptr< ModuleDependencyCollector > CompilerInstance::getModuleDepCollector | ( | ) | const |
Definition at line 139 of file CompilerInstance.cpp.
Referenced by compileModuleImpl().
IntrusiveRefCntPtr< ASTReader > CompilerInstance::getModuleManager | ( | ) | const |
|
inline |
Definition at line 510 of file CompilerInstance.h.
Referenced by clang::arcmt::CheckAction::BeginInvocation(), clang::arcmt::ModifyAction::BeginInvocation(), clang::arcmt::MigrateAction::BeginInvocation(), compileModuleImpl(), clang::createChainedIncludesSource(), clang::cross_tu::CrossTranslationUnitContext::loadExternalAST(), clang::ento::ModelInjector::ModelInjector(), and clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
|
inline |
Return the appropriate PCHContainerReader depending on the current CodeGenOptions.
Definition at line 530 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), createASTReader(), createModuleManager(), createPCHExternalASTSource(), createPreprocessor(), clang::FrontendAction::Execute(), clang::VerifyPCHAction::ExecuteAction(), clang::ASTMergeAction::ExecuteAction(), and loadGlobalModuleIndex().
|
inline |
Return the appropriate PCHContainerWriter depending on the current CodeGenOptions.
Definition at line 516 of file CompilerInstance.h.
Referenced by clang::GeneratePCHAction::CreateASTConsumer(), and clang::GenerateModuleAction::CreateASTConsumer().
|
inline |
Return the current preprocessor.
Definition at line 430 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), compileModuleImpl(), clang::ento::CreateAnalysisConsumer(), clang::HTMLPrintAction::CreateASTConsumer(), clang::arcmt::MigrateSourceAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::arcmt::ObjCMigrateAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), clang::GenerateModuleAction::CreateASTConsumer(), createASTContext(), createASTReader(), createCodeCompletionConsumer(), createModuleManager(), createPCHExternalASTSource(), createSema(), clang::FrontendAction::EndSourceFile(), clang::FrontendAction::Execute(), clang::RewriteMacrosAction::ExecuteAction(), clang::RewriteTestAction::ExecuteAction(), clang::RewriteIncludesAction::ExecuteAction(), clang::DumpModuleInfoAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), clang::DumpRawTokensAction::ExecuteAction(), clang::DumpTokensAction::ExecuteAction(), clang::PreprocessOnlyAction::ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), clang::FrontendAction::getCurrentModule(), clang::arcmt::getFileRemappings(), getInputBufferForModule(), InitializeSourceManager(), loadGlobalModuleIndex(), loadModuleFile(), loadModuleMapForModuleBuild(), prepareToBuildModule(), and ReadOriginalFileName().
|
inline |
Definition at line 310 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), clang::CodeGenAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), clang::createChainedIncludesSource(), createModuleManager(), createPCHExternalASTSource(), createPreprocessor(), clang::VerifyPCHAction::ExecuteAction(), and loadModule().
|
inline |
Definition at line 313 of file CompilerInstance.h.
|
inline |
Definition at line 317 of file CompilerInstance.h.
Referenced by clang::RewriteIncludesAction::BeginSourceFileAction(), clang::CreateFrontendBaseAction(), createPreprocessor(), clang::RewriteIncludesAction::ExecuteAction(), and clang::PrintPreprocessedAction::ExecuteAction().
|
inline |
Definition at line 320 of file CompilerInstance.h.
|
inline |
Definition at line 435 of file CompilerInstance.h.
Referenced by makeStandaloneDiagnostic(), and clang::ento::ModelInjector::ModelInjector().
|
inline |
Definition at line 491 of file CompilerInstance.h.
Referenced by createModuleManager(), clang::TemplightDumpAction::ExecuteAction(), and clang::ASTFrontendAction::ExecuteAction().
|
inline |
Return the current source manager.
Definition at line 410 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FixItAction::BeginSourceFileAction(), compileModuleImpl(), clang::arcmt::MigrateSourceAction::CreateASTConsumer(), clang::arcmt::ObjCMigrateAction::CreateASTConsumer(), createModuleManager(), createPreprocessor(), clang::FrontendAction::EndSourceFile(), clang::CodeGenAction::ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), InitializeSourceManager(), loadModule(), loadModuleMapForModuleBuild(), clang::ento::ModelInjector::ModelInjector(), prepareToBuildModule(), and ReadOriginalFileName().
std::string CompilerInstance::getSpecificModuleCachePath | ( | ) |
Definition at line 461 of file CompilerInstance.cpp.
References clang::HeaderSearchOptions::DisableModuleHash, getHeaderSearchOpts(), getInvocation(), and clang::CompilerInvocation::getModuleHash().
Referenced by clang::FrontendAction::BeginSourceFile(), and createPreprocessor().
|
inline |
Definition at line 358 of file CompilerInstance.h.
Referenced by createASTContext(), createPreprocessor(), clang::CodeGenAction::ExecuteAction(), ExecuteAction(), makeStandaloneDiagnostic(), and prepareToBuildModule().
|
inline |
Definition at line 324 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::CodeGenAction::CreateASTConsumer(), clang::CodeGenAction::ExecuteAction(), and ExecuteAction().
|
inline |
Definition at line 327 of file CompilerInstance.h.
|
inline |
Definition at line 379 of file CompilerInstance.h.
|
inline |
Definition at line 785 of file CompilerInstance.h.
Referenced by makeStandaloneDiagnostic().
|
inline |
Definition at line 471 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), and createModuleManager().
|
inline |
Definition at line 448 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), createModuleManager(), and makeStandaloneDiagnostic().
|
inline |
Definition at line 546 of file CompilerInstance.h.
Referenced by clang::ASTFrontendAction::ExecuteAction(), and clang::FrontendAction::getCurrentModule().
|
inline |
Definition at line 335 of file CompilerInstance.h.
Referenced by ExecuteAction(), and clang::tooling::FrontendActionFactory::runInvocation().
|
inline |
Definition at line 387 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::Execute(), and loadGlobalModuleIndex().
|
inline |
Definition at line 562 of file CompilerInstance.h.
Referenced by clang::FrontendAction::Execute().
|
inline |
Definition at line 231 of file CompilerInstance.h.
Referenced by makeStandaloneDiagnostic().
|
inline |
Definition at line 427 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile(), clang::FrontendAction::Execute(), clang::ASTFrontendAction::ExecuteAction(), InitializeSourceManager(), loadGlobalModuleIndex(), and makeStandaloneDiagnostic().
|
inline |
Definition at line 489 of file CompilerInstance.h.
Referenced by createModuleManager(), and clang::ASTFrontendAction::ExecuteAction().
|
inline |
Definition at line 407 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile().
|
inline |
Definition at line 356 of file CompilerInstance.h.
Referenced by ExecuteAction(), and makeStandaloneDiagnostic().
bool CompilerInstance::InitializeSourceManager | ( | const FrontendInputFile & | Input | ) |
InitializeSourceManager - Initialize the source manager to set InputFile as the main file.
Definition at line 803 of file CompilerInstance.cpp.
References getDependencyOutputOpts(), getDiagnostics(), getFileManager(), getFrontendOpts(), getPreprocessor(), getSourceManager(), and hasPreprocessor().
Referenced by clang::FrontendAction::BeginSourceFile().
|
static |
InitializeSourceManager - Initialize the source manager to set InputFile as the main file.
Definition at line 811 of file CompilerInstance.cpp.
References clang::SrcMgr::C_System, clang::SrcMgr::C_System_ModuleMap, clang::SrcMgr::C_User, clang::SrcMgr::C_User_ModuleMap, clang::SourceManager::createFileID(), clang::FrontendInputFile::getBuffer(), clang::FileManager::getBufferForFile(), clang::FileManager::getFile(), clang::FrontendInputFile::getFile(), clang::InputKind::getFormat(), clang::FrontendInputFile::getKind(), clang::SourceManager::getMainFileID(), clang::FileManager::getVirtualFile(), clang::FrontendInputFile::isBuffer(), clang::FileEntry::isNamedPipe(), clang::FrontendInputFile::isSystem(), clang::FileID::isValid(), clang::InputKind::ModuleMap, clang::SourceManager::overrideFileContents(), clang::DiagnosticsEngine::Report(), clang::SourceManager::setMainFileID(), and clang::SourceManager::Unowned.
|
overridevirtual |
Load, create, or return global module.
This function returns an existing global module index, if one had already been loaded or created, or loads one if it exists, or creates one if it doesn't exist. Also, importantly, if the index doesn't cover all the modules in the module map, it will be update to do so here, because of its use in searching for needed module imports and associated fixit messages.
TriggerLoc | The location for what triggered the load. |
Implements clang::ModuleLoader.
Definition at line 2030 of file CompilerInstance.cpp.
References clang::ModuleLoader::buildingModule(), createModuleManager(), clang::Module::DefinitionLoc, clang::Error, clang::Module::getASTFile(), getFileManager(), clang::Preprocessor::getHeaderSearchInfo(), clang::HeaderSearch::getModuleMap(), getPCHContainerReader(), getPreprocessor(), hasFileManager(), hasPreprocessor(), clang::Module::Hidden, loadModule(), clang::ModuleMap::module_begin(), clang::ModuleMap::module_end(), clang::Module::Name, shouldBuildGlobalModuleIndex(), and clang::GlobalModuleIndex::writeIndex().
|
overridevirtual |
Attempt to load the given module.
This routine attempts to load the module described by the given parameters.
ImportLoc | The location of the 'import' keyword. |
Path | The identifiers (and their locations) of the module "path", e.g., "std.vector" would be split into "std" and "vector". |
Visibility | The visibility provided for the names in the loaded module. |
IsInclusionDirective | Indicates that this module is being loaded implicitly, due to the presence of an inclusion directive. Otherwise, it is being loaded due to an import declaration. |
FIXME: perhaps we should (a) look for a module using the module name
Implements clang::ModuleLoader.
Definition at line 1595 of file CompilerInstance.cpp.
References clang::ASTReader::ARR_ConfigurationMismatch, clang::ASTReader::ARR_Missing, clang::ASTReader::ARR_OutOfDate, compileAndLoadModule(), clang::ModuleLoadResult::ConfigMismatch, clang::ASTReader::ConfigurationMismatch, createModuleManager(), clang::LangOptions::CurrentModule, clang::PreprocessorOptions::FailedModules, clang::ASTReader::Failure, clang::Module::getASTFile(), getDiagnostics(), getLangOpts(), clang::SourceManager::getModuleBuildStack(), getPreprocessorOpts(), getSourceManager(), clang::ASTReader::HadErrors, clang::ModuleLoader::HadFatalFailure, clang::Module::HasIncompatibleModuleFile, clang::SourceLocation::isValid(), clang::ASTReader::Missing, clang::serialization::MK_ExplicitModule, clang::serialization::MK_ImplicitModule, clang::serialization::MK_PrebuiltModule, clang::ASTReader::OutOfDate, clang::HeaderSearchOptions::PrebuiltModuleFiles, clang::HeaderSearchOptions::PrebuiltModulePaths, clang::DiagnosticsEngine::Report(), clang::ASTReader::Success, and clang::ASTReader::VersionMismatch.
Referenced by loadGlobalModuleIndex().
bool CompilerInstance::loadModuleFile | ( | StringRef | FileName | ) |
Definition at line 1498 of file CompilerInstance.cpp.
References clang::ModuleMap::findModule(), clang::Preprocessor::getHeaderSearchInfo(), clang::Preprocessor::getIdentifierInfo(), clang::HeaderSearch::getModuleMap(), getPreprocessor(), and clang::Module::HasIncompatibleModuleFile.
Referenced by clang::FrontendAction::BeginSourceFile().
|
overridevirtual |
Attempt to load the given module from the specified source buffer.
Does not make any submodule visible; for that, use loadModule or makeModuleVisible.
Loc | The location at which the module was loaded. |
ModuleName | The name of the module to build. |
Source | The source of the module: a (preprocessed) module map. |
Implements clang::ModuleLoader.
Definition at line 1966 of file CompilerInstance.cpp.
References clang::C, compileModuleImpl(), getDiagnostics(), getLanguageFromOptions(), clang::isAlphanumeric(), clang::InputKind::ModuleMap, and clang::DiagnosticsEngine::Report().
|
overridevirtual |
Check global module index for missing imports.
Name | The symbol name to look for. |
TriggerLoc | The location for what triggered the load. |
Implements clang::ModuleLoader.
Definition at line 2100 of file CompilerInstance.cpp.
|
overridevirtual |
Make the given module visible.
Implements clang::ModuleLoader.
Definition at line 2019 of file CompilerInstance.cpp.
References createModuleManager().
|
inline |
Definition at line 455 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
|
inline |
Definition at line 395 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
|
inline |
Definition at line 437 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
void CompilerInstance::resetAndLeakSema | ( | ) |
Definition at line 2123 of file CompilerInstance.cpp.
References takeSema().
Referenced by clang::FrontendAction::EndSourceFile().
|
inline |
Definition at line 415 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
void CompilerInstance::setASTConsumer | ( | std::unique_ptr< ASTConsumer > | Value | ) |
setASTConsumer - Replace the current AST consumer; the compiler instance takes ownership of Value
.
Definition at line 114 of file CompilerInstance.cpp.
References getASTConsumer(), getASTContext(), and clang::ASTConsumer::Initialize().
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().
void CompilerInstance::setASTContext | ( | ASTContext * | Value | ) |
setASTContext - Replace the current AST context.
Definition at line 103 of file CompilerInstance.cpp.
References getASTConsumer(), getASTContext(), and clang::ASTConsumer::Initialize().
Referenced by clang::FrontendAction::BeginSourceFile(), createASTContext(), and clang::FrontendAction::EndSourceFile().
void CompilerInstance::setAuxTarget | ( | TargetInfo * | Value | ) |
Replace the current AuxTarget.
Definition at line 89 of file CompilerInstance.cpp.
Referenced by ExecuteAction().
|
inline |
Set the flag indicating whether we should (re)build the global module index.
Definition at line 246 of file CompilerInstance.h.
Referenced by compileModuleImpl().
void CompilerInstance::setCodeCompletionConsumer | ( | CodeCompleteConsumer * | Value | ) |
setCodeCompletionConsumer - Replace the current code completion consumer; the compiler instance takes ownership of Value
.
Definition at line 121 of file CompilerInstance.cpp.
Referenced by createCodeCompletionConsumer().
void CompilerInstance::setDiagnostics | ( | DiagnosticsEngine * | Value | ) |
setDiagnostics - Replace the current diagnostics engine.
Definition at line 84 of file CompilerInstance.cpp.
void CompilerInstance::setExternalSemaSource | ( | IntrusiveRefCntPtr< ExternalSemaSource > | ESS | ) |
Definition at line 2125 of file CompilerInstance.cpp.
void CompilerInstance::setFileManager | ( | FileManager * | Value | ) |
Replace the current file manager and virtual file system.
Definition at line 91 of file CompilerInstance.cpp.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::EndSourceFile(), makeStandaloneDiagnostic(), and clang::tooling::FrontendActionFactory::runInvocation().
void CompilerInstance::setInvocation | ( | std::shared_ptr< CompilerInvocation > | Value | ) |
setInvocation - Replace the current invocation.
Definition at line 72 of file CompilerInstance.cpp.
Referenced by clang::ento::ModelInjector::ModelInjector(), clang::tooling::FrontendActionFactory::runInvocation(), and clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
void CompilerInstance::setModuleDepCollector | ( | std::shared_ptr< ModuleDependencyCollector > | Collector | ) |
Definition at line 143 of file CompilerInstance.cpp.
void CompilerInstance::setModuleManager | ( | IntrusiveRefCntPtr< ASTReader > | Reader | ) |
Definition at line 132 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::BeginSourceFile().
|
inline |
}
Definition at line 762 of file CompilerInstance.h.
void CompilerInstance::setPreprocessor | ( | std::shared_ptr< Preprocessor > | Value | ) |
Replace the current preprocessor.
Definition at line 99 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().
void CompilerInstance::setSema | ( | Sema * | S | ) |
Replace the current Sema; the compiler instance takes ownership of S.
Definition at line 110 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::EndSourceFile().
void CompilerInstance::setSourceManager | ( | SourceManager * | Value | ) |
setSourceManager - Replace the current source manager.
Definition at line 95 of file CompilerInstance.cpp.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::EndSourceFile(), and makeStandaloneDiagnostic().
void CompilerInstance::setTarget | ( | TargetInfo * | Value | ) |
Replace the current Target.
Definition at line 88 of file CompilerInstance.cpp.
Referenced by ExecuteAction().
bool CompilerInstance::shouldBuildGlobalModuleIndex | ( | ) | const |
Indicates whether we should (re)build the global module index.
Definition at line 77 of file CompilerInstance.cpp.
References clang::FrontendOptions::GenerateGlobalModuleIndex, and getFrontendOpts().
Referenced by clang::FrontendAction::Execute(), and loadGlobalModuleIndex().
|
inline |
takeASTConsumer - Remove the current AST consumer and give ownership to the caller.
Definition at line 480 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile(), and makeStandaloneDiagnostic().
|
inline |
Definition at line 766 of file CompilerInstance.h.
Referenced by clang::CodeGenAction::CreateASTConsumer().
std::unique_ptr< Sema > CompilerInstance::takeSema | ( | ) |
Definition at line 125 of file CompilerInstance.cpp.
Referenced by makeStandaloneDiagnostic(), and resetAndLeakSema().