clang 17.0.0git
|
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. | |
void | LoadRequestedPlugins () |
Load the list of plugins requested in the FrontendOptions . | |
Compiler Invocation and Options | |
} { | |
bool | hasInvocation () const |
CompilerInvocation & | getInvocation () |
void | setInvocation (std::shared_ptr< CompilerInvocation > Value) |
setInvocation - Replace the current invocation. | |
bool | shouldBuildGlobalModuleIndex () const |
Indicates whether we should (re)build the global module index. | |
void | setBuildGlobalModuleIndex (bool Build) |
Set the flag indicating whether we should (re)build the global module index. | |
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. | |
void | setDiagnostics (DiagnosticsEngine *Value) |
setDiagnostics - Replace the current diagnostics engine. | |
DiagnosticConsumer & | getDiagnosticClient () const |
VerboseOutputStream | |
} } | |
void | setVerboseOutputStream (raw_ostream &Value) |
Replace the current stream for verbose output. | |
void | setVerboseOutputStream (std::unique_ptr< raw_ostream > Value) |
Replace the current stream for verbose output. | |
raw_ostream & | getVerboseOutputStream () |
Get the current stream for verbose output. | |
Target Info | |
} { | |
bool | hasTarget () const |
TargetInfo & | getTarget () const |
void | setTarget (TargetInfo *Value) |
Replace the current Target. | |
AuxTarget Info | |
} { | |
TargetInfo * | getAuxTarget () const |
void | setAuxTarget (TargetInfo *Value) |
Replace the current AuxTarget. | |
bool | createTarget () |
Virtual File System | |
} { | |
llvm::vfs::FileSystem & | getVirtualFileSystem () const |
File Manager | |
} { | |
bool | hasFileManager () const |
FileManager & | getFileManager () const |
Return the current file manager to the caller. | |
void | resetAndLeakFileManager () |
void | setFileManager (FileManager *Value) |
Replace the current file manager and virtual file system. | |
Source Manager | |
} { | |
bool | hasSourceManager () const |
SourceManager & | getSourceManager () const |
Return the current source manager. | |
void | resetAndLeakSourceManager () |
void | setSourceManager (SourceManager *Value) |
setSourceManager - Replace the current source manager. | |
Preprocessor | |
} { | |
bool | hasPreprocessor () const |
Preprocessor & | getPreprocessor () const |
Return the current preprocessor. | |
std::shared_ptr< Preprocessor > | getPreprocessorPtr () |
void | resetAndLeakPreprocessor () |
void | setPreprocessor (std::shared_ptr< Preprocessor > Value) |
Replace the current preprocessor. | |
ASTContext | |
} { | |
bool | hasASTContext () const |
ASTContext & | getASTContext () const |
void | resetAndLeakASTContext () |
void | setASTContext (ASTContext *Value) |
setASTContext - Replace the current AST context. | |
void | setSema (Sema *S) |
Replace the current Sema; the compiler instance takes ownership of S. | |
ASTConsumer | |
} { | |
bool | hasASTConsumer () const |
ASTConsumer & | getASTConsumer () const |
std::unique_ptr< ASTConsumer > | takeASTConsumer () |
takeASTConsumer - Remove the current AST consumer and give ownership to the caller. | |
void | setASTConsumer (std::unique_ptr< ASTConsumer > Value) |
setASTConsumer - Replace the current AST consumer; the compiler instance takes ownership of Value . | |
Semantic analysis | |
} { | |
bool | hasSema () const |
Sema & | getSema () const |
std::unique_ptr< Sema > | takeSema () |
void | resetAndLeakSema () |
Module Management | |
} { | |
IntrusiveRefCntPtr< ASTReader > | getASTReader () const |
void | setASTReader (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. | |
const PCHContainerReader & | getPCHContainerReader () const |
Return the appropriate PCHContainerReader depending on the current CodeGenOptions. | |
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 . | |
Frontend timer | |
} { | |
bool | hasFrontendTimer () const |
llvm::Timer & | getFrontendTimer () const |
Output Files | |
} { | |
void | clearOutputFiles (bool EraseFiles) |
clearOutputFiles - Clear the output file list. | |
![]() | |
ModuleLoader (bool BuildingModule=false) | |
virtual | ~ModuleLoader () |
bool | buildingModule () const |
Returns true if this instance is building a module. | |
void | setBuildingModule (bool BuildingModuleFlag) |
Flag indicating whether this instance is building a module. | |
virtual ModuleLoadResult | loadModule (SourceLocation ImportLoc, ModuleIdPath Path, Module::NameVisibilityKind Visibility, bool IsInclusionDirective)=0 |
Attempt to load the given module. | |
virtual void | createModuleFromSource (SourceLocation Loc, StringRef ModuleName, StringRef Source)=0 |
Attempt to create the given module from the specified source buffer. | |
virtual void | makeModuleVisible (Module *Mod, Module::NameVisibilityKind Visibility, SourceLocation ImportLoc)=0 |
Make the given module visible. | |
virtual GlobalModuleIndex * | loadGlobalModuleIndex (SourceLocation TriggerLoc)=0 |
Load, create, or return global module. | |
virtual bool | lookupMissingImports (StringRef Name, SourceLocation TriggerLoc)=0 |
Check global module index for missing imports. | |
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. | |
FileManager * | createFileManager (IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS=nullptr) |
Create the file manager and replace any existing one with it. | |
void | createSourceManager (FileManager &FileMgr) |
Create the source manager and replace any existing one with it. | |
void | createPreprocessor (TranslationUnitKind TUKind) |
Create the preprocessor, using the invocation, file, and source managers, and replace any existing one with it. | |
std::string | getSpecificModuleCachePath (StringRef ModuleHash) |
std::string | getSpecificModuleCachePath () |
void | createASTContext () |
Create the AST context. | |
void | createPCHExternalASTSource (StringRef Path, DisableValidationForModuleKind DisableValidation, bool AllowPCHWithCompilerErrors, void *DeserializationListener, bool OwnDeserializationListener) |
Create an external AST source to read a PCH file and attach it to the AST context. | |
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. | |
void | createSema (TranslationUnitKind TUKind, CodeCompleteConsumer *CompletionConsumer) |
Create the Sema object to be used for parsing. | |
void | createFrontendTimer () |
Create the frontend timer and replace any existing one with it. | |
std::unique_ptr< raw_pwrite_stream > | createDefaultOutputFile (bool Binary=true, StringRef BaseInput="", StringRef Extension="", bool RemoveFileOnSignal=true, bool CreateMissingDirectories=false, bool ForceUseTemporary=false) |
Create the default output file (from the invocation's options) and add it to the list of tracked output files. | |
std::unique_ptr< raw_pwrite_stream > | createOutputFile (StringRef OutputPath, bool Binary, bool RemoveFileOnSignal, bool UseTemporary, bool CreateMissingDirectories=false) |
Create a new output file, optionally deriving the output path name, and add it to the list of tracked output files. | |
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. | |
static IntrusiveRefCntPtr< ASTReader > | createPCHExternalASTSource (StringRef Path, StringRef Sysroot, DisableValidationForModuleKind DisableValidation, 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. | |
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 . | |
Initialization Utility Methods | |
} { | |
bool | InitializeSourceManager (const FrontendInputFile &Input) |
InitializeSourceManager - Initialize the source manager to set InputFile as the main file. | |
void | setOutputStream (std::unique_ptr< llvm::raw_pwrite_stream > OutStream) |
} | |
std::unique_ptr< llvm::raw_pwrite_stream > | takeOutputStream () |
void | createASTReader () |
bool | loadModuleFile (StringRef FileName) |
ModuleLoadResult | loadModule (SourceLocation ImportLoc, ModuleIdPath Path, Module::NameVisibilityKind Visibility, bool IsInclusionDirective) override |
Attempt to load the given module. | |
void | createModuleFromSource (SourceLocation ImportLoc, StringRef ModuleName, StringRef Source) override |
Attempt to create the given module from the specified source buffer. | |
void | makeModuleVisible (Module *Mod, Module::NameVisibilityKind Visibility, SourceLocation ImportLoc) override |
Make the given module visible. | |
bool | hadModuleLoaderFatalFailure () const |
GlobalModuleIndex * | loadGlobalModuleIndex (SourceLocation TriggerLoc) override |
Load, create, or return global module. | |
bool | lookupMissingImports (StringRef Name, SourceLocation TriggerLoc) override |
Check global module index for missing imports. | |
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) |
InitializeSourceManager - Initialize the source manager to set InputFile as the main file. | |
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 73 of file CompilerInstance.h.
|
explicit |
Definition at line 64 of file CompilerInstance.cpp.
|
override |
Definition at line 73 of file CompilerInstance.cpp.
|
inline |
Definition at line 813 of file CompilerInstance.h.
Referenced by createPreprocessor().
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 766 of file CompilerInstance.cpp.
References getDiagnostics(), hasASTConsumer(), and clang::DiagnosticsEngine::Report().
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().
void CompilerInstance::createASTContext | ( | ) |
Create the AST context.
Definition at line 559 of file CompilerInstance.cpp.
References getAuxTarget(), clang::Preprocessor::getBuiltinInfo(), clang::Preprocessor::getIdentifierTable(), getLangOpts(), getPreprocessor(), clang::Preprocessor::getSelectorTable(), clang::Preprocessor::getSourceManager(), getTarget(), setASTContext(), and clang::Preprocessor::TUKind.
Referenced by clang::FrontendAction::BeginSourceFile(), and createASTReader().
void CompilerInstance::createASTReader | ( | ) |
Definition at line 1658 of file CompilerInstance.cpp.
References clang::FrontendOptions::AllowPCMWithCompilerErrors, createASTContext(), clang::PreprocessorOptions::DisablePCHOrModuleValidation, getASTConsumer(), getASTContext(), getFrontendOpts(), getHeaderSearchOpts(), getModuleCache(), getPCHContainerReader(), getPreprocessor(), getPreprocessorOpts(), getSema(), getSourceManager(), hasASTConsumer(), hasASTContext(), hasSema(), clang::HeaderSearchOptions::ModulesValidateSystemHeaders, pruneModuleCache(), clang::ASTContext::setASTMutationListener(), clang::ASTContext::setExternalSource(), clang::HeaderSearchOptions::Sysroot, and clang::HeaderSearchOptions::ValidateASTInputFilesContent.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::RewriteIncludesAction::BeginSourceFileAction(), loadGlobalModuleIndex(), loadModuleFile(), and makeModuleVisible().
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 717 of file CompilerInstance.cpp.
References clang::FrontendOptions::CodeCompletionAt, clang::ParsedSourceLocation::Column, createCodeCompletionConsumer(), EnableCodeCompletion(), clang::ParsedSourceLocation::FileName, getFrontendOpts(), getPreprocessor(), clang::ParsedSourceLocation::Line, and setCodeCompletionConsumer().
Referenced by createCodeCompletionConsumer(), clang::ASTFrontendAction::ExecuteAction(), and clang::IncrementalAction::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 740 of file CompilerInstance.cpp.
References EnableCodeCompletion(), Filename, and OS.
std::unique_ptr< raw_pwrite_stream > CompilerInstance::createDefaultOutputFile | ( | bool | Binary = true , |
StringRef | BaseInput = "" , |
||
StringRef | Extension = "" , |
||
bool | RemoveFileOnSignal = true , |
||
bool | CreateMissingDirectories = false , |
||
bool | ForceUseTemporary = false |
||
) |
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 are usually removed on signal, and, depending on FrontendOptions, may also use a temporary file (that is, the data is written to a temporary file which will atomically replace the target output on success).
Definition at line 804 of file CompilerInstance.cpp.
References createOutputFile(), getFrontendOpts(), and clang::FrontendOptions::OutputFile.
Referenced by clang::RewriteIncludesAction::BeginSourceFileAction(), clang::ASTPrintAction::CreateASTConsumer(), clang::HTMLPrintAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateOutputFile(), clang::PrintPreprocessedAction::ExecuteAction(), clang::RewriteMacrosAction::ExecuteAction(), clang::RewriteTestAction::ExecuteAction(), and GetOutputStream().
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 335 of file CompilerInstance.cpp.
References createDiagnostics(), getCodeGenOpts(), and getDiagnosticOpts().
Referenced by clang::tooling::dependencies::DependencyScanningWorker::computeDependencies(), createDiagnostics(), clang::createInvocation(), main(), clang::tooling::ToolInvocation::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 342 of file CompilerInstance.cpp.
References clang::DiagnosticOptions::DiagnosticLogFile, clang::DiagnosticOptions::DiagnosticSerializationFile, clang::ProcessWarningOptions(), clang::DiagnosticOptions::SARIF, 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 379 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 731 of file CompilerInstance.cpp.
Referenced by ExecuteAction().
|
overridevirtual |
Attempt to create the given module from the specified source buffer.
Does not load the module or make any submodule visible; for that, use loadModule and makeModuleVisible.
Loc | The location at which to create the module. |
ModuleName | The name of the module to create. |
Source | The source of the module: a (preprocessed) module map. |
Implements clang::ModuleLoader.
Definition at line 2140 of file CompilerInstance.cpp.
References clang::C, compileModuleImpl(), getDiagnostics(), getLanguageFromOptions(), clang::isAlphanumeric(), clang::InputKind::ModuleMap, and clang::DiagnosticsEngine::Report().
std::unique_ptr< raw_pwrite_stream > CompilerInstance::createNullOutputFile | ( | ) |
Definition at line 824 of file CompilerInstance.cpp.
Referenced by GetOutputStream().
std::unique_ptr< raw_pwrite_stream > CompilerInstance::createOutputFile | ( | StringRef | OutputPath, |
bool | Binary, | ||
bool | RemoveFileOnSignal, | ||
bool | UseTemporary, | ||
bool | CreateMissingDirectories = false |
||
) |
Create a new output file, optionally deriving the output path name, and add it to the list of tracked output files.
Definition at line 829 of file CompilerInstance.cpp.
References getDiagnostics(), OS, and clang::DiagnosticsEngine::Report().
Referenced by createDefaultOutputFile().
void CompilerInstance::createPCHExternalASTSource | ( | StringRef | Path, |
DisableValidationForModuleKind | DisableValidation, | ||
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 618 of file CompilerInstance.cpp.
References createPCHExternalASTSource(), getASTContext(), getFrontendOpts(), getHeaderSearchOpts(), getModuleCache(), getPCHContainerReader(), getPreprocessor(), getPreprocessorOpts(), clang::Preamble, and clang::PreprocessorOptions::PrecompiledPreambleBytes.
Referenced by clang::FrontendAction::BeginSourceFile(), and createPCHExternalASTSource().
|
static |
Create an external AST source to read a PCH file.
Definition at line 632 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::Preamble, clang::ASTContext::setExternalSource(), clang::Preprocessor::setPredefines(), clang::ASTReader::Success, clang::HeaderSearchOptions::ValidateASTInputFilesContent, 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 454 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(), getInvocation(), getLangOpts(), clang::CompilerInvocation::getModuleHash(), getPCHContainerReader(), getPreprocessorOpts(), getPreprocessorOutputOpts(), getSourceManager(), getSpecificModuleCachePath(), getTarget(), clang::DependencyOutputOptions::HeaderIncludeOutputFile, InitializeFileRemapping(), clang::InitializePreprocessor(), clang::DependencyOutputOptions::ModuleDependencyOutputDir, clang::None, clang::DependencyOutputOptions::OutputFile, clang::DependencyOutputOptions::ShowHeaderIncludes, and clang::DependencyOutputOptions::ShowIncludesDest.
Referenced by clang::FrontendAction::BeginSourceFile().
void CompilerInstance::createSema | ( | TranslationUnitKind | TUKind, |
CodeCompleteConsumer * | CompletionConsumer | ||
) |
Create the Sema object to be used for parsing.
Definition at line 753 of file CompilerInstance.cpp.
References getASTConsumer(), getASTContext(), and getPreprocessor().
Referenced by clang::ASTFrontendAction::ExecuteAction(), and clang::IncrementalAction::ExecuteAction().
void CompilerInstance::createSourceManager | ( | FileManager & | FileMgr | ) |
Create the source manager and replace any existing one with it.
Definition at line 392 of file CompilerInstance.cpp.
References getDiagnostics().
Referenced by clang::FrontendAction::BeginSourceFile(), main(), and clang::tooling::FrontendActionFactory::runInvocation().
bool CompilerInstance::createTarget | ( | ) |
Definition at line 106 of file CompilerInstance.cpp.
References clang::TargetInfo::adjust(), clang::TargetInfo::adjustTargetOptions(), clang::FrontendOptions::AuxTargetCPU, clang::FrontendOptions::AuxTargetFeatures, clang::TargetInfo::CreateTargetInfo(), clang::CUDA, clang::LangOptions::FPE_Default, clang::LangOptions::FPE_Ignore, getAuxTarget(), getCodeGenOpts(), getDiagnostics(), getFrontendOpts(), getInvocation(), getLangOpts(), getTarget(), getTargetOpts(), clang::TargetInfo::getTriple(), hasTarget(), clang::OpenCL, clang::DiagnosticsEngine::Report(), clang::TargetInfo::setAuxTarget(), setAuxTarget(), and setTarget().
Referenced by ExecuteAction().
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 1002 of file CompilerInstance.cpp.
References clang::FrontendAction::BeginSourceFile(), clang::SourceManager::clearIDTables(), clang::TargetOptions::CPU, createFrontendTimer(), createTarget(), clang::FrontendAction::EndSourceFile(), clang::FrontendAction::Execute(), clang::DiagnosticConsumer::finish(), clang::DiagnosticsEngine::getClient(), getCodeGenOpts(), getDiagnosticClient(), getDiagnosticOpts(), getDiagnostics(), getFileManager(), getFrontendOpts(), getHeaderSearchOpts(), getLangOpts(), clang::DiagnosticConsumer::getNumErrors(), clang::DiagnosticConsumer::getNumWarnings(), getSourceManager(), getTarget(), getTargetOpts(), getVerboseOutputStream(), hasDiagnostics(), hasFileManager(), hasSourceManager(), clang::FrontendAction::isModelParsingAction(), clang::TargetInfo::noSignedCharForObjCBool(), clang::noteBottomOfStack(), OS, clang::FrontendAction::PrepareToExecute(), clang::FileManager::PrintStats(), clang::DiagnosticsEngine::Report(), clang::frontend::RewriteObjC, and clang::FrontendOptions::StatsFile.
Referenced by clang::ExecuteCompilerInvocation(), main(), and clang::tooling::FrontendActionFactory::runInvocation().
|
inline |
Definition at line 252 of file CompilerInstance.h.
Referenced by clang::ento::CreateAnalysisConsumer(), and clang::ExecuteCompilerInvocation().
|
inline |
Definition at line 487 of file CompilerInstance.h.
Referenced by createASTReader(), createSema(), clang::ASTMergeAction::ExecuteAction(), setASTConsumer(), and setASTContext().
|
inline |
Definition at line 464 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::ExtractAPIAction::CreateASTConsumer(), createASTReader(), createASTReader(), createPCHExternalASTSource(), createSema(), clang::VerifyPCHAction::ExecuteAction(), clang::ASTMergeAction::ExecuteAction(), setASTConsumer(), and setASTContext().
IntrusiveRefCntPtr< ASTReader > CompilerInstance::getASTReader | ( | ) | const |
Definition at line 204 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::RewriteIncludesAction::BeginSourceFileAction(), readASTAfterCompileModule(), and clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
|
inline |
Definition at line 383 of file CompilerInstance.h.
Referenced by createASTContext(), createPreprocessor(), and createTarget().
|
inline |
Definition at line 562 of file CompilerInstance.h.
Referenced by clang::ASTFrontendAction::ExecuteAction(), and clang::IncrementalAction::ExecuteAction().
|
inline |
Definition at line 256 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::CodeGenAction::CreateASTConsumer(), createDiagnostics(), createTarget(), clang::CodeGenAction::ExecuteAction(), and ExecuteAction().
|
inline |
Definition at line 259 of file CompilerInstance.h.
|
inline |
Definition at line 263 of file CompilerInstance.h.
Referenced by createPreprocessor().
|
inline |
Definition at line 266 of file CompilerInstance.h.
|
inline |
Definition at line 344 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::EndSourceFile(), ExecuteAction(), and clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
|
inline |
Definition at line 270 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::createChainedIncludesSource(), createDiagnostics(), clang::ASTMergeAction::ExecuteAction(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), ExecuteAction(), and main().
|
inline |
Definition at line 273 of file CompilerInstance.h.
|
inline |
Get the current diagnostics engine.
Definition at line 336 of file CompilerInstance.h.
Referenced by clang::arcmt::CheckAction::BeginInvocation(), clang::arcmt::ModifyAction::BeginInvocation(), clang::arcmt::MigrateSourceAction::BeginInvocation(), clang::arcmt::MigrateAction::BeginInvocation(), clang::arcmt::ObjCMigrateAction::BeginInvocation(), clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FixItAction::BeginSourceFileAction(), clearOutputFiles(), compileModuleAndReadASTBehindLock(), compileModuleAndReadASTImpl(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::CodeGenAction::CreateASTConsumer(), createFileManager(), clang::CreateFrontendBaseAction(), createModuleFromSource(), createOutputFile(), createPreprocessor(), createSourceManager(), createTarget(), clang::CodeGenAction::ExecuteAction(), clang::ASTMergeAction::ExecuteAction(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), ExecuteAction(), clang::ExecuteCompilerInvocation(), getInputBufferForModule(), InitializeSourceManager(), loadModule(), loadModuleFile(), LoadRequestedPlugins(), prepareToBuildModule(), readASTAfterCompileModule(), and clang::FrontendAction::shouldEraseOutputFiles().
|
inline |
Return the current file manager to the caller.
Definition at line 404 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), compileModule(), clang::arcmt::MigrateSourceAction::CreateASTConsumer(), clang::arcmt::ObjCMigrateAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::ExtractAPIAction::CreateASTConsumer(), clang::FrontendAction::Execute(), clang::CodeGenAction::ExecuteAction(), clang::DumpModuleInfoAction::ExecuteAction(), clang::ASTMergeAction::ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), ExecuteAction(), getInputBufferForModule(), getVirtualFileSystem(), InitializeSourceManager(), loadGlobalModuleIndex(), loadModuleMapForModuleBuild(), makeAbsoluteAndPreferred(), prepareToBuildModule(), and clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
|
inline |
Definition at line 277 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), createFileManager(), and clang::ASTMergeAction::ExecuteAction().
|
inline |
Definition at line 280 of file CompilerInstance.h.
|
inline |
Definition at line 284 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FixItAction::BeginSourceFileAction(), compileModule(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::ento::CreateAnalysisConsumer(), clang::arcmt::MigrateSourceAction::CreateASTConsumer(), clang::ExtractAPIAction::CreateASTConsumer(), clang::ASTPrintAction::CreateASTConsumer(), clang::ASTDumpAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), clang::GenerateModuleAction::CreateASTConsumer(), createASTReader(), clang::createChainedIncludesSource(), createCodeCompletionConsumer(), createDefaultOutputFile(), clang::CreateFrontendAction(), clang::CreateFrontendBaseAction(), clang::GeneratePCHAction::CreateOutputFile(), createPCHExternalASTSource(), createPreprocessor(), createTarget(), clang::FrontendAction::EndSourceFile(), clang::ASTFrontendAction::ExecuteAction(), clang::DumpModuleInfoAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), clang::IncrementalAction::ExecuteAction(), ExecuteAction(), clang::ExecuteCompilerInvocation(), clang::IncrementalAction::IncrementalAction(), LoadRequestedPlugins(), prepareToBuildModule(), shouldBuildGlobalModuleIndex(), and clang::GenerateModuleAction::shouldEraseOutputFiles().
|
inline |
Definition at line 287 of file CompilerInstance.h.
|
inline |
Definition at line 578 of file CompilerInstance.h.
Referenced by clang::FrontendAction::Execute().
|
inline |
Definition at line 291 of file CompilerInstance.h.
Referenced by clang::DumpModuleInfoAction::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), collectVFSEntries(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::CodeGenAction::CreateASTConsumer(), createASTReader(), createPCHExternalASTSource(), createPreprocessor(), clang::CodeGenAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), ExecuteAction(), getPCHContainerReader(), getPCHContainerWriter(), and getSpecificModuleCachePath().
|
inline |
Definition at line 294 of file CompilerInstance.h.
|
inline |
Definition at line 297 of file CompilerInstance.h.
Referenced by createPreprocessor().
|
inline |
Definition at line 231 of file CompilerInstance.h.
Referenced by clang::arcmt::CheckAction::BeginInvocation(), clang::arcmt::ModifyAction::BeginInvocation(), clang::arcmt::MigrateAction::BeginInvocation(), compileModuleAndReadAST(), clang::createChainedIncludesSource(), createFileManager(), createPreprocessor(), createTarget(), getSpecificModuleCachePath(), clang::tooling::dependencies::ModuleDepCollectorPP::LexedFileChanged(), and clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
|
inline |
Definition at line 301 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::GeneratePCHAction::BeginSourceFileAction(), clang::FixItAction::BeginSourceFileAction(), compileModule(), clang::CodeGenAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), createASTContext(), createPreprocessor(), createTarget(), clang::FrontendAction::EndSourceFile(), clang::CodeGenAction::ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), ExecuteAction(), clang::FrontendAction::getCurrentModule(), getInputBufferForModule(), loadModule(), loadModuleMapForModuleBuild(), prepareToBuildModule(), and ReadOriginalFileName().
|
inline |
Definition at line 304 of file CompilerInstance.h.
|
inline |
Definition at line 819 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), clang::GeneratePCHAction::CreateASTConsumer(), clang::GenerateModuleAction::CreateASTConsumer(), createASTReader(), createASTReader(), createPCHExternalASTSource(), clang::DumpModuleInfoAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), and clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
std::shared_ptr< ModuleDependencyCollector > CompilerInstance::getModuleDepCollector | ( | ) | const |
Definition at line 214 of file CompilerInstance.cpp.
|
inline |
Definition at line 524 of file CompilerInstance.h.
Referenced by clang::arcmt::CheckAction::BeginInvocation(), clang::arcmt::ModifyAction::BeginInvocation(), clang::arcmt::MigrateAction::BeginInvocation(), clang::createChainedIncludesSource(), and clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
|
inline |
Return the appropriate PCHContainerReader depending on the current CodeGenOptions.
Definition at line 544 of file CompilerInstance.h.
References getHeaderSearchOpts(), and clang::HeaderSearchOptions::ModuleFormat.
Referenced by clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), createASTReader(), createASTReader(), createPCHExternalASTSource(), createPreprocessor(), clang::FrontendAction::Execute(), clang::DumpModuleInfoAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), clang::ASTMergeAction::ExecuteAction(), and loadGlobalModuleIndex().
|
inline |
Return the appropriate PCHContainerWriter depending on the current CodeGenOptions.
Definition at line 530 of file CompilerInstance.h.
References getHeaderSearchOpts(), and clang::HeaderSearchOptions::ModuleFormat.
Referenced by clang::GeneratePCHAction::CreateASTConsumer(), and clang::GenerateModuleAction::CreateASTConsumer().
|
inline |
Return the current preprocessor.
Definition at line 444 of file CompilerInstance.h.
Referenced by clang::tooling::dependencies::ModuleDepCollector::applyDiscoveredDependencies(), clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), compileModule(), clang::ento::CreateAnalysisConsumer(), clang::arcmt::MigrateSourceAction::CreateASTConsumer(), clang::arcmt::ObjCMigrateAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::ExtractAPIAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), clang::GenerateModuleAction::CreateASTConsumer(), clang::HTMLPrintAction::CreateASTConsumer(), createASTContext(), createASTReader(), createASTReader(), createCodeCompletionConsumer(), createPCHExternalASTSource(), createSema(), clang::tooling::dependencies::ModuleDepCollectorPP::EndOfMainFile(), clang::FrontendAction::EndSourceFile(), clang::FrontendAction::Execute(), clang::DumpModuleInfoAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), clang::DumpRawTokensAction::ExecuteAction(), clang::DumpTokensAction::ExecuteAction(), clang::PreprocessOnlyAction::ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), clang::RewriteMacrosAction::ExecuteAction(), clang::RewriteTestAction::ExecuteAction(), clang::RewriteIncludesAction::ExecuteAction(), clang::IncrementalAction::ExecuteAction(), clang::FrontendAction::getCurrentModule(), getInputBufferForModule(), loadGlobalModuleIndex(), loadModule(), loadModuleMapForModuleBuild(), clang::tooling::dependencies::ModuleDepCollectorPP::moduleImport(), prepareToBuildModule(), and ReadOriginalFileName().
|
inline |
Definition at line 308 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), clang::CodeGenAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), createASTReader(), clang::createChainedIncludesSource(), createPCHExternalASTSource(), createPreprocessor(), clang::tooling::dependencies::ModuleDepCollectorPP::EndOfMainFile(), clang::CodeGenAction::ExecuteAction(), and clang::VerifyPCHAction::ExecuteAction().
|
inline |
Definition at line 311 of file CompilerInstance.h.
|
inline |
Definition at line 315 of file CompilerInstance.h.
Referenced by clang::RewriteIncludesAction::BeginSourceFileAction(), clang::CreateFrontendBaseAction(), createPreprocessor(), clang::PrintPreprocessedAction::ExecuteAction(), and clang::RewriteIncludesAction::ExecuteAction().
|
inline |
Definition at line 318 of file CompilerInstance.h.
|
inline |
Definition at line 449 of file CompilerInstance.h.
|
inline |
Definition at line 505 of file CompilerInstance.h.
Referenced by createASTReader(), clang::ASTFrontendAction::ExecuteAction(), and clang::TemplightDumpAction::ExecuteAction().
|
inline |
Return the current source manager.
Definition at line 424 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FixItAction::BeginSourceFileAction(), clang::arcmt::MigrateSourceAction::CreateASTConsumer(), clang::arcmt::ObjCMigrateAction::CreateASTConsumer(), clang::ExtractAPIAction::CreateASTConsumer(), createASTReader(), createPreprocessor(), clang::tooling::dependencies::ModuleDepCollectorPP::EndOfMainFile(), clang::FrontendAction::EndSourceFile(), clang::CodeGenAction::ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), ExecuteAction(), InitializeSourceManager(), clang::tooling::dependencies::ModuleDepCollectorPP::LexedFileChanged(), loadModuleMapForModuleBuild(), prepareToBuildModule(), and ReadOriginalFileName().
|
inline |
Definition at line 650 of file CompilerInstance.h.
References getInvocation(), and getSpecificModuleCachePath().
Referenced by createPreprocessor(), and getSpecificModuleCachePath().
std::string CompilerInstance::getSpecificModuleCachePath | ( | StringRef | ModuleHash | ) |
Definition at line 549 of file CompilerInstance.cpp.
References getHeaderSearchOpts().
Referenced by clang::FrontendAction::BeginSourceFile().
|
inline |
Definition at line 371 of file CompilerInstance.h.
References clang::Target.
Referenced by clang::ExtractAPIAction::CreateASTConsumer(), createASTContext(), createPreprocessor(), createTarget(), clang::CodeGenAction::ExecuteAction(), ExecuteAction(), loadModule(), and prepareToBuildModule().
|
inline |
Definition at line 322 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::CodeGenAction::CreateASTConsumer(), createTarget(), clang::CodeGenAction::ExecuteAction(), and ExecuteAction().
|
inline |
Definition at line 325 of file CompilerInstance.h.
|
inline |
Get the current stream for verbose output.
Definition at line 361 of file CompilerInstance.h.
Referenced by ExecuteAction().
llvm::vfs::FileSystem & CompilerInstance::getVirtualFileSystem | ( | ) | const |
Definition at line 162 of file CompilerInstance.cpp.
References getFileManager(), and clang::FileManager::getVirtualFileSystem().
Referenced by clang::CodeGenAction::CreateASTConsumer(), and clang::CodeGenAction::ExecuteAction().
|
inline |
Definition at line 805 of file CompilerInstance.h.
References clang::ModuleLoader::HadFatalFailure.
|
inline |
Definition at line 485 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clearOutputFiles(), and createASTReader().
|
inline |
Definition at line 462 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), and createASTReader().
|
inline |
Definition at line 560 of file CompilerInstance.h.
Referenced by clang::ASTFrontendAction::ExecuteAction(), and clang::IncrementalAction::ExecuteAction().
|
inline |
Definition at line 333 of file CompilerInstance.h.
Referenced by ExecuteAction(), main(), and clang::tooling::FrontendActionFactory::runInvocation().
|
inline |
Definition at line 401 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::Execute(), ExecuteAction(), and loadGlobalModuleIndex().
|
inline |
Definition at line 576 of file CompilerInstance.h.
Referenced by clang::FrontendAction::Execute().
|
inline |
Definition at line 229 of file CompilerInstance.h.
|
inline |
Definition at line 441 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::EndSourceFile(), clang::FrontendAction::Execute(), clang::ASTFrontendAction::ExecuteAction(), clang::IncrementalAction::ExecuteAction(), and loadGlobalModuleIndex().
|
inline |
Definition at line 503 of file CompilerInstance.h.
Referenced by createASTReader(), clang::ASTFrontendAction::ExecuteAction(), and clang::IncrementalAction::ExecuteAction().
|
inline |
Definition at line 421 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), and ExecuteAction().
|
inline |
Definition at line 369 of file CompilerInstance.h.
References clang::Target.
Referenced by createTarget().
bool CompilerInstance::InitializeSourceManager | ( | const FrontendInputFile & | Input | ) |
InitializeSourceManager - Initialize the source manager to set InputFile as the main file.
Definition at line 954 of file CompilerInstance.cpp.
References getDiagnostics(), getFileManager(), getSourceManager(), and InitializeSourceManager().
Referenced by clang::FrontendAction::BeginSourceFile(), and InitializeSourceManager().
|
static |
InitializeSourceManager - Initialize the source manager to set InputFile as the main file.
Definition at line 960 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::FrontendInputFile::getFile(), clang::FileManager::getFileRef(), clang::InputKind::getFormat(), clang::FrontendInputFile::getKind(), clang::SourceManager::getMainFileID(), clang::FileManager::getSTDIN(), clang::FrontendInputFile::isBuffer(), clang::FrontendInputFile::isSystem(), clang::FileID::isValid(), clang::InputKind::ModuleMap, clang::DiagnosticsEngine::Report(), and clang::SourceManager::setMainFileID().
|
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 2203 of file CompilerInstance.cpp.
References clang::ModuleLoader::buildingModule(), createASTReader(), clang::Module::DefinitionLoc, 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().
Referenced by lookupMissingImports().
|
overridevirtual |
Attempt to load the given module.
This routine attempts to load the module described by the given parameters. If there is a module cache, this may implicitly compile the module before loading it.
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. |
Implements clang::ModuleLoader.
Definition at line 1961 of file CompilerInstance.cpp.
References clang::ModuleMap::cacheModuleLoad(), checkConfigMacro(), clang::Preprocessor::checkModuleIsAvailable(), clang::Module::ConfigMacros, clang::FixItHint::CreateReplacement(), clang::Module::findSubmodule(), clang::IdentifierTable::get(), clang::ModuleMap::getCachedModuleLoad(), getDiagnostics(), clang::Module::getFullModuleName(), clang::Preprocessor::getHeaderSearchInfo(), clang::Preprocessor::getIdentifierInfo(), clang::Preprocessor::getIdentifierTable(), getLangOpts(), clang::HeaderSearch::getModuleMap(), getPreprocessor(), getTarget(), clang::IdentifierInfo::getTokenID(), clang::Module::getTopLevelModule(), clang::Module::IsFromModuleFile, clang::SourceLocation::isValid(), loadModule(), clang::HeaderSearch::lookupModule(), clang::Preprocessor::markClangModuleAsAffecting(), clang::ModuleLoadResult::MissingExpected, clang::Module::Name, clang::DiagnosticsEngine::Report(), clang::ModuleMap::resolveLinkAsDependencies(), clang::Result, and clang::Module::submodules().
Referenced by loadGlobalModuleIndex(), and loadModule().
bool CompilerInstance::loadModuleFile | ( | StringRef | FileName | ) |
Definition at line 1709 of file CompilerInstance.cpp.
References clang::ASTReader::ARR_ConfigurationMismatch, clang::ASTReader::ConfigurationMismatch, createASTReader(), clang::DiagnosticsEngine::getDiagnosticLevel(), getDiagnostics(), clang::serialization::MK_ExplicitModule, clang::DiagnosticsEngine::Report(), clang::ASTReader::Success, and clang::DiagnosticsEngine::Warning.
Referenced by clang::FrontendAction::BeginSourceFile().
void CompilerInstance::LoadRequestedPlugins | ( | ) |
Load the list of plugins requested in the FrontendOptions
.
Definition at line 1106 of file CompilerInstance.cpp.
References clang::FrontendOptions::ActionName, getDiagnostics(), getFrontendOpts(), P, clang::frontend::PluginAction, clang::FrontendOptions::ProgramAction, clang::PluginASTAction::ReplaceAction, and clang::DiagnosticsEngine::Report().
Referenced by clang::ExecuteCompilerInvocation().
|
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 2273 of file CompilerInstance.cpp.
References clang::ModuleLoader::buildingModule(), loadGlobalModuleIndex(), and clang::GlobalModuleIndex::lookupIdentifier().
|
overridevirtual |
Make the given module visible.
Implements clang::ModuleLoader.
Definition at line 2192 of file CompilerInstance.cpp.
References createASTReader().
|
inline |
Definition at line 469 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
|
inline |
Definition at line 409 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
|
inline |
Definition at line 451 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
void CompilerInstance::resetAndLeakSema | ( | ) |
Definition at line 2296 of file CompilerInstance.cpp.
References takeSema().
Referenced by clang::FrontendAction::EndSourceFile().
|
inline |
Definition at line 429 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 189 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 178 of file CompilerInstance.cpp.
References getASTConsumer(), getASTContext(), and clang::ASTConsumer::Initialize().
Referenced by clang::FrontendAction::BeginSourceFile(), createASTContext(), and clang::FrontendAction::EndSourceFile().
void CompilerInstance::setASTReader | ( | IntrusiveRefCntPtr< ASTReader > | Reader | ) |
Definition at line 207 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::BeginSourceFile().
void CompilerInstance::setAuxTarget | ( | TargetInfo * | Value | ) |
Replace the current AuxTarget.
Definition at line 104 of file CompilerInstance.cpp.
Referenced by createTarget().
|
inline |
Set the flag indicating whether we should (re)build the global module index.
Definition at line 244 of file CompilerInstance.h.
Referenced by compileModule().
void CompilerInstance::setCodeCompletionConsumer | ( | CodeCompleteConsumer * | Value | ) |
setCodeCompletionConsumer - Replace the current code completion consumer; the compiler instance takes ownership of Value
.
Definition at line 196 of file CompilerInstance.cpp.
Referenced by createCodeCompletionConsumer().
void CompilerInstance::setDiagnostics | ( | DiagnosticsEngine * | Value | ) |
setDiagnostics - Replace the current diagnostics engine.
Definition at line 89 of file CompilerInstance.cpp.
void CompilerInstance::setExternalSemaSource | ( | IntrusiveRefCntPtr< ExternalSemaSource > | ESS | ) |
Definition at line 2298 of file CompilerInstance.cpp.
void CompilerInstance::setFileManager | ( | FileManager * | Value | ) |
Replace the current file manager and virtual file system.
Definition at line 166 of file CompilerInstance.cpp.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::EndSourceFile(), main(), and clang::tooling::FrontendActionFactory::runInvocation().
void CompilerInstance::setInvocation | ( | std::shared_ptr< CompilerInvocation > | Value | ) |
setInvocation - Replace the current invocation.
Definition at line 77 of file CompilerInstance.cpp.
Referenced by main(), and clang::tooling::FrontendActionFactory::runInvocation().
void CompilerInstance::setModuleDepCollector | ( | std::shared_ptr< ModuleDependencyCollector > | Collector | ) |
Definition at line 218 of file CompilerInstance.cpp.
|
inline |
}
Definition at line 765 of file CompilerInstance.h.
void CompilerInstance::setPreprocessor | ( | std::shared_ptr< Preprocessor > | Value | ) |
Replace the current preprocessor.
Definition at line 174 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 185 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::EndSourceFile().
void CompilerInstance::setSourceManager | ( | SourceManager * | Value | ) |
setSourceManager - Replace the current source manager.
Definition at line 170 of file CompilerInstance.cpp.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().
void CompilerInstance::setTarget | ( | TargetInfo * | Value | ) |
Replace the current Target.
Definition at line 103 of file CompilerInstance.cpp.
Referenced by createTarget().
void CompilerInstance::setVerboseOutputStream | ( | raw_ostream & | Value | ) |
Replace the current stream for verbose output.
Definition at line 93 of file CompilerInstance.cpp.
void CompilerInstance::setVerboseOutputStream | ( | std::unique_ptr< raw_ostream > | Value | ) |
Replace the current stream for verbose output.
Definition at line 98 of file CompilerInstance.cpp.
bool CompilerInstance::shouldBuildGlobalModuleIndex | ( | ) | const |
Indicates whether we should (re)build the global module index.
Definition at line 82 of file CompilerInstance.cpp.
References getFrontendOpts().
Referenced by clang::FrontendAction::Execute(), and loadGlobalModuleIndex().
|
inline |
takeASTConsumer - Remove the current AST consumer and give ownership to the caller.
Definition at line 494 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
|
inline |
Definition at line 769 of file CompilerInstance.h.
Referenced by clang::CodeGenAction::CreateASTConsumer().
std::unique_ptr< Sema > CompilerInstance::takeSema | ( | ) |
Definition at line 200 of file CompilerInstance.cpp.
Referenced by resetAndLeakSema().