|
clang 22.0.0git
|
CompilerInstance - Helper class for managing a single instance of the Clang compiler. More...
#include "clang/Frontend/CompilerInstance.h"
Classes | |
| class | ThreadSafeCloneConfig |
Configuration object for making the result of cloneForModuleCompile() thread-safe. More... | |
Public Member Functions | |
| CompilerInstance (std::shared_ptr< CompilerInvocation > Invocation=std::make_shared< CompilerInvocation >(), std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >(), std::shared_ptr< ModuleCache > ModCache=nullptr) | |
| ~CompilerInstance () override | |
| void | setOutputStream (std::unique_ptr< llvm::raw_pwrite_stream > OutStream) |
| std::unique_ptr< llvm::raw_pwrite_stream > | takeOutputStream () |
| void | createASTReader () |
| bool | loadModuleFile (StringRef FileName, serialization::ModuleFile *&LoadedModuleFile) |
| std::unique_ptr< CompilerInstance > | cloneForModuleCompile (SourceLocation ImportLoc, const Module *Module, StringRef ModuleFileName, std::optional< ThreadSafeCloneConfig > ThreadSafeConfig=std::nullopt) |
Creates a new CompilerInstance for compiling a module. | |
| bool | compileModule (SourceLocation ImportLoc, StringRef ModuleName, StringRef ModuleFileName, CompilerInstance &Instance) |
| Compile a module file for the given module, using the options provided by the importing compiler instance. | |
| 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 | clearDependencyCollectors () |
| std::vector< std::shared_ptr< DependencyCollector > > & | getDependencyCollectors () |
| void | setExternalSemaSource (IntrusiveRefCntPtr< ExternalSemaSource > ESS) |
| ModuleCache & | getModuleCache () const |
| std::shared_ptr< ModuleCache > | getModuleCachePtr () const |
High-Level Operations | |
| bool | ExecuteAction (FrontendAction &Act) |
| ExecuteAction - Execute the provided action against the compiler's CompilerInvocation object. | |
| void | printDiagnosticStats () |
| At the end of a compilation, print the number of warnings/errors. | |
| void | LoadRequestedPlugins () |
Load the list of plugins requested in the FrontendOptions. | |
Compiler Invocation and Options | |
| CompilerInvocation & | getInvocation () |
| std::shared_ptr< CompilerInvocation > | getInvocationPtr () |
| 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 | |
| AnalyzerOptions & | 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 |
| APINotesOptions & | getAPINotesOpts () |
| const APINotesOptions & | getAPINotesOpts () 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. | |
| IntrusiveRefCntPtr< DiagnosticsEngine > | getDiagnosticsPtr () const |
| void | setDiagnostics (llvm::IntrusiveRefCntPtr< 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 |
| IntrusiveRefCntPtr< TargetInfo > | getTargetPtr () 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 | |
| bool | hasVirtualFileSystem () const |
| void | createVirtualFileSystem (IntrusiveRefCntPtr< llvm::vfs::FileSystem > BaseFS=llvm::vfs::getRealFileSystem(), DiagnosticConsumer *DC=nullptr) |
| Create a virtual file system instance based on the invocation. | |
| void | setVirtualFileSystem (IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS) |
| Use the given file system. | |
| llvm::vfs::FileSystem & | getVirtualFileSystem () const |
| IntrusiveRefCntPtr< llvm::vfs::FileSystem > | getVirtualFileSystemPtr () const |
File Manager | |
| bool | hasFileManager () const |
| FileManager & | getFileManager () const |
| Return the current file manager to the caller. | |
| IntrusiveRefCntPtr< FileManager > | getFileManagerPtr () const |
| void | resetAndLeakFileManager () |
| void | setFileManager (IntrusiveRefCntPtr< FileManager > Value) |
| Replace the current file manager. | |
Output Manager | |
| void | setOutputManager (IntrusiveRefCntPtr< llvm::vfs::OutputBackend > NewOutputs) |
| Set the output manager. | |
| void | createOutputManager () |
| Create an output manager. | |
| bool | hasOutputManager () const |
| llvm::vfs::OutputBackend & | getOutputManager () |
| llvm::vfs::OutputBackend & | getOrCreateOutputManager () |
Source Manager | |
| bool | hasSourceManager () const |
| SourceManager & | getSourceManager () const |
| Return the current source manager. | |
| IntrusiveRefCntPtr< SourceManager > | getSourceManagerPtr () const |
| void | resetAndLeakSourceManager () |
| void | setSourceManager (llvm::IntrusiveRefCntPtr< 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 |
| IntrusiveRefCntPtr< ASTContext > | getASTContextPtr () const |
| void | resetAndLeakASTContext () |
| void | setASTContext (llvm::IntrusiveRefCntPtr< 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. | |
Back-end Pass Plugins | |
} | |
| llvm::ArrayRef< std::unique_ptr< llvm::PassPlugin > > | getPassPlugins () const |
Frontend timer | |
| llvm::TimerGroup & | getTimerGroup () const |
| llvm::Timer & | getFrontendTimer () const |
Output Files | |
} | |
| void | clearOutputFiles (bool EraseFiles) |
| clearOutputFiles - Clear the output file list. | |
| Public Member Functions inherited from clang::ModuleLoader | |
| 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. | |
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. | |
| void | createFileManager () |
| Create the file manager and replace any existing one with it. | |
| void | createSourceManager () |
| 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. | |
| void | setDependencyDirectivesGetter (std::unique_ptr< DependencyDirectivesGetter > Getter) |
| 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 (llvm::vfs::FileSystem &VFS, DiagnosticOptions &Opts, DiagnosticConsumer *Client=nullptr, bool ShouldOwnClient=true, const CodeGenOptions *CodeGenOpts=nullptr) |
| Create a DiagnosticsEngine object. | |
| static IntrusiveRefCntPtr< ASTReader > | createPCHExternalASTSource (StringRef Path, StringRef Sysroot, DisableValidationForModuleKind DisableValidation, bool AllowPCHWithCompilerErrors, Preprocessor &PP, ModuleCache &ModCache, ASTContext &Context, const PCHContainerReader &PCHContainerRdr, const CodeGenOptions &CodeGenOpts, 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. | |
| 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 | |
| Public Attributes inherited from clang::ModuleLoader | |
| 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 83 of file CompilerInstance.h.
|
explicit |
Definition at line 72 of file CompilerInstance.cpp.
References clang::createCrossProcessModuleCache(), clang::ModuleLoader::ModuleLoader(), and clang::nullptr.
|
override |
Definition at line 84 of file CompilerInstance.cpp.
|
inline |
Definition at line 957 of file CompilerInstance.h.
Referenced by createPreprocessor(), and clang::dependencies::initializeScanInstanceDependencyCollector().
|
inline |
Definition at line 961 of file CompilerInstance.h.
Referenced by clang::dependencies::CompilerInstanceWithContext::computeDependencies().
| 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 781 of file CompilerInstance.cpp.
References hasASTConsumer().
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().
| std::unique_ptr< CompilerInstance > CompilerInstance::cloneForModuleCompile | ( | SourceLocation | ImportLoc, |
| const Module * | Module, | ||
| StringRef | ModuleFileName, | ||
| std::optional< ThreadSafeCloneConfig > | ThreadSafeConfig = std::nullopt ) |
Creates a new CompilerInstance for compiling a module.
This takes care of creating appropriate FrontendInputFile for public/private frameworks, inferred modules and such.
The ThreadSafeConfig takes precedence over the DiagnosticConsumer and FileSystem of this instance (and disables FileManager sharing).
Definition at line 1304 of file CompilerInstance.cpp.
References clang::Module::Directory, clang::ModuleMap::getContainingModuleMapFileID(), clang::SrcMgr::SLocEntry::getFile(), clang::SrcMgr::FileInfo::getFileCharacteristic(), getFileManager(), clang::Preprocessor::getHeaderSearchInfo(), getLangOpts(), getLanguageFromOptions(), clang::HeaderSearch::getModuleMap(), clang::ModuleMap::getModuleMapFileForUniquing(), clang::DirectoryEntryRef::getName(), clang::FileEntryRef::getName(), clang::FileEntryRef::getNameAsRequested(), getPreprocessor(), getPublicModuleMap(), getSourceManager(), clang::Module::getTopLevelModuleName(), clang::Module::IsSystem, clang::FileID::isValid(), clang::SourceLocation::isValid(), clang::InputKind::ModuleMap, and clang::Module::print().
Referenced by compileModuleAndReadASTImpl().
| bool CompilerInstance::compileModule | ( | SourceLocation | ImportLoc, |
| StringRef | ModuleName, | ||
| StringRef | ModuleFileName, | ||
| CompilerInstance & | Instance ) |
Compile a module file for the given module, using the options provided by the importing compiler instance.
Returns true if the module was built without errors.
Definition at line 1233 of file CompilerInstance.cpp.
References clang::FileManager::AddStats(), clang::DesiredStackSize, clang::ASTFrontendAction::ExecuteAction(), getDiagnostics(), getFileManager(), getFrontendOpts(), getModuleCache(), clang::DiagnosticsEngine::Report(), and setBuildGlobalModuleIndex().
Referenced by compileModuleAndReadASTImpl(), and createModuleFromSource().
| void CompilerInstance::createASTContext | ( | ) |
Create the AST context.
Definition at line 563 of file CompilerInstance.cpp.
References getAuxTarget(), getLangOpts(), getPreprocessor(), getTarget(), and setASTContext().
Referenced by clang::FrontendAction::BeginSourceFile(), and createASTReader().
| void CompilerInstance::createASTReader | ( | ) |
Definition at line 1614 of file CompilerInstance.cpp.
References clang::FrontendOptions::AllowPCMWithCompilerErrors, createASTContext(), clang::PreprocessorOptions::DisablePCHOrModuleValidation, getASTConsumer(), getASTContext(), getCodeGenOpts(), getFrontendOpts(), getHeaderSearchOpts(), getModuleCache(), getPCHContainerReader(), getPreprocessor(), getPreprocessorOpts(), getSema(), getSourceManager(), hasASTConsumer(), hasASTContext(), hasSema(), clang::HeaderSearchOptions::ModulesForceValidateUserHeaders, clang::HeaderSearchOptions::ModulesValidateSystemHeaders, 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 723 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(), and 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 743 of file CompilerInstance.cpp.
References clang::Column, EnableCodeCompletion(), and clang::Line.
| 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 810 of file CompilerInstance.cpp.
References clang::Binary, createOutputFile(), getFrontendOpts(), and clang::FrontendOptions::OutputFile.
Referenced by clang::RewriteIncludesAction::BeginSourceFileAction(), clang::ASTPrintAction::CreateASTConsumer(), clang::ExtractAPIAction::CreateASTConsumer(), clang::HTMLPrintAction::CreateASTConsumer(), clang::GenerateModuleInterfaceAction::CreateOutputFile(), clang::GeneratePCHAction::CreateOutputFile(), clang::PrintPreprocessedAction::ExecuteAction(), clang::RewriteMacrosAction::ExecuteAction(), clang::RewriteTestAction::ExecuteAction(), GetOutputStream(), 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 345 of file CompilerInstance.cpp.
References createDiagnostics(), getCodeGenOpts(), getDiagnosticOpts(), and getVirtualFileSystem().
Referenced by createDiagnostics(), clang::createInvocation(), clang::dependencies::DiagnosticsEngineWithDiagOpts::DiagnosticsEngineWithDiagOpts(), clang::dependencies::initializeScanCompilerInstance(), clang::tooling::ToolInvocation::run(), and clang::tooling::FrontendActionFactory::runInvocation().
|
static |
Create a DiagnosticsEngine object.
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.
| VFS | The file system used to load the suppression mappings file. |
| 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. If NULL, the returned DiagnosticsEngine will own a newly-created client. |
| 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 351 of file CompilerInstance.cpp.
References clang::DiagnosticIDs::create(), clang::DiagnosticOptions::DiagnosticLogFile, clang::DiagnosticOptions::DiagnosticSerializationFile, clang::ProcessWarningOptions(), clang::DiagnosticOptions::SARIF, SetUpDiagnosticLog(), and SetupSerializedDiagnostics().
| void CompilerInstance::createFileManager | ( | ) |
Create the file manager and replace any existing one with it.
Definition at line 386 of file CompilerInstance.cpp.
References getFileSystemOpts().
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::dependencies::initializeScanCompilerInstance().
| void CompilerInstance::createFrontendTimer | ( | ) |
Create the frontend timer and replace any existing one with it.
Definition at line 737 of file CompilerInstance.cpp.
|
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 2114 of file CompilerInstance.cpp.
References clang::C, compileModule(), getDiagnostics(), getLanguageFromOptions(), clang::isAlphanumeric(), clang::InputKind::ModuleMap, clang::Other, clang::DiagnosticsEngine::Report(), and clang::Success.
| std::unique_ptr< raw_pwrite_stream > CompilerInstance::createNullOutputFile | ( | ) |
Definition at line 830 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 859 of file CompilerInstance.cpp.
References clang::Binary, getDiagnostics(), and clang::DiagnosticsEngine::Report().
Referenced by createDefaultOutputFile().
| void CompilerInstance::createOutputManager | ( | ) |
Create an output manager.
Definition at line 842 of file CompilerInstance.cpp.
Referenced by createPreprocessor(), and getOrCreateOutputManager().
| 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 622 of file CompilerInstance.cpp.
References createPCHExternalASTSource(), getASTContext(), getCodeGenOpts(), 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 636 of file CompilerInstance.cpp.
References clang::ASTReader::ARR_None, clang::ASTReader::ConfigurationMismatch, clang::ASTReader::Failure, clang::ASTReader::HadErrors, clang::ASTReader::Missing, clang::serialization::MK_PCH, clang::serialization::MK_Preamble, clang::HeaderSearchOptions::ModulesForceValidateUserHeaders, clang::HeaderSearchOptions::ModulesValidateSystemHeaders, clang::ASTReader::OutOfDate, clang::Preamble, 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 447 of file CompilerInstance.cpp.
References addDependencyCollector(), clang::TargetInfo::adjust(), clang::ApplyHeaderSearchOptions(), clang::AttachDependencyGraphGen(), clang::AttachHeaderIncludeGen(), collectHeaderMaps(), collectIncludePCH(), collectVFSEntries(), createOutputManager(), clang::PreprocessorOptions::DetailedRecord, clang::DependencyOutputOptions::DOTOutputFile, getAuxTarget(), getCodeGenOpts(), getDependencyOutputOpts(), getDiagnostics(), getFrontendOpts(), getHeaderSearchOpts(), getInvocation(), getLangOpts(), clang::CompilerInvocation::getModuleHash(), getPCHContainerReader(), getPreprocessorOpts(), getPreprocessorOutputOpts(), getSourceManager(), getSpecificModuleCachePath(), getTarget(), getVirtualFileSystemPtr(), hasOutputManager(), 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 756 of file CompilerInstance.cpp.
References getAPINotesOpts(), getASTConsumer(), getASTContext(), getLangOpts(), and getPreprocessor().
Referenced by clang::ASTFrontendAction::ExecuteAction(), and clang::HLSLFrontendAction::ExecuteAction().
| void CompilerInstance::createSourceManager | ( | ) |
Create the source manager and replace any existing one with it.
Definition at line 393 of file CompilerInstance.cpp.
References getDiagnostics(), and getFileManager().
Referenced by clang::FrontendAction::BeginSourceFile(), clang::dependencies::initializeScanCompilerInstance(), and clang::tooling::FrontendActionFactory::runInvocation().
| bool CompilerInstance::createTarget | ( | ) |
Definition at line 113 of file CompilerInstance.cpp.
References clang::TargetInfo::adjust(), clang::FrontendOptions::AuxTargetCPU, clang::FrontendOptions::AuxTargetFeatures, clang::TargetInfo::CreateTargetInfo(), clang::CUDA, clang::LangOptionsBase::FPE_Default, clang::LangOptionsBase::FPE_Ignore, getAuxTarget(), getDiagnostics(), getFrontendOpts(), getInvocation(), getLangOpts(), getTarget(), getTargetOpts(), clang::TargetInfo::getTriple(), hasTarget(), clang::OpenCL, clang::DiagnosticsEngine::Report(), setAuxTarget(), clang::TargetInfo::setAuxTarget(), and setTarget().
Referenced by ExecuteAction(), and clang::dependencies::CompilerInstanceWithContext::initialize().
| void CompilerInstance::createVirtualFileSystem | ( | IntrusiveRefCntPtr< llvm::vfs::FileSystem > | BaseFS = llvm::vfs::getRealFileSystem(), |
| DiagnosticConsumer * | DC = nullptr ) |
Create a virtual file system instance based on the invocation.
| BaseFS | The file system that may be used when configuring the final file system, and act as the underlying file system. Must not be NULL. |
| DC | If non-NULL, the diagnostic consumer to be used in case configuring the file system emits diagnostics. Note that the DiagnosticsEngine using the consumer won't obey the –warning-suppression-mappings= flag. |
Definition at line 280 of file CompilerInstance.cpp.
References clang::DiagnosticIDs::create(), clang::createVFSFromCompilerInvocation(), getFrontendOpts(), and getInvocation().
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::dependencies::initializeScanCompilerInstance().
| 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 958 of file CompilerInstance.cpp.
References clang::FrontendAction::BeginSourceFile(), clang::SourceManager::clearIDTables(), createTarget(), clang::FrontendAction::EndSourceFile(), clang::FrontendAction::Execute(), clang::DiagnosticConsumer::finish(), clang::DiagnosticsEngine::getClient(), getCodeGenOpts(), getDiagnosticClient(), getDiagnostics(), getFileManager(), getFrontendOpts(), getHeaderSearchOpts(), clang::DiagnosticConsumer::getNumErrors(), getSourceManager(), getTarget(), getVerboseOutputStream(), hasDiagnostics(), hasFileManager(), hasSourceManager(), clang::FrontendAction::isModelParsingAction(), clang::TargetInfo::noSignedCharForObjCBool(), clang::noteBottomOfStack(), clang::FrontendAction::PrepareToExecute(), printDiagnosticStats(), clang::FileManager::PrintStats(), clang::DiagnosticsEngine::Report(), clang::frontend::RewriteObjC, and clang::FrontendOptions::StatsFile.
Referenced by clang::ExecuteCompilerInvocation(), clang::dependencies::DependencyScanningAction::runInvocation(), and clang::tooling::FrontendActionFactory::runInvocation().
|
inline |
Definition at line 270 of file CompilerInstance.h.
Referenced by clang::ento::CreateAnalysisConsumer(), clang::cross_tu::CrossTranslationUnitContext::CrossTranslationUnitContext(), and clang::ExecuteCompilerInvocation().
|
inline |
Definition at line 314 of file CompilerInstance.h.
Referenced by createSema().
|
inline |
Definition at line 315 of file CompilerInstance.h.
|
inline |
Definition at line 566 of file CompilerInstance.h.
Referenced by createASTReader(), createSema(), clang::ASTMergeAction::ExecuteAction(), setASTConsumer(), and setASTContext().
|
inline |
Definition at line 538 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::ExtractAPIAction::CreateASTConsumer(), clang::installapi::InstallAPIAction::CreateASTConsumer(), clang::WrappingExtractAPIAction::CreateASTConsumer(), createASTReader(), createASTReader(), createPCHExternalASTSource(), createSema(), clang::ASTMergeAction::ExecuteAction(), clang::HLSLFrontendAction::ExecuteAction(), clang::IncrementalSyntaxOnlyAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), clang::Interpreter::getASTContext(), clang::Interpreter::getASTContext(), setASTConsumer(), and setASTContext().
|
inline |
Definition at line 543 of file CompilerInstance.h.
| IntrusiveRefCntPtr< ASTReader > CompilerInstance::getASTReader | ( | ) | const |
Definition at line 207 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::RewriteIncludesAction::BeginSourceFileAction(), and readASTAfterCompileModule().
|
inline |
Definition at line 407 of file CompilerInstance.h.
Referenced by createASTContext(), createPreprocessor(), and createTarget().
|
inline |
Definition at line 641 of file CompilerInstance.h.
Referenced by clang::ASTFrontendAction::ExecuteAction().
|
inline |
Definition at line 272 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), cir::CIRGenAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::GenerateModuleInterfaceAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), createASTReader(), createASTReader(), createDiagnostics(), clang::CreateFrontendAction(), clang::GenerateModuleAction::CreateMultiplexConsumer(), createPCHExternalASTSource(), createPreprocessor(), clang::CodeGenAction::ExecuteAction(), ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), initTargetOptions(), LoadRequestedPlugins(), and runThinLTOBackend().
|
inline |
Definition at line 275 of file CompilerInstance.h.
|
inline |
Definition at line 963 of file CompilerInstance.h.
|
inline |
Definition at line 279 of file CompilerInstance.h.
Referenced by createPreprocessor().
|
inline |
Definition at line 282 of file CompilerInstance.h.
|
inline |
Definition at line 363 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::EndSourceFile(), and ExecuteAction().
|
inline |
Definition at line 286 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::createChainedIncludesSource(), createDiagnostics(), clang::ASTMergeAction::ExecuteAction(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), and printDiagnosticStats().
|
inline |
Definition at line 289 of file CompilerInstance.h.
|
inline |
Get the current diagnostics engine.
Definition at line 350 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FixItAction::BeginSourceFileAction(), compileModule(), compileModuleAndReadASTBehindLock(), compileModuleAndReadASTImpl(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::dependencies::computePrebuiltModulesASTMap(), clang::CreateFrontendAction(), clang::CreateFrontendBaseAction(), createModuleFromSource(), createOutputFile(), createPreprocessor(), createSourceManager(), createTarget(), clang::emitBackendOutput(), clang::ASTMergeAction::ExecuteAction(), clang::CodeGenAction::ExecuteAction(), ExecuteAction(), clang::DumpModuleInfoAction::ExecuteAction(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), clang::ExecuteCompilerInvocation(), getInputBufferForModule(), clang::InProcessPrintingASTConsumer::HandleTopLevelDecl(), InitializeSourceManager(), loadModule(), loadModuleFile(), LoadRequestedPlugins(), clang::Interpreter::Parse(), prepareToBuildModule(), clang::GenerateModuleInterfaceAction::PrepareToExecuteAction(), printDiagnosticStats(), readASTAfterCompileModule(), clang::dependencies::DependencyScanningAction::runInvocation(), runThinLTOBackend(), and clang::FrontendAction::shouldEraseOutputFiles().
|
inline |
Definition at line 355 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::ReplCodeCompleter::codeComplete().
|
inline |
Return the current file manager to the caller.
Definition at line 452 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), cloneForModuleCompile(), collectIncludePCH(), compileModule(), clang::ExtractAPIAction::CreateASTConsumer(), clang::WrappingExtractAPIAction::CreateASTConsumer(), createSourceManager(), clang::FrontendAction::Execute(), clang::ASTMergeAction::ExecuteAction(), clang::CodeGenAction::ExecuteAction(), ExecuteAction(), clang::DumpModuleInfoAction::ExecuteAction(), clang::IncrementalSyntaxOnlyAction::ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), getInputBufferForModule(), clang::dependencies::initializeScanCompilerInstance(), InitializeSourceManager(), loadGlobalModuleIndex(), loadModuleMapForModuleBuild(), makeAbsoluteAndPreferred(), and prepareToBuildModule().
|
inline |
Definition at line 457 of file CompilerInstance.h.
|
inline |
Definition at line 293 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), createFileManager(), and clang::ASTMergeAction::ExecuteAction().
|
inline |
Definition at line 296 of file CompilerInstance.h.
|
inline |
Definition at line 300 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::CodeGenAction::BeginSourceFileAction(), clang::FixItAction::BeginSourceFileAction(), clang::ReplCodeCompleter::codeComplete(), compileModule(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::dependencies::CompilerInstanceWithContext::computeDependencies(), clang::ento::CreateAnalysisConsumer(), clang::ASTDumpAction::CreateASTConsumer(), clang::ASTPrintAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::ExtractAPIAction::CreateASTConsumer(), clang::GenerateModuleInterfaceAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), clang::WrappingExtractAPIAction::CreateASTConsumer(), createASTReader(), clang::createChainedIncludesSource(), createCodeCompletionConsumer(), createDefaultOutputFile(), clang::CreateFrontendAction(), clang::CreateFrontendBaseAction(), clang::GenerateModuleAction::CreateMultiplexConsumer(), clang::GeneratePCHAction::CreateOutputFile(), createPCHExternalASTSource(), createPreprocessor(), createTarget(), createVirtualFileSystem(), clang::FrontendAction::EndSourceFile(), clang::ASTFrontendAction::ExecuteAction(), ExecuteAction(), clang::DumpModuleInfoAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), clang::ExecuteCompilerInvocation(), clang::ExtractAPIActionBase::ImplEndSourceFileAction(), LoadRequestedPlugins(), prepareToBuildModule(), clang::GenerateModuleInterfaceAction::PrepareToExecuteAction(), shouldBuildGlobalModuleIndex(), and clang::GenerateModuleAction::shouldEraseOutputFiles().
|
inline |
Definition at line 303 of file CompilerInstance.h.
|
inline |
Definition at line 665 of file CompilerInstance.h.
|
inline |
Definition at line 307 of file CompilerInstance.h.
Referenced by clang::DumpModuleInfoAction::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::dependencies::computePrebuiltModulesASTMap(), createASTReader(), createPCHExternalASTSource(), createPreprocessor(), clang::ASTMergeAction::ExecuteAction(), ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), clang::dependencies::getInitialStableDirs(), getPCHContainerReader(), getPCHContainerWriter(), getSpecificModuleCachePath(), clang::dependencies::initializeScanCompilerInstance(), and initTargetOptions().
|
inline |
Definition at line 310 of file CompilerInstance.h.
|
inline |
Definition at line 253 of file CompilerInstance.h.
Referenced by compileModuleAndReadAST(), clang::createChainedIncludesSource(), createPreprocessor(), createTarget(), createVirtualFileSystem(), and getSpecificModuleCachePath().
|
inline |
Definition at line 255 of file CompilerInstance.h.
Referenced by clang::ReplCodeCompleter::codeComplete().
|
inline |
Definition at line 319 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::CodeGenAction::BeginSourceFileAction(), clang::FixItAction::BeginSourceFileAction(), clang::GenerateModuleInterfaceAction::BeginSourceFileAction(), clang::GeneratePCHAction::BeginSourceFileAction(), cloneForModuleCompile(), clang::ReplCodeCompleter::codeComplete(), clang::GeneratePCHAction::CreateASTConsumer(), clang::installapi::InstallAPIAction::CreateASTConsumer(), createASTContext(), clang::CreateFrontendAction(), createPreprocessor(), createSema(), createTarget(), clang::FrontendAction::EndSourceFile(), clang::HLSLFrontendAction::ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), clang::FrontendAction::getCurrentModule(), getInputBufferForModule(), initTargetOptions(), loadModule(), loadModuleMapForModuleBuild(), prepareToBuildModule(), printDiagnosticStats(), and ReadOriginalFileName().
|
inline |
Definition at line 320 of file CompilerInstance.h.
|
inline |
Definition at line 969 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), compileModule(), compileModuleAndReadASTBehindLock(), compileModuleAndReadASTImpl(), clang::CodeGenAction::CreateASTConsumer(), clang::GenerateModuleInterfaceAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), createASTReader(), createASTReader(), clang::GenerateModuleAction::CreateMultiplexConsumer(), createPCHExternalASTSource(), clang::DumpModuleInfoAction::ExecuteAction(), and clang::VerifyPCHAction::ExecuteAction().
|
inline |
Definition at line 970 of file CompilerInstance.h.
| std::shared_ptr< ModuleDependencyCollector > CompilerInstance::getModuleDepCollector | ( | ) | const |
Definition at line 217 of file CompilerInstance.cpp.
| llvm::vfs::OutputBackend & CompilerInstance::getOrCreateOutputManager | ( | ) |
Definition at line 852 of file CompilerInstance.cpp.
References createOutputManager(), getOutputManager(), and hasOutputManager().
| llvm::vfs::OutputBackend & CompilerInstance::getOutputManager | ( | ) |
Definition at line 847 of file CompilerInstance.cpp.
Referenced by getOrCreateOutputManager().
|
inline |
Definition at line 655 of file CompilerInstance.h.
|
inline |
Definition at line 603 of file CompilerInstance.h.
Referenced by clang::createChainedIncludesSource().
|
inline |
Return the appropriate PCHContainerReader depending on the current CodeGenOptions.
Definition at line 623 of file CompilerInstance.h.
References getHeaderSearchOpts(), and clang::HeaderSearchOptions::ModuleFormat.
Referenced by clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), createASTReader(), createASTReader(), createPCHExternalASTSource(), createPreprocessor(), clang::FrontendAction::Execute(), clang::ASTMergeAction::ExecuteAction(), clang::DumpModuleInfoAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), and loadGlobalModuleIndex().
|
inline |
Return the appropriate PCHContainerWriter depending on the current CodeGenOptions.
Definition at line 609 of file CompilerInstance.h.
References getHeaderSearchOpts(), and clang::HeaderSearchOptions::ModuleFormat.
Referenced by clang::GeneratePCHAction::CreateASTConsumer(), and clang::GenerateModuleAction::CreateMultiplexConsumer().
|
inline |
Return the current preprocessor.
Definition at line 518 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::BeginSourceFileAction(), cloneForModuleCompile(), collectIncludePCH(), compileModuleAndReadASTImpl(), clang::dependencies::CompilerInstanceWithContext::computeDependencies(), clang::ento::CreateAnalysisConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::ExtractAPIAction::CreateASTConsumer(), clang::GenerateModuleInterfaceAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), clang::HTMLPrintAction::CreateASTConsumer(), clang::installapi::InstallAPIAction::CreateASTConsumer(), clang::WrappingExtractAPIAction::CreateASTConsumer(), createASTContext(), createASTReader(), createASTReader(), createCodeCompletionConsumer(), clang::GenerateModuleAction::CreateMultiplexConsumer(), createPCHExternalASTSource(), createSema(), clang::FrontendAction::EndSourceFile(), clang::FrontendAction::EndSourceFileAction(), clang::FrontendAction::Execute(), clang::DumpModuleInfoAction::ExecuteAction(), clang::DumpRawTokensAction::ExecuteAction(), clang::DumpTokensAction::ExecuteAction(), clang::HLSLFrontendAction::ExecuteAction(), clang::PreprocessOnlyAction::ExecuteAction(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), clang::RewriteIncludesAction::ExecuteAction(), clang::RewriteMacrosAction::ExecuteAction(), clang::RewriteTestAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), clang::FrontendAction::getCurrentModule(), getInputBufferForModule(), loadGlobalModuleIndex(), loadModule(), loadModuleMapForModuleBuild(), prepareToBuildModule(), and ReadOriginalFileName().
|
inline |
Definition at line 322 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), clang::dependencies::computePrebuiltModulesASTMap(), clang::GeneratePCHAction::CreateASTConsumer(), createASTReader(), clang::createChainedIncludesSource(), createPCHExternalASTSource(), createPreprocessor(), and clang::VerifyPCHAction::ExecuteAction().
|
inline |
Definition at line 325 of file CompilerInstance.h.
|
inline |
Definition at line 329 of file CompilerInstance.h.
Referenced by clang::RewriteIncludesAction::BeginSourceFileAction(), clang::CreateFrontendBaseAction(), createPreprocessor(), clang::PrintPreprocessedAction::ExecuteAction(), and clang::RewriteIncludesAction::ExecuteAction().
|
inline |
Definition at line 332 of file CompilerInstance.h.
|
inline |
Definition at line 523 of file CompilerInstance.h.
|
inline |
Definition at line 584 of file CompilerInstance.h.
Referenced by createASTReader(), clang::ASTFrontendAction::ExecuteAction(), clang::HLSLFrontendAction::ExecuteAction(), clang::IncrementalAction::ExecuteAction(), and clang::TemplightDumpAction::ExecuteAction().
|
inline |
Return the current source manager.
Definition at line 493 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FixItAction::BeginSourceFileAction(), cloneForModuleCompile(), clang::ExtractAPIAction::CreateASTConsumer(), clang::installapi::InstallAPIAction::CreateASTConsumer(), clang::WrappingExtractAPIAction::CreateASTConsumer(), createASTReader(), createPreprocessor(), clang::FrontendAction::EndSourceFile(), clang::CodeGenAction::ExecuteAction(), ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), InitializeSourceManager(), loadModuleMapForModuleBuild(), prepareToBuildModule(), and ReadOriginalFileName().
|
inline |
Definition at line 498 of file CompilerInstance.h.
Referenced by clang::installapi::InstallAPIAction::CreateASTConsumer().
|
inline |
Definition at line 742 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(), and clang::normalizeModuleCachePath().
Referenced by clang::FrontendAction::BeginSourceFile().
|
inline |
Definition at line 390 of file CompilerInstance.h.
Referenced by clang::ExtractAPIAction::CreateASTConsumer(), clang::WrappingExtractAPIAction::CreateASTConsumer(), createASTContext(), createPreprocessor(), createTarget(), clang::CodeGenAction::ExecuteAction(), ExecuteAction(), loadModule(), prepareToBuildModule(), and printDiagnosticStats().
|
inline |
Definition at line 336 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::Interpreter::CreateExecutor(), createTarget(), clang::CodeGenAction::ExecuteAction(), initTargetOptions(), printDiagnosticStats(), and runThinLTOBackend().
|
inline |
Definition at line 339 of file CompilerInstance.h.
|
inline |
Definition at line 395 of file CompilerInstance.h.
|
inline |
Definition at line 663 of file CompilerInstance.h.
|
inline |
Get the current stream for verbose output.
Definition at line 380 of file CompilerInstance.h.
Referenced by ExecuteAction(), and printDiagnosticStats().
|
inline |
Definition at line 439 of file CompilerInstance.h.
Referenced by collectVFSEntries(), createDiagnostics(), clang::CodeGenAction::ExecuteAction(), clang::ExecuteCompilerInvocation(), initTargetOptions(), and runThinLTOBackend().
|
inline |
Definition at line 441 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::CodeGenAction::CreateASTConsumer(), clang::createChainedIncludesSource(), createPreprocessor(), clang::ASTMergeAction::ExecuteAction(), clang::CodeGenAction::ExecuteAction(), and setFileManager().
|
inline |
Definition at line 949 of file CompilerInstance.h.
References clang::ModuleLoader::HadFatalFailure.
|
inline |
Definition at line 564 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clearOutputFiles(), and createASTReader().
|
inline |
Definition at line 536 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), createASTReader(), and clang::HLSLFrontendAction::ExecuteAction().
|
inline |
Definition at line 639 of file CompilerInstance.h.
Referenced by clang::ASTFrontendAction::ExecuteAction().
|
inline |
Definition at line 347 of file CompilerInstance.h.
Referenced by ExecuteAction().
|
inline |
Definition at line 449 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::Execute(), ExecuteAction(), and loadGlobalModuleIndex().
|
inline |
Definition at line 481 of file CompilerInstance.h.
References bool.
Referenced by createPreprocessor(), and getOrCreateOutputManager().
|
inline |
|
inline |
Definition at line 582 of file CompilerInstance.h.
Referenced by createASTReader(), clang::ASTFrontendAction::ExecuteAction(), and clang::HLSLFrontendAction::ExecuteAction().
|
inline |
Definition at line 490 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::EndSourceFile(), and ExecuteAction().
|
inline |
Definition at line 388 of file CompilerInstance.h.
Referenced by createTarget().
|
inline |
Definition at line 419 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile().
| bool CompilerInstance::InitializeSourceManager | ( | const FrontendInputFile & | Input | ) |
InitializeSourceManager - Initialize the source manager to set InputFile as the main file.
Definition at line 910 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 916 of file CompilerInstance.cpp.
References clang::SrcMgr::C_System, clang::SrcMgr::C_System_ModuleMap, clang::SrcMgr::C_User, clang::SrcMgr::C_User_ModuleMap, clang::FrontendInputFile::getBuffer(), clang::FrontendInputFile::getFile(), clang::InputKind::getFormat(), clang::FrontendInputFile::getKind(), clang::FrontendInputFile::isBuffer(), clang::FrontendInputFile::isSystem(), clang::InputKind::ModuleMap, and clang::DiagnosticsEngine::Report().
|
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 2177 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 1925 of file CompilerInstance.cpp.
References clang::ModuleMap::cacheModuleLoad(), checkConfigMacros(), clang::Preprocessor::checkModuleIsAvailable(), clang::FixItHint::CreateReplacement(), clang::FileName, clang::Module::findSubmodule(), clang::ModuleMap::getCachedModuleLoad(), getDiagnostics(), clang::Module::getFullModuleName(), clang::Preprocessor::getHeaderSearchInfo(), getLangOpts(), clang::HeaderSearch::getModuleMap(), getPreprocessor(), getTarget(), clang::Module::getTopLevelModule(), clang::Module::IsFromModuleFile, clang::SourceLocation::isValid(), loadModule(), clang::ModuleLoadResult::MissingExpected, clang::Module::Name, clang::DiagnosticsEngine::Report(), clang::ModuleMap::resolveLinkAsDependencies(), clang::Result, selectModuleSource(), and clang::Module::submodules().
Referenced by clang::dependencies::CompilerInstanceWithContext::computeDependencies(), loadGlobalModuleIndex(), and loadModule().
| bool CompilerInstance::loadModuleFile | ( | StringRef | FileName, |
| serialization::ModuleFile *& | LoadedModuleFile ) |
Definition at line 1666 of file CompilerInstance.cpp.
References clang::ASTReader::ARR_ConfigurationMismatch, clang::ASTReader::ConfigurationMismatch, createASTReader(), clang::FileName, 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 1073 of file CompilerInstance.cpp.
References clang::FrontendOptions::ActionName, clang::Error, getCodeGenOpts(), getDiagnostics(), getFrontendOpts(), clang::frontend::PluginAction, clang::FrontendOptions::ProgramAction, clang::PluginASTAction::ReplaceAction, clang::DiagnosticsEngine::Report(), and toString().
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 2247 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 2166 of file CompilerInstance.cpp.
References createASTReader().
| void CompilerInstance::printDiagnosticStats | ( | ) |
At the end of a compilation, print the number of warnings/errors.
Definition at line 1041 of file CompilerInstance.cpp.
References clang::TargetOptions::CPU, clang::CUDA, clang::DiagnosticsEngine::getClient(), getDiagnosticOpts(), getDiagnostics(), getLangOpts(), clang::DiagnosticConsumer::getNumErrors(), clang::DiagnosticConsumer::getNumWarnings(), getTarget(), getTargetOpts(), clang::TargetInfo::getTriple(), and getVerboseOutputStream().
Referenced by ExecuteAction().
|
inline |
Definition at line 548 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
|
inline |
Definition at line 462 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
|
inline |
Definition at line 525 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
| void CompilerInstance::resetAndLeakSema | ( | ) |
Definition at line 2270 of file CompilerInstance.cpp.
References takeSema().
Referenced by clang::FrontendAction::EndSourceFile().
|
inline |
Definition at line 503 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 192 of file CompilerInstance.cpp.
References getASTConsumer(), getASTContext(), and clang::ASTConsumer::Initialize().
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().
| void CompilerInstance::setASTContext | ( | llvm::IntrusiveRefCntPtr< ASTContext > | Value | ) |
setASTContext - Replace the current AST context.
Definition at line 180 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 210 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::BeginSourceFile().
| void CompilerInstance::setAuxTarget | ( | TargetInfo * | Value | ) |
Replace the current AuxTarget.
Definition at line 111 of file CompilerInstance.cpp.
Referenced by createTarget().
|
inline |
Set the flag indicating whether we should (re)build the global module index.
Definition at line 262 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 199 of file CompilerInstance.cpp.
Referenced by createCodeCompletionConsumer().
|
inline |
Definition at line 736 of file CompilerInstance.h.
Referenced by clang::dependencies::initializeScanCompilerInstance().
| void CompilerInstance::setDiagnostics | ( | llvm::IntrusiveRefCntPtr< DiagnosticsEngine > | Value | ) |
setDiagnostics - Replace the current diagnostics engine.
Definition at line 95 of file CompilerInstance.cpp.
| void CompilerInstance::setExternalSemaSource | ( | IntrusiveRefCntPtr< ExternalSemaSource > | ESS | ) |
Definition at line 2272 of file CompilerInstance.cpp.
| void CompilerInstance::setFileManager | ( | IntrusiveRefCntPtr< FileManager > | Value | ) |
Replace the current file manager.
Definition at line 165 of file CompilerInstance.cpp.
References getVirtualFileSystemPtr().
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::EndSourceFile(), and clang::tooling::FrontendActionFactory::runInvocation().
| void CompilerInstance::setModuleDepCollector | ( | std::shared_ptr< ModuleDependencyCollector > | Collector | ) |
Definition at line 221 of file CompilerInstance.cpp.
| void CompilerInstance::setOutputManager | ( | IntrusiveRefCntPtr< llvm::vfs::OutputBackend > | NewOutputs | ) |
Set the output manager.
Definition at line 836 of file CompilerInstance.cpp.
|
inline |
Definition at line 857 of file CompilerInstance.h.
| void CompilerInstance::setPreprocessor | ( | std::shared_ptr< Preprocessor > | Value | ) |
Replace the current preprocessor.
Definition at line 176 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 188 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::EndSourceFile().
| void CompilerInstance::setSourceManager | ( | llvm::IntrusiveRefCntPtr< SourceManager > | Value | ) |
setSourceManager - Replace the current source manager.
Definition at line 171 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 110 of file CompilerInstance.cpp.
Referenced by createTarget().
| void CompilerInstance::setVerboseOutputStream | ( | raw_ostream & | Value | ) |
Replace the current stream for verbose output.
Definition at line 100 of file CompilerInstance.cpp.
| void CompilerInstance::setVerboseOutputStream | ( | std::unique_ptr< raw_ostream > | Value | ) |
Replace the current stream for verbose output.
Definition at line 105 of file CompilerInstance.cpp.
|
inline |
Use the given file system.
Definition at line 435 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::tooling::FrontendActionFactory::runInvocation().
| bool CompilerInstance::shouldBuildGlobalModuleIndex | ( | ) | const |
Indicates whether we should (re)build the global module index.
Definition at line 88 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 573 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
|
inline |
Definition at line 861 of file CompilerInstance.h.
Referenced by cir::CIRGenAction::CreateASTConsumer(), and clang::CodeGenAction::CreateASTConsumer().
| std::unique_ptr< Sema > CompilerInstance::takeSema | ( | ) |
Definition at line 203 of file CompilerInstance.cpp.
Referenced by resetAndLeakSema().