clang: clang::CompilerInstance Class Reference (original) (raw)
CompilerInstance - Helper class for managing a single instance of the Clang compiler. More...
#include "[clang/Frontend/CompilerInstance.h](CompilerInstance%5F8h%5Fsource.html)"
| Public Member Functions | |
|---|---|
| CompilerInstance (std::shared_ptr< CompilerInvocation > Invocation=std::make_shared< CompilerInvocation >(), std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >(), 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, 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 |
| 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. | |
| 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. |
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 82 of file CompilerInstance.h.
◆ ~CompilerInstance()
| CompilerInstance::~CompilerInstance ( ) | override |
|---|
◆ addDependencyCollector()
| void clang::CompilerInstance::addDependencyCollector ( std::shared_ptr< DependencyCollector > Listener) | inline |
|---|
◆ clearDependencyCollectors()
| void clang::CompilerInstance::clearDependencyCollectors ( ) | inline |
|---|
◆ clearOutputFiles()
| void CompilerInstance::clearOutputFiles | ( | bool | EraseFiles | ) |
|---|
◆ cloneForModuleCompile()
Creates a new [CompilerInstance](classclang%5F1%5F1CompilerInstance.html "CompilerInstance - Helper class for managing a single instance of the Clang compiler.") for compiling a module.
This takes care of creating appropriate [FrontendInputFile](classclang%5F1%5F1FrontendInputFile.html "An input file for the front end.") for public/private frameworks, inferred modules and such.
The ThreadSafeConfig takes precedence over the [DiagnosticConsumer](classclang%5F1%5F1DiagnosticConsumer.html "Abstract interface, implemented by clients of the front-end, which formats and prints fully processed...") and FileSystem of this instance (and disables [FileManager](classclang%5F1%5F1FileManager.html "Implements support for file system lookup, file system caching, and directory search management.") sharing).
Definition at line 1291 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().
◆ compileModule()
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 1220 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().
◆ createASTContext()
| void CompilerInstance::createASTContext | ( | ) |
|---|
◆ createASTReader()
| void CompilerInstance::createASTReader | ( | ) |
|---|
Definition at line 1599 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().
◆ createCodeCompletionConsumer() [1/2]
| void CompilerInstance::createCodeCompletionConsumer | ( | ) |
|---|
◆ createCodeCompletionConsumer() [2/2]
◆ createDefaultOutputFile()
| 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).
Returns
- Null on error.
Definition at line 807 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().
◆ createDiagnostics() [1/2]
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.
Parameters
| 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 342 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().
◆ createDiagnostics() [2/2]
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.
Parameters
| 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). |
Returns
The new object on success, or null on failure.
Definition at line 348 of file CompilerInstance.cpp.
References clang::DiagnosticIDs::create(), clang::DiagnosticOptions::DiagnosticLogFile, clang::DiagnosticOptions::DiagnosticSerializationFile, clang::ProcessWarningOptions(), clang::DiagnosticOptions::SARIF, SetUpDiagnosticLog(), and SetupSerializedDiagnostics().
◆ createFileManager()
| void CompilerInstance::createFileManager | ( | ) |
|---|
◆ createFrontendTimer()
| void CompilerInstance::createFrontendTimer | ( | ) |
|---|
Create the frontend timer and replace any existing one with it.
Definition at line 734 of file CompilerInstance.cpp.
◆ createModuleFromSource()
| void CompilerInstance::createModuleFromSource ( SourceLocation Loc, StringRef ModuleName, StringRef Source ) | overridevirtual |
|---|
◆ createNullOutputFile()
| std::unique_ptr< raw_pwrite_stream > CompilerInstance::createNullOutputFile | ( | ) |
|---|
◆ createOutputFile()
| std::unique_ptr< raw_pwrite_stream > CompilerInstance::createOutputFile | ( | StringRef | OutputPath, |
|---|---|---|---|
| bool | Binary, | ||
| bool | RemoveFileOnSignal, | ||
| bool | UseTemporary, | ||
| bool | CreateMissingDirectories = false ) |
◆ createOutputManager()
| void CompilerInstance::createOutputManager | ( | ) |
|---|
◆ createPCHExternalASTSource() [1/2]
| 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 619 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().
◆ createPCHExternalASTSource() [2/2]
| IntrusiveRefCntPtr< ASTReader > CompilerInstance::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 ) | static |
|---|
Create an external AST source to read a PCH file.
Returns
- The new object on success, or null on failure.
Definition at line 633 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.
◆ createPreprocessor()
Create the preprocessor, using the invocation, file, and source managers, and replace any existing one with it.
Definition at line 444 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().
◆ createSema()
◆ createSourceManager()
| void CompilerInstance::createSourceManager | ( | ) |
|---|
◆ createTarget()
| bool CompilerInstance::createTarget | ( | ) |
|---|
Definition at line 110 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().
◆ createVirtualFileSystem()
◆ ExecuteAction()
ExecuteAction - Execute the provided action against the compiler's CompilerInvocation object.
This function makes the following assumptions:
- The invocation options should be initialized. This function does not handle the '-help' or '-version' options, clients should handle those directly.
- The diagnostics engine should have already been created by the client.
- No other CompilerInstance state should have been initialized (this is an unchecked error).
- Clients should have initialized any LLVM target features that may be required.
- Clients should eventually call llvm_shutdown() upon the completion of this routine to ensure that any managed objects are properly destroyed.
Note that this routine may write output to 'stderr'.
Parameters
| Act | - The action to execute. |
|---|
Returns
- True on success.
Definition at line 955 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().
◆ getAnalyzerOpts()
◆ getAPINotesOpts() [1/2]
◆ getAPINotesOpts() [2/2]
| const APINotesOptions & clang::CompilerInstance::getAPINotesOpts ( ) const | inline |
|---|
◆ getASTConsumer()
| ASTConsumer & clang::CompilerInstance::getASTConsumer ( ) const | inline |
|---|
◆ getASTContext()
| ASTContext & clang::CompilerInstance::getASTContext ( ) const | inline |
|---|
Definition at line 534 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().
◆ getASTContextPtr()
◆ getASTReader()
◆ getAuxTarget()
| TargetInfo * clang::CompilerInstance::getAuxTarget ( ) const | inline |
|---|
◆ getCodeCompletionConsumer()
◆ getCodeGenOpts() [1/2]
Definition at line 268 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(), and runThinLTOBackend().
◆ getCodeGenOpts() [2/2]
| const CodeGenOptions & clang::CompilerInstance::getCodeGenOpts ( ) const | inline |
|---|
◆ getDependencyCollectors()
| std::vector< std::shared_ptr< DependencyCollector > > & clang::CompilerInstance::getDependencyCollectors ( ) | inline |
|---|
◆ getDependencyOutputOpts() [1/2]
◆ getDependencyOutputOpts() [2/2]
◆ getDiagnosticClient()
◆ getDiagnosticOpts() [1/2]
◆ getDiagnosticOpts() [2/2]
| const DiagnosticOptions & clang::CompilerInstance::getDiagnosticOpts ( ) const | inline |
|---|
◆ getDiagnostics()
Get the current diagnostics engine.
Definition at line 346 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().
◆ getDiagnosticsPtr()
◆ getFileManager()
| FileManager & clang::CompilerInstance::getFileManager ( ) const | inline |
|---|
Return the current file manager to the caller.
Definition at line 448 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().
◆ getFileManagerPtr()
◆ getFileSystemOpts() [1/2]
◆ getFileSystemOpts() [2/2]
| const FileSystemOptions & clang::CompilerInstance::getFileSystemOpts ( ) const | inline |
|---|
◆ getFrontendOpts() [1/2]
Definition at line 296 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(), clang::dependencies::initializeScanCompilerInstance(), LoadRequestedPlugins(), prepareToBuildModule(), clang::GenerateModuleInterfaceAction::PrepareToExecuteAction(), shouldBuildGlobalModuleIndex(), clang::GenerateModuleAction::shouldEraseOutputFiles(), and clang::dependencies::takeAndUpdateDependencyOutputOptionsFrom().
◆ getFrontendOpts() [2/2]
| const FrontendOptions & clang::CompilerInstance::getFrontendOpts ( ) const | inline |
|---|
◆ getFrontendTimer()
| llvm::Timer & clang::CompilerInstance::getFrontendTimer ( ) const | inline |
|---|
◆ getHeaderSearchOpts() [1/2]
Definition at line 303 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().
◆ getHeaderSearchOpts() [2/2]
◆ getInvocation()
◆ getInvocationPtr()
| std::shared_ptr< CompilerInvocation > clang::CompilerInstance::getInvocationPtr ( ) | inline |
|---|
◆ getLangOpts() [1/2]
| LangOptions & clang::CompilerInstance::getLangOpts ( ) | inline |
|---|
Definition at line 315 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().
◆ getLangOpts() [2/2]
| const LangOptions & clang::CompilerInstance::getLangOpts ( ) const | inline |
|---|
◆ getModuleCache()
| ModuleCache & clang::CompilerInstance::getModuleCache ( ) const | inline |
|---|
Definition at line 957 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().
◆ getModuleDepCollector()
◆ getOrCreateOutputManager()
| llvm::vfs::OutputBackend & CompilerInstance::getOrCreateOutputManager | ( | ) |
|---|
◆ getOutputManager()
| llvm::vfs::OutputBackend & CompilerInstance::getOutputManager | ( | ) |
|---|
◆ getPCHContainerOperations()
◆ getPCHContainerReader()
| const PCHContainerReader & clang::CompilerInstance::getPCHContainerReader ( ) const | inline |
|---|
Return the appropriate PCHContainerReader depending on the current CodeGenOptions.
Definition at line 619 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().
◆ getPCHContainerWriter()
| const PCHContainerWriter & clang::CompilerInstance::getPCHContainerWriter ( ) const | inline |
|---|
◆ getPreprocessor()
| Preprocessor & clang::CompilerInstance::getPreprocessor ( ) const | inline |
|---|
Return the current preprocessor.
Definition at line 514 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().
◆ getPreprocessorOpts() [1/2]
Definition at line 318 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), collectIncludePCH(), clang::dependencies::computePrebuiltModulesASTMap(), clang::GeneratePCHAction::CreateASTConsumer(), createASTReader(), clang::createChainedIncludesSource(), createPCHExternalASTSource(), createPreprocessor(), clang::VerifyPCHAction::ExecuteAction(), and clang::dependencies::initializeScanCompilerInstance().
◆ getPreprocessorOpts() [2/2]
◆ getPreprocessorOutputOpts() [1/2]
◆ getPreprocessorOutputOpts() [2/2]
◆ getPreprocessorPtr()
| std::shared_ptr< Preprocessor > clang::CompilerInstance::getPreprocessorPtr ( ) | inline |
|---|
◆ getSema()
| Sema & clang::CompilerInstance::getSema ( ) const | inline |
|---|
◆ getSourceManager()
| SourceManager & clang::CompilerInstance::getSourceManager ( ) const | inline |
|---|
Return the current source manager.
Definition at line 489 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().
◆ getSourceManagerPtr()
◆ getSpecificModuleCachePath() [1/2]
| std::string clang::CompilerInstance::getSpecificModuleCachePath ( ) | inline |
|---|
◆ getSpecificModuleCachePath() [2/2]
| std::string CompilerInstance::getSpecificModuleCachePath | ( | StringRef | ModuleHash | ) |
|---|
◆ getTarget()
| TargetInfo & clang::CompilerInstance::getTarget ( ) const | inline |
|---|
◆ getTargetOpts() [1/2]
| TargetOptions & clang::CompilerInstance::getTargetOpts ( ) | inline |
|---|
◆ getTargetOpts() [2/2]
| const TargetOptions & clang::CompilerInstance::getTargetOpts ( ) const | inline |
|---|
◆ getTargetPtr()
◆ getTimerGroup()
| llvm::TimerGroup & clang::CompilerInstance::getTimerGroup ( ) const | inline |
|---|
◆ getVerboseOutputStream()
| raw_ostream & clang::CompilerInstance::getVerboseOutputStream ( ) | inline |
|---|
◆ getVirtualFileSystem()
| llvm::vfs::FileSystem & clang::CompilerInstance::getVirtualFileSystem ( ) const | inline |
|---|
◆ getVirtualFileSystemPtr()
| IntrusiveRefCntPtr< llvm::vfs::FileSystem > clang::CompilerInstance::getVirtualFileSystemPtr ( ) const | inline |
|---|
◆ hadModuleLoaderFatalFailure()
| bool clang::CompilerInstance::hadModuleLoaderFatalFailure ( ) const | inline |
|---|
◆ hasASTConsumer()
| bool clang::CompilerInstance::hasASTConsumer ( ) const | inline |
|---|
◆ hasASTContext()
| bool clang::CompilerInstance::hasASTContext ( ) const | inline |
|---|
◆ hasCodeCompletionConsumer()
| bool clang::CompilerInstance::hasCodeCompletionConsumer ( ) const | inline |
|---|
◆ hasDiagnostics()
| bool clang::CompilerInstance::hasDiagnostics ( ) const | inline |
|---|
◆ hasFileManager()
| bool clang::CompilerInstance::hasFileManager ( ) const | inline |
|---|
◆ hasOutputManager()
| bool clang::CompilerInstance::hasOutputManager ( ) const | inline |
|---|
◆ hasPreprocessor()
| bool clang::CompilerInstance::hasPreprocessor ( ) const | inline |
|---|
◆ hasSema()
| bool clang::CompilerInstance::hasSema ( ) const | inline |
|---|
◆ hasSourceManager()
| bool clang::CompilerInstance::hasSourceManager ( ) const | inline |
|---|
◆ hasTarget()
| bool clang::CompilerInstance::hasTarget ( ) const | inline |
|---|
◆ hasVirtualFileSystem()
| bool clang::CompilerInstance::hasVirtualFileSystem ( ) const | inline |
|---|
◆ InitializeSourceManager() [1/2]
◆ InitializeSourceManager() [2/2]
InitializeSourceManager - Initialize the source manager to set InputFile as the main file.
Returns
True on success.
Definition at line 913 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().
◆ loadGlobalModuleIndex()
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.
Parameters
| TriggerLoc | The location for what triggered the load. |
|---|
Returns
Returns null if load failed.
Implements clang::ModuleLoader.
Definition at line 2161 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().
◆ loadModule()
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.
Parameters
| ImportLoc | The location of the 'import' keyword. |
|---|---|
| Path | The identifiers (and their locations) of the module "path", e.g., "std.vector" would be split into "std" and "vector". |
| Visibility | The visibility provided for the names in the loaded module. |
| IsInclusionDirective | Indicates that this module is being loaded implicitly, due to the presence of an inclusion directive. Otherwise, it is being loaded due to an import declaration. |
Returns
If successful, returns the loaded module. Otherwise, returns NULL to indicate that the module could not be loaded.
Implements clang::ModuleLoader.
Definition at line 1909 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().
◆ loadModuleFile()
◆ LoadRequestedPlugins()
| void CompilerInstance::LoadRequestedPlugins | ( | ) |
|---|
◆ lookupMissingImports()
◆ makeModuleVisible()
◆ printDiagnosticStats()
| void CompilerInstance::printDiagnosticStats | ( | ) |
|---|
At the end of a compilation, print the number of warnings/errors.
Definition at line 1038 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().
◆ resetAndLeakASTContext()
| void clang::CompilerInstance::resetAndLeakASTContext ( ) | inline |
|---|
◆ resetAndLeakFileManager()
| void clang::CompilerInstance::resetAndLeakFileManager ( ) | inline |
|---|
◆ resetAndLeakPreprocessor()
| void clang::CompilerInstance::resetAndLeakPreprocessor ( ) | inline |
|---|
◆ resetAndLeakSema()
| void CompilerInstance::resetAndLeakSema | ( | ) |
|---|
◆ resetAndLeakSourceManager()
| void clang::CompilerInstance::resetAndLeakSourceManager ( ) | inline |
|---|
◆ setASTConsumer()
| void CompilerInstance::setASTConsumer | ( | std::unique_ptr< ASTConsumer > | Value | ) |
|---|
◆ setASTContext()
◆ setASTReader()
◆ setAuxTarget()
| void CompilerInstance::setAuxTarget | ( | TargetInfo * | Value | ) |
|---|
◆ setBuildGlobalModuleIndex()
| void clang::CompilerInstance::setBuildGlobalModuleIndex ( bool Build) | inline |
|---|
◆ setCodeCompletionConsumer()
◆ setDependencyDirectivesGetter()
◆ setDiagnostics()
◆ setExternalSemaSource()
◆ setFileManager()
◆ setModuleDepCollector()
◆ setOutputManager()
| void CompilerInstance::setOutputManager | ( | IntrusiveRefCntPtr< llvm::vfs::OutputBackend > | NewOutputs | ) |
|---|
◆ setOutputStream()
| void clang::CompilerInstance::setOutputStream ( std::unique_ptr< llvm::raw_pwrite_stream > OutStream) | inline |
|---|
◆ setPreprocessor()
| void CompilerInstance::setPreprocessor | ( | std::shared_ptr< Preprocessor > | Value | ) |
|---|
◆ setSema()
| void CompilerInstance::setSema | ( | Sema * | S | ) |
|---|
◆ setSourceManager()
◆ setTarget()
| void CompilerInstance::setTarget | ( | TargetInfo * | Value | ) |
|---|
◆ setVerboseOutputStream() [1/2]
| void CompilerInstance::setVerboseOutputStream | ( | raw_ostream & | Value | ) |
|---|
◆ setVerboseOutputStream() [2/2]
| void CompilerInstance::setVerboseOutputStream | ( | std::unique_ptr< raw_ostream > | Value | ) |
|---|
◆ setVirtualFileSystem()
| void clang::CompilerInstance::setVirtualFileSystem ( IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS) | inline |
|---|
◆ shouldBuildGlobalModuleIndex()
| bool CompilerInstance::shouldBuildGlobalModuleIndex | ( | ) | const |
|---|
◆ takeASTConsumer()
| std::unique_ptr< ASTConsumer > clang::CompilerInstance::takeASTConsumer ( ) | inline |
|---|
◆ takeOutputStream()
| std::unique_ptr< llvm::raw_pwrite_stream > clang::CompilerInstance::takeOutputStream ( ) | inline |
|---|
◆ takeSema()
| std::unique_ptr< Sema > CompilerInstance::takeSema | ( | ) |
|---|
The documentation for this class was generated from the following files:
- include/clang/Frontend/CompilerInstance.h
- lib/Frontend/CompilerInstance.cpp