clang 22.0.0git
clang::CompilerInstance Class Reference

CompilerInstance - Helper class for managing a single instance of the Clang compiler. More...

#include "clang/Frontend/CompilerInstance.h"

Inheritance diagram for clang::CompilerInstance:
[legend]

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 >(), 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< CompilerInstancecloneForModuleCompile (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
GlobalModuleIndexloadGlobalModuleIndex (SourceLocation TriggerLoc) override
 Load, create, or return global module.
bool lookupMissingImports (StringRef Name, SourceLocation TriggerLoc) override
 Check global module index for missing imports.
void addDependencyCollector (std::shared_ptr< DependencyCollector > Listener)
void setExternalSemaSource (IntrusiveRefCntPtr< ExternalSemaSource > ESS)
ModuleCachegetModuleCache () 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
CompilerInvocationgetInvocation ()
std::shared_ptr< CompilerInvocationgetInvocationPtr ()
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
AnalyzerOptionsgetAnalyzerOpts ()
CodeGenOptionsgetCodeGenOpts ()
const CodeGenOptionsgetCodeGenOpts () const
DependencyOutputOptionsgetDependencyOutputOpts ()
const DependencyOutputOptionsgetDependencyOutputOpts () const
DiagnosticOptionsgetDiagnosticOpts ()
const DiagnosticOptionsgetDiagnosticOpts () const
FileSystemOptionsgetFileSystemOpts ()
const FileSystemOptionsgetFileSystemOpts () const
FrontendOptionsgetFrontendOpts ()
const FrontendOptionsgetFrontendOpts () const
HeaderSearchOptionsgetHeaderSearchOpts ()
const HeaderSearchOptionsgetHeaderSearchOpts () const
APINotesOptionsgetAPINotesOpts ()
const APINotesOptionsgetAPINotesOpts () const
LangOptionsgetLangOpts ()
const LangOptionsgetLangOpts () const
PreprocessorOptionsgetPreprocessorOpts ()
const PreprocessorOptionsgetPreprocessorOpts () const
PreprocessorOutputOptionsgetPreprocessorOutputOpts ()
const PreprocessorOutputOptionsgetPreprocessorOutputOpts () const
TargetOptionsgetTargetOpts ()
const TargetOptionsgetTargetOpts () const
Diagnostics Engine
bool hasDiagnostics () const
DiagnosticsEnginegetDiagnostics () const
 Get the current diagnostics engine.
IntrusiveRefCntPtr< DiagnosticsEnginegetDiagnosticsPtr () const
void setDiagnostics (llvm::IntrusiveRefCntPtr< DiagnosticsEngine > Value)
 setDiagnostics - Replace the current diagnostics engine.
DiagnosticConsumergetDiagnosticClient () 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
TargetInfogetTarget () const
IntrusiveRefCntPtr< TargetInfogetTargetPtr () const
void setTarget (TargetInfo *Value)
 Replace the current Target.
AuxTarget Info
TargetInfogetAuxTarget () const
void setAuxTarget (TargetInfo *Value)
 Replace the current AuxTarget.
bool createTarget ()
Virtual File System
llvm::vfs::FileSystem & getVirtualFileSystem () const
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > getVirtualFileSystemPtr () const
File Manager
bool hasFileManager () const
FileManagergetFileManager () const
 Return the current file manager to the caller.
IntrusiveRefCntPtr< FileManagergetFileManagerPtr () const
void resetAndLeakFileManager ()
void setFileManager (IntrusiveRefCntPtr< FileManager > Value)
 Replace the current file manager and virtual file system.
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
SourceManagergetSourceManager () const
 Return the current source manager.
IntrusiveRefCntPtr< SourceManagergetSourceManagerPtr () const
void resetAndLeakSourceManager ()
void setSourceManager (llvm::IntrusiveRefCntPtr< SourceManager > Value)
 setSourceManager - Replace the current source manager.
Preprocessor
bool hasPreprocessor () const
PreprocessorgetPreprocessor () const
 Return the current preprocessor.
std::shared_ptr< PreprocessorgetPreprocessorPtr ()
void resetAndLeakPreprocessor ()
void setPreprocessor (std::shared_ptr< Preprocessor > Value)
 Replace the current preprocessor.
ASTContext
bool hasASTContext () const
ASTContextgetASTContext () const
IntrusiveRefCntPtr< ASTContextgetASTContextPtr () 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
ASTConsumergetASTConsumer () const
std::unique_ptr< ASTConsumertakeASTConsumer ()
 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
SemagetSema () const
std::unique_ptr< SematakeSema ()
void resetAndLeakSema ()
Module Management
IntrusiveRefCntPtr< ASTReadergetASTReader () const
void setASTReader (IntrusiveRefCntPtr< ASTReader > Reader)
std::shared_ptr< ModuleDependencyCollectorgetModuleDepCollector () const
void setModuleDepCollector (std::shared_ptr< ModuleDependencyCollector > Collector)
std::shared_ptr< PCHContainerOperationsgetPCHContainerOperations () const
const PCHContainerWritergetPCHContainerWriter () const
 Return the appropriate PCHContainerWriter depending on the current CodeGenOptions.
const PCHContainerReadergetPCHContainerReader () const
 Return the appropriate PCHContainerReader depending on the current CodeGenOptions.
Code Completion
bool hasCodeCompletionConsumer () const
CodeCompleteConsumergetCodeCompletionConsumer () 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 (llvm::vfs::FileSystem &VFS, DiagnosticConsumer *Client=nullptr, bool ShouldOwnClient=true)
 Create the diagnostics engine using the invocation's diagnostic options and replace any existing one with it.
FileManagercreateFileManager (IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS=nullptr)
 Create the file manager and replace any existing one with it.
void createSourceManager (FileManager &FileMgr)
 Create the source manager and replace any existing one with it.
void createPreprocessor (TranslationUnitKind TUKind)
 Create the preprocessor, using the invocation, file, and source managers, and replace any existing one with it.
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< DiagnosticsEnginecreateDiagnostics (llvm::vfs::FileSystem &VFS, DiagnosticOptions &Opts, DiagnosticConsumer *Client=nullptr, bool ShouldOwnClient=true, const CodeGenOptions *CodeGenOpts=nullptr)
 Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
static IntrusiveRefCntPtr< ASTReadercreatePCHExternalASTSource (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 CodeCompleteConsumercreateCodeCompletionConsumer (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

Detailed Description

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.

Constructor & Destructor Documentation

◆ CompilerInstance()

CompilerInstance::CompilerInstance ( std::shared_ptr< CompilerInvocation > Invocation = std::make_shared<CompilerInvocation>(),
std::shared_ptr< PCHContainerOperations > PCHContainerOps = std::make_shared<PCHContainerOperations>(),
ModuleCache * ModCache = nullptr )
explicit

◆ ~CompilerInstance()

CompilerInstance::~CompilerInstance ( )
override

Definition at line 81 of file CompilerInstance.cpp.

Member Function Documentation

◆ addDependencyCollector()

void clang::CompilerInstance::addDependencyCollector ( std::shared_ptr< DependencyCollector > Listener)
inline

Definition at line 924 of file CompilerInstance.h.

Referenced by createPreprocessor().

◆ clearOutputFiles()

void CompilerInstance::clearOutputFiles ( bool EraseFiles)

clearOutputFiles - Clear the output file list.

The underlying output streams must have been closed beforehand.

Parameters
EraseFiles- If true, attempt to erase the files from disk.

Definition at line 784 of file CompilerInstance.cpp.

References hasASTConsumer().

Referenced by clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().

◆ cloneForModuleCompile()

◆ compileModule()

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 1223 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 ( )

Create the AST context.

Definition at line 566 of file CompilerInstance.cpp.

References getAuxTarget(), getLangOpts(), getPreprocessor(), getTarget(), and setASTContext().

Referenced by clang::FrontendAction::BeginSourceFile(), and createASTReader().

◆ createASTReader()

◆ createCodeCompletionConsumer() [1/2]

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 726 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().

◆ createCodeCompletionConsumer() [2/2]

CodeCompleteConsumer * CompilerInstance::createCodeCompletionConsumer ( Preprocessor & PP,
StringRef Filename,
unsigned Line,
unsigned Column,
const CodeCompleteOptions & Opts,
raw_ostream & OS )
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 746 of file CompilerInstance.cpp.

References clang::Column, EnableCodeCompletion(), and clang::Line.

◆ 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 813 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]

void CompilerInstance::createDiagnostics ( llvm::vfs::FileSystem & VFS,
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.

Parameters
VFSis used for any IO needed when creating DiagnosticsEngine. It doesn't replace VFS in the CompilerInstance (if any).
ClientIf non-NULL, a diagnostic client that will be attached to (and, then, owned by) the DiagnosticsEngine inside this AST unit.
ShouldOwnClientIf Client is non-NULL, specifies whether the diagnostic object should take ownership of the client.

Definition at line 343 of file CompilerInstance.cpp.

References createDiagnostics(), getCodeGenOpts(), and getDiagnosticOpts().

Referenced by createDiagnostics(), clang::createInvocation(), clang::tooling::ToolInvocation::run(), and clang::tooling::FrontendActionFactory::runInvocation().

◆ createDiagnostics() [2/2]

IntrusiveRefCntPtr< DiagnosticsEngine > CompilerInstance::createDiagnostics ( llvm::vfs::FileSystem & VFS,
DiagnosticOptions & Opts,
DiagnosticConsumer * Client = nullptr,
bool ShouldOwnClient = true,
const CodeGenOptions * CodeGenOpts = nullptr )
static

Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.

If no diagnostic client is provided, this creates a DiagnosticConsumer that is owned by the returned diagnostic object, if using directly the caller is responsible for releasing the returned DiagnosticsEngine's client eventually.

Parameters
Opts- The diagnostic options; note that the created text diagnostic object contains a reference to these options.
ClientIf non-NULL, a diagnostic client that will be attached to (and, then, owned by) the returned DiagnosticsEngine object.
CodeGenOptsIf 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 350 of file CompilerInstance.cpp.

References clang::DiagnosticIDs::create(), clang::DiagnosticOptions::DiagnosticLogFile, clang::DiagnosticOptions::DiagnosticSerializationFile, clang::ProcessWarningOptions(), clang::DiagnosticOptions::SARIF, SetUpDiagnosticLog(), and SetupSerializedDiagnostics().

◆ createFileManager()

FileManager * CompilerInstance::createFileManager ( IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS = nullptr)

Create the file manager and replace any existing one with it.

Returns
The new file manager on success, or null on failure.

Definition at line 385 of file CompilerInstance.cpp.

References clang::createVFSFromCompilerInvocation(), getDiagnostics(), getFileSystemOpts(), getFrontendOpts(), and getInvocation().

Referenced by clang::FrontendAction::BeginSourceFile().

◆ createFrontendTimer()

void CompilerInstance::createFrontendTimer ( )

Create the frontend timer and replace any existing one with it.

Definition at line 740 of file CompilerInstance.cpp.

◆ createModuleFromSource()

void CompilerInstance::createModuleFromSource ( SourceLocation Loc,
StringRef ModuleName,
StringRef Source )
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.

Parameters
LocThe location at which to create the module.
ModuleNameThe name of the module to create.
SourceThe source of the module: a (preprocessed) module map.

Implements clang::ModuleLoader.

Definition at line 2186 of file CompilerInstance.cpp.

References clang::C, compileModule(), getDiagnostics(), getLanguageFromOptions(), clang::isAlphanumeric(), clang::InputKind::ModuleMap, clang::Other, clang::DiagnosticsEngine::Report(), and clang::Success.

◆ createNullOutputFile()

std::unique_ptr< raw_pwrite_stream > CompilerInstance::createNullOutputFile ( )

Definition at line 833 of file CompilerInstance.cpp.

Referenced by GetOutputStream().

◆ createOutputFile()

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.

Returns
- Null on error.

Definition at line 862 of file CompilerInstance.cpp.

References clang::Binary, getDiagnostics(), and clang::DiagnosticsEngine::Report().

Referenced by createDefaultOutputFile().

◆ createOutputManager()

void CompilerInstance::createOutputManager ( )

Create an output manager.

Definition at line 845 of file CompilerInstance.cpp.

Referenced by createPreprocessor(), and getOrCreateOutputManager().

◆ createPCHExternalASTSource() [1/2]

void CompilerInstance::createPCHExternalASTSource ( StringRef Path,
DisableValidationForModuleKind DisableValidation,
bool AllowPCHWithCompilerErrors,
void * DeserializationListener,
bool OwnDeserializationListener )

◆ 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

◆ createPreprocessor()

◆ createSema()

void CompilerInstance::createSema ( TranslationUnitKind TUKind,
CodeCompleteConsumer * CompletionConsumer )

◆ createSourceManager()

void CompilerInstance::createSourceManager ( FileManager & FileMgr)

Create the source manager and replace any existing one with it.

Definition at line 402 of file CompilerInstance.cpp.

References getDiagnostics().

Referenced by clang::FrontendAction::BeginSourceFile(), and clang::tooling::FrontendActionFactory::runInvocation().

◆ createTarget()

◆ ExecuteAction()

bool CompilerInstance::ExecuteAction ( FrontendAction & Act)

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 961 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(), and clang::tooling::FrontendActionFactory::runInvocation().

◆ getAnalyzerOpts()

◆ getAPINotesOpts() [1/2]

APINotesOptions & clang::CompilerInstance::getAPINotesOpts ( )
inline

Definition at line 307 of file CompilerInstance.h.

Referenced by createSema().

◆ getAPINotesOpts() [2/2]

const APINotesOptions & clang::CompilerInstance::getAPINotesOpts ( ) const
inline

Definition at line 308 of file CompilerInstance.h.

◆ getASTConsumer()

ASTConsumer & clang::CompilerInstance::getASTConsumer ( ) const
inline

◆ getASTContext()

◆ getASTContextPtr()

IntrusiveRefCntPtr< ASTContext > clang::CompilerInstance::getASTContextPtr ( ) const
inline

Definition at line 514 of file CompilerInstance.h.

◆ getASTReader()

◆ getAuxTarget()

TargetInfo * clang::CompilerInstance::getAuxTarget ( ) const
inline

Definition at line 400 of file CompilerInstance.h.

Referenced by createASTContext(), createPreprocessor(), and createTarget().

◆ getCodeCompletionConsumer()

CodeCompleteConsumer & clang::CompilerInstance::getCodeCompletionConsumer ( ) const
inline

Definition at line 612 of file CompilerInstance.h.

Referenced by clang::ASTFrontendAction::ExecuteAction().

◆ getCodeGenOpts() [1/2]

◆ getCodeGenOpts() [2/2]

const CodeGenOptions & clang::CompilerInstance::getCodeGenOpts ( ) const
inline

Definition at line 268 of file CompilerInstance.h.

◆ getDependencyOutputOpts() [1/2]

DependencyOutputOptions & clang::CompilerInstance::getDependencyOutputOpts ( )
inline

Definition at line 272 of file CompilerInstance.h.

Referenced by createPreprocessor().

◆ getDependencyOutputOpts() [2/2]

const DependencyOutputOptions & clang::CompilerInstance::getDependencyOutputOpts ( ) const
inline

Definition at line 275 of file CompilerInstance.h.

◆ getDiagnosticClient()

DiagnosticConsumer & clang::CompilerInstance::getDiagnosticClient ( ) const
inline

◆ getDiagnosticOpts() [1/2]

◆ getDiagnosticOpts() [2/2]

const DiagnosticOptions & clang::CompilerInstance::getDiagnosticOpts ( ) const
inline

Definition at line 282 of file CompilerInstance.h.

◆ getDiagnostics()

◆ getDiagnosticsPtr()

IntrusiveRefCntPtr< DiagnosticsEngine > clang::CompilerInstance::getDiagnosticsPtr ( ) const
inline

◆ getFileManager()

◆ getFileManagerPtr()

IntrusiveRefCntPtr< FileManager > clang::CompilerInstance::getFileManagerPtr ( ) const
inline

Definition at line 428 of file CompilerInstance.h.

◆ getFileSystemOpts() [1/2]

FileSystemOptions & clang::CompilerInstance::getFileSystemOpts ( )
inline

◆ getFileSystemOpts() [2/2]

const FileSystemOptions & clang::CompilerInstance::getFileSystemOpts ( ) const
inline

Definition at line 289 of file CompilerInstance.h.

◆ getFrontendOpts() [1/2]

FrontendOptions & clang::CompilerInstance::getFrontendOpts ( )
inline

Definition at line 293 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::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(), createFileManager(), clang::CreateFrontendAction(), clang::CreateFrontendBaseAction(), clang::GenerateModuleAction::CreateMultiplexConsumer(), clang::GeneratePCHAction::CreateOutputFile(), createPCHExternalASTSource(), createPreprocessor(), createTarget(), 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().

◆ getFrontendOpts() [2/2]

const FrontendOptions & clang::CompilerInstance::getFrontendOpts ( ) const
inline

Definition at line 296 of file CompilerInstance.h.

◆ getFrontendTimer()

llvm::Timer & clang::CompilerInstance::getFrontendTimer ( ) const
inline

Definition at line 628 of file CompilerInstance.h.

◆ getHeaderSearchOpts() [1/2]

◆ getHeaderSearchOpts() [2/2]

const HeaderSearchOptions & clang::CompilerInstance::getHeaderSearchOpts ( ) const
inline

Definition at line 303 of file CompilerInstance.h.

◆ getInvocation()

◆ getInvocationPtr()

std::shared_ptr< CompilerInvocation > clang::CompilerInstance::getInvocationPtr ( )
inline

Definition at line 248 of file CompilerInstance.h.

Referenced by clang::ReplCodeCompleter::codeComplete().

◆ getLangOpts() [1/2]

◆ getLangOpts() [2/2]

const LangOptions & clang::CompilerInstance::getLangOpts ( ) const
inline

Definition at line 313 of file CompilerInstance.h.

◆ getModuleCache()

◆ getModuleDepCollector()

std::shared_ptr< ModuleDependencyCollector > CompilerInstance::getModuleDepCollector ( ) const

Definition at line 222 of file CompilerInstance.cpp.

◆ getOrCreateOutputManager()

llvm::vfs::OutputBackend & CompilerInstance::getOrCreateOutputManager ( )

◆ getOutputManager()

llvm::vfs::OutputBackend & CompilerInstance::getOutputManager ( )

Definition at line 850 of file CompilerInstance.cpp.

Referenced by getOrCreateOutputManager().

◆ getPCHContainerOperations()

std::shared_ptr< PCHContainerOperations > clang::CompilerInstance::getPCHContainerOperations ( ) const
inline

Definition at line 574 of file CompilerInstance.h.

Referenced by clang::createChainedIncludesSource().

◆ getPCHContainerReader()

◆ getPCHContainerWriter()

const PCHContainerWriter & clang::CompilerInstance::getPCHContainerWriter ( ) const
inline

◆ getPreprocessor()

Preprocessor & clang::CompilerInstance::getPreprocessor ( ) const
inline

Return the current preprocessor.

Definition at line 489 of file CompilerInstance.h.

Referenced by clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::BeginSourceFileAction(), cloneForModuleCompile(), collectIncludePCH(), compileModuleAndReadASTImpl(), 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]

◆ getPreprocessorOpts() [2/2]

const PreprocessorOptions & clang::CompilerInstance::getPreprocessorOpts ( ) const
inline

Definition at line 318 of file CompilerInstance.h.

◆ getPreprocessorOutputOpts() [1/2]

◆ getPreprocessorOutputOpts() [2/2]

const PreprocessorOutputOptions & clang::CompilerInstance::getPreprocessorOutputOpts ( ) const
inline

Definition at line 325 of file CompilerInstance.h.

◆ getPreprocessorPtr()

std::shared_ptr< Preprocessor > clang::CompilerInstance::getPreprocessorPtr ( )
inline

Definition at line 494 of file CompilerInstance.h.

◆ getSema()

◆ getSourceManager()

◆ getSourceManagerPtr()

IntrusiveRefCntPtr< SourceManager > clang::CompilerInstance::getSourceManagerPtr ( ) const
inline

◆ getSpecificModuleCachePath() [1/2]

std::string clang::CompilerInstance::getSpecificModuleCachePath ( )
inline

◆ getSpecificModuleCachePath() [2/2]

std::string CompilerInstance::getSpecificModuleCachePath ( StringRef ModuleHash)

Definition at line 556 of file CompilerInstance.cpp.

References getHeaderSearchOpts().

Referenced by clang::FrontendAction::BeginSourceFile().

◆ getTarget()

◆ getTargetOpts() [1/2]

◆ getTargetOpts() [2/2]

const TargetOptions & clang::CompilerInstance::getTargetOpts ( ) const
inline

Definition at line 332 of file CompilerInstance.h.

◆ getTargetPtr()

IntrusiveRefCntPtr< TargetInfo > clang::CompilerInstance::getTargetPtr ( ) const
inline

Definition at line 388 of file CompilerInstance.h.

◆ getTimerGroup()

llvm::TimerGroup & clang::CompilerInstance::getTimerGroup ( ) const
inline

Definition at line 626 of file CompilerInstance.h.

◆ getVerboseOutputStream()

raw_ostream & clang::CompilerInstance::getVerboseOutputStream ( )
inline

Get the current stream for verbose output.

Definition at line 373 of file CompilerInstance.h.

Referenced by ExecuteAction(), and printDiagnosticStats().

◆ getVirtualFileSystem()

llvm::vfs::FileSystem & CompilerInstance::getVirtualFileSystem ( ) const

◆ getVirtualFileSystemPtr()

llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > CompilerInstance::getVirtualFileSystemPtr ( ) const

◆ hadModuleLoaderFatalFailure()

bool clang::CompilerInstance::hadModuleLoaderFatalFailure ( ) const
inline

Definition at line 916 of file CompilerInstance.h.

References clang::ModuleLoader::HadFatalFailure.

◆ hasASTConsumer()

bool clang::CompilerInstance::hasASTConsumer ( ) const
inline

◆ hasASTContext()

bool clang::CompilerInstance::hasASTContext ( ) const
inline

◆ hasCodeCompletionConsumer()

bool clang::CompilerInstance::hasCodeCompletionConsumer ( ) const
inline

Definition at line 610 of file CompilerInstance.h.

Referenced by clang::ASTFrontendAction::ExecuteAction().

◆ hasDiagnostics()

bool clang::CompilerInstance::hasDiagnostics ( ) const
inline

◆ hasFileManager()

bool clang::CompilerInstance::hasFileManager ( ) const
inline

◆ hasOutputManager()

bool clang::CompilerInstance::hasOutputManager ( ) const
inline

Definition at line 452 of file CompilerInstance.h.

References bool.

Referenced by createPreprocessor(), and getOrCreateOutputManager().

◆ hasPreprocessor()

◆ hasSema()

bool clang::CompilerInstance::hasSema ( ) const
inline

◆ hasSourceManager()

bool clang::CompilerInstance::hasSourceManager ( ) const
inline

◆ hasTarget()

bool clang::CompilerInstance::hasTarget ( ) const
inline

Definition at line 381 of file CompilerInstance.h.

Referenced by createTarget().

◆ InitializeSourceManager() [1/2]

bool CompilerInstance::InitializeSourceManager ( const FrontendInputFile & Input)

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 getDiagnostics(), getFileManager(), getSourceManager(), and InitializeSourceManager().

Referenced by clang::FrontendAction::BeginSourceFile(), and InitializeSourceManager().

◆ InitializeSourceManager() [2/2]

◆ loadGlobalModuleIndex()

GlobalModuleIndex * CompilerInstance::loadGlobalModuleIndex ( SourceLocation TriggerLoc)
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.

Parameters
TriggerLocThe location for what triggered the load.
Returns
Returns null if load failed.

Implements clang::ModuleLoader.

Definition at line 2249 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()

ModuleLoadResult CompilerInstance::loadModule ( SourceLocation ImportLoc,
ModuleIdPath Path,
Module::NameVisibilityKind Visibility,
bool IsInclusionDirective )
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.

Parameters
ImportLocThe location of the 'import' keyword.
PathThe identifiers (and their locations) of the module "path", e.g., "std.vector" would be split into "std" and "vector".
VisibilityThe visibility provided for the names in the loaded module.
IsInclusionDirectiveIndicates 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 1997 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 loadGlobalModuleIndex(), and loadModule().

◆ loadModuleFile()

◆ LoadRequestedPlugins()

◆ lookupMissingImports()

bool CompilerInstance::lookupMissingImports ( StringRef Name,
SourceLocation TriggerLoc )
overridevirtual

Check global module index for missing imports.

Parameters
NameThe symbol name to look for.
TriggerLocThe location for what triggered the load.
Returns
Returns true if any modules with that symbol found.

Implements clang::ModuleLoader.

Definition at line 2319 of file CompilerInstance.cpp.

References clang::ModuleLoader::buildingModule(), loadGlobalModuleIndex(), and clang::GlobalModuleIndex::lookupIdentifier().

◆ makeModuleVisible()

void CompilerInstance::makeModuleVisible ( Module * Mod,
Module::NameVisibilityKind Visibility,
SourceLocation ImportLoc )
overridevirtual

Make the given module visible.

Implements clang::ModuleLoader.

Definition at line 2238 of file CompilerInstance.cpp.

References createASTReader().

◆ printDiagnosticStats()

void CompilerInstance::printDiagnosticStats ( )

◆ resetAndLeakASTContext()

void clang::CompilerInstance::resetAndLeakASTContext ( )
inline

Definition at line 519 of file CompilerInstance.h.

Referenced by clang::FrontendAction::EndSourceFile().

◆ resetAndLeakFileManager()

void clang::CompilerInstance::resetAndLeakFileManager ( )
inline

Definition at line 433 of file CompilerInstance.h.

Referenced by clang::FrontendAction::EndSourceFile().

◆ resetAndLeakPreprocessor()

void clang::CompilerInstance::resetAndLeakPreprocessor ( )
inline

Definition at line 496 of file CompilerInstance.h.

Referenced by clang::FrontendAction::EndSourceFile().

◆ resetAndLeakSema()

void CompilerInstance::resetAndLeakSema ( )

Definition at line 2342 of file CompilerInstance.cpp.

References takeSema().

Referenced by clang::FrontendAction::EndSourceFile().

◆ resetAndLeakSourceManager()

void clang::CompilerInstance::resetAndLeakSourceManager ( )
inline

Definition at line 474 of file CompilerInstance.h.

Referenced by clang::FrontendAction::EndSourceFile().

◆ setASTConsumer()

void CompilerInstance::setASTConsumer ( std::unique_ptr< ASTConsumer > Value)

setASTConsumer - Replace the current AST consumer; the compiler instance takes ownership of Value.

Definition at line 197 of file CompilerInstance.cpp.

References getASTConsumer(), getASTContext(), and clang::ASTConsumer::Initialize().

Referenced by clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().

◆ setASTContext()

void CompilerInstance::setASTContext ( llvm::IntrusiveRefCntPtr< ASTContext > Value)

setASTContext - Replace the current AST context.

Definition at line 185 of file CompilerInstance.cpp.

References getASTConsumer(), getASTContext(), and clang::ASTConsumer::Initialize().

Referenced by clang::FrontendAction::BeginSourceFile(), createASTContext(), and clang::FrontendAction::EndSourceFile().

◆ setASTReader()

void CompilerInstance::setASTReader ( IntrusiveRefCntPtr< ASTReader > Reader)

Definition at line 215 of file CompilerInstance.cpp.

Referenced by clang::FrontendAction::BeginSourceFile().

◆ setAuxTarget()

void CompilerInstance::setAuxTarget ( TargetInfo * Value)

Replace the current AuxTarget.

Definition at line 108 of file CompilerInstance.cpp.

Referenced by createTarget().

◆ setBuildGlobalModuleIndex()

void clang::CompilerInstance::setBuildGlobalModuleIndex ( bool Build)
inline

Set the flag indicating whether we should (re)build the global module index.

Definition at line 255 of file CompilerInstance.h.

Referenced by compileModule().

◆ setCodeCompletionConsumer()

void CompilerInstance::setCodeCompletionConsumer ( CodeCompleteConsumer * Value)

setCodeCompletionConsumer - Replace the current code completion consumer; the compiler instance takes ownership of Value.

Definition at line 204 of file CompilerInstance.cpp.

Referenced by createCodeCompletionConsumer().

◆ setDependencyDirectivesGetter()

void clang::CompilerInstance::setDependencyDirectivesGetter ( std::unique_ptr< DependencyDirectivesGetter > Getter)
inline

Definition at line 703 of file CompilerInstance.h.

◆ setDiagnostics()

void CompilerInstance::setDiagnostics ( llvm::IntrusiveRefCntPtr< DiagnosticsEngine > Value)

setDiagnostics - Replace the current diagnostics engine.

Definition at line 92 of file CompilerInstance.cpp.

◆ setExternalSemaSource()

void CompilerInstance::setExternalSemaSource ( IntrusiveRefCntPtr< ExternalSemaSource > ESS)

Definition at line 2344 of file CompilerInstance.cpp.

◆ setFileManager()

void CompilerInstance::setFileManager ( llvm::IntrusiveRefCntPtr< FileManager > Value)

◆ setModuleDepCollector()

void CompilerInstance::setModuleDepCollector ( std::shared_ptr< ModuleDependencyCollector > Collector)

Definition at line 226 of file CompilerInstance.cpp.

◆ setOutputManager()

void CompilerInstance::setOutputManager ( IntrusiveRefCntPtr< llvm::vfs::OutputBackend > NewOutputs)

Set the output manager.

Definition at line 839 of file CompilerInstance.cpp.

◆ setOutputStream()

void clang::CompilerInstance::setOutputStream ( std::unique_ptr< llvm::raw_pwrite_stream > OutStream)
inline

Definition at line 824 of file CompilerInstance.h.

◆ setPreprocessor()

void CompilerInstance::setPreprocessor ( std::shared_ptr< Preprocessor > Value)

Replace the current preprocessor.

Definition at line 181 of file CompilerInstance.cpp.

Referenced by clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().

◆ setSema()

void CompilerInstance::setSema ( Sema * S)

Replace the current Sema; the compiler instance takes ownership of S.

Definition at line 193 of file CompilerInstance.cpp.

Referenced by clang::FrontendAction::EndSourceFile().

◆ setSourceManager()

void CompilerInstance::setSourceManager ( llvm::IntrusiveRefCntPtr< SourceManager > Value)

setSourceManager - Replace the current source manager.

Definition at line 176 of file CompilerInstance.cpp.

Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().

◆ setTarget()

void CompilerInstance::setTarget ( TargetInfo * Value)

Replace the current Target.

Definition at line 107 of file CompilerInstance.cpp.

Referenced by createTarget().

◆ setVerboseOutputStream() [1/2]

void CompilerInstance::setVerboseOutputStream ( raw_ostream & Value)

Replace the current stream for verbose output.

Definition at line 97 of file CompilerInstance.cpp.

◆ setVerboseOutputStream() [2/2]

void CompilerInstance::setVerboseOutputStream ( std::unique_ptr< raw_ostream > Value)

Replace the current stream for verbose output.

Definition at line 102 of file CompilerInstance.cpp.

◆ shouldBuildGlobalModuleIndex()

bool CompilerInstance::shouldBuildGlobalModuleIndex ( ) const

Indicates whether we should (re)build the global module index.

Definition at line 85 of file CompilerInstance.cpp.

References getFrontendOpts().

Referenced by clang::FrontendAction::Execute(), and loadGlobalModuleIndex().

◆ takeASTConsumer()

std::unique_ptr< ASTConsumer > clang::CompilerInstance::takeASTConsumer ( )
inline

takeASTConsumer - Remove the current AST consumer and give ownership to the caller.

Definition at line 544 of file CompilerInstance.h.

Referenced by clang::FrontendAction::EndSourceFile().

◆ takeOutputStream()

std::unique_ptr< llvm::raw_pwrite_stream > clang::CompilerInstance::takeOutputStream ( )
inline

◆ takeSema()

std::unique_ptr< Sema > CompilerInstance::takeSema ( )

Definition at line 208 of file CompilerInstance.cpp.

Referenced by resetAndLeakSema().


The documentation for this class was generated from the following files: