class CompilerInstance

Declaration

class CompilerInstance : public ModuleLoader { /* full declaration omitted */ };

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.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:72

Inherits from: ModuleLoader

Member Variables

private std::shared_ptr<CompilerInvocation> Invocation
The options used in this compiler instance.
private IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diagnostics
The diagnostics engine instance.
private IntrusiveRefCntPtr<clang::TargetInfo> Target
The target being compiled for.
private IntrusiveRefCntPtr<clang::TargetInfo> AuxTarget
Auxiliary Target info.
private IntrusiveRefCntPtr<clang::FileManager> FileMgr
The file manager.
private IntrusiveRefCntPtr<clang::SourceManager> SourceMgr
The source manager.
private IntrusiveRefCntPtr<clang::InMemoryModuleCache> ModuleCache
The cache of PCM files.
private std::shared_ptr<Preprocessor> PP
The preprocessor.
private IntrusiveRefCntPtr<clang::ASTContext> Context
The AST context.
private IntrusiveRefCntPtr<clang::ExternalSemaSource> ExternalSemaSrc
An optional sema source that will be attached to sema.
private std::unique_ptr<ASTConsumer> Consumer
The AST consumer.
private std::unique_ptr<CodeCompleteConsumer> CompletionConsumer
The code completion consumer.
private std::unique_ptr<Sema> TheSema
The semantic analysis object.
private std::unique_ptr<llvm::TimerGroup> FrontendTimerGroup
The frontend timer group.
private std::unique_ptr<llvm::Timer> FrontendTimer
The frontend timer.
private IntrusiveRefCntPtr<clang::ASTReader> TheASTReader
The ASTReader, if one exists.
private std::shared_ptr<ModuleDependencyCollector> ModuleDepCollector
The module dependency collector for crashdumps
private std::shared_ptr<PCHContainerOperations> ThePCHContainerOperations
The module provider.
private std::vector<std::shared_ptr<DependencyCollector>> DependencyCollectors
private std::map<std::string, std::string, std::less<>> BuiltModules
The set of top-level modules that has already been built on the fly as part of this overall compilation action.
private bool DeleteBuiltModules = true
Should we delete the BuiltModules when we're done?
private clang::SourceLocation LastModuleImportLoc
The location of the module-import keyword for the last module import.
private clang::ModuleLoadResult LastModuleImportResult
The result of the last module import.
private bool BuildGlobalModuleIndex = false
Whether we should (re)build the global module index once we have finished with this translation unit.
private bool HaveFullGlobalModuleIndex = false
We have a full global module index, with all modules.
private bool DisableGeneratingGlobalModuleIndex = false
One or more modules failed to build.
private std::unique_ptr<raw_ostream> OwnedVerboseOutputStream
The stream for verbose output if owned, otherwise nullptr.
private llvm::raw_ostream* VerboseOutputStream = &llvm::errs()
The stream for verbose output.
private std::list<OutputFile> OutputFiles
The list of active output files.
private std::unique_ptr<llvm::raw_pwrite_stream> OutputStream
Force an output buffer.

Inherited from ModuleLoader:

public HadFatalFailure = false

Method Overview

Inherited from ModuleLoader:

Methods

CompilerInstance(
    std::shared_ptr<PCHContainerOperations>
        PCHContainerOps = std::make_shared<
            clang::PCHContainerOperations>(),
    clang::InMemoryModuleCache*
        SharedModuleCache = nullptr)

Declared at: clang/include/clang/Frontend/CompilerInstance.h:182

Parameters

std::shared_ptr<PCHContainerOperations> PCHContainerOps = std::make_shared<clang::PCHContainerOperations>()
clang::InMemoryModuleCache* SharedModuleCache = nullptr

CompilerInstance(const clang::CompilerInstance&)

Declared at: clang/include/clang/Frontend/CompilerInstance.h:179

Parameters

const clang::CompilerInstance&

bool ExecuteAction(clang::FrontendAction& Act)

Description

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'.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:218

Parameters

clang::FrontendAction& Act
- The action to execute.

Returns

- True on success.

bool InitializeSourceManager(
    const clang::FrontendInputFile& Input)

Description

InitializeSourceManager - Initialize the source manager to set InputFile as the main file.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:750

Parameters

const clang::FrontendInputFile& Input

Returns

True on success.

static bool InitializeSourceManager(
    const clang::FrontendInputFile& Input,
    clang::DiagnosticsEngine& Diags,
    clang::FileManager& FileMgr,
    clang::SourceManager& SourceMgr)

Description

InitializeSourceManager - Initialize the source manager to set InputFile as the main file.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:756

Parameters

const clang::FrontendInputFile& Input
clang::DiagnosticsEngine& Diags
clang::FileManager& FileMgr
clang::SourceManager& SourceMgr

Returns

True on success.

void LoadRequestedPlugins()

Description

Load the list of plugins requested in the \c FrontendOptions.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:221

void addDependencyCollector(
    std::shared_ptr<DependencyCollector> Listener)

Declared at: clang/include/clang/Frontend/CompilerInstance.h:811

Parameters

std::shared_ptr<DependencyCollector> Listener

void clearOutputFiles(bool EraseFiles)

Description

clearOutputFiles - Clear the output file list. The underlying output streams must have been closed beforehand.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:589

Parameters

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

void createASTContext()

Description

Create the AST context.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:653

void createASTReader()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:771

static clang::CodeCompleteConsumer*
createCodeCompletionConsumer(
    clang::Preprocessor& PP,
    llvm::StringRef Filename,
    unsigned int Line,
    unsigned int Column,
    const clang::CodeCompleteOptions& Opts,
    llvm::raw_ostream& OS)

Description

Create a code completion consumer to print code completion results, at\p Filename, \p Line, and \p Column, to the given output stream \p OS.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:683

Parameters

clang::Preprocessor& PP
llvm::StringRef Filename
unsigned int Line
unsigned int Column
const clang::CodeCompleteOptions& Opts
llvm::raw_ostream& OS

void createCodeCompletionConsumer()

Description

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.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:679

std::unique_ptr<raw_pwrite_stream>
createDefaultOutputFile(
    bool Binary = true,
    llvm::StringRef BaseInput = "",
    llvm::StringRef Extension = "",
    bool RemoveFileOnSignal = true,
    bool CreateMissingDirectories = false,
    bool ForceUseTemporary = false)

Description

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:703

Parameters

bool Binary = true
llvm::StringRef BaseInput = ""
llvm::StringRef Extension = ""
bool RemoveFileOnSignal = true
bool CreateMissingDirectories = false
bool ForceUseTemporary = false

Returns

- Null on error.

void createDiagnostics(
    clang::DiagnosticConsumer* Client = nullptr,
    bool ShouldOwnClient = true)

Description

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.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:607

Parameters

clang::DiagnosticConsumer* Client = nullptr
If non-NULL, a diagnostic client that will be attached to (and, then, owned by) the DiagnosticsEngine inside this AST unit.
bool ShouldOwnClient = true
If Client is non-NULL, specifies whether the diagnostic object should take ownership of the client.

static IntrusiveRefCntPtr<
    clang::DiagnosticsEngine>
createDiagnostics(
    clang::DiagnosticOptions* Opts,
    clang::DiagnosticConsumer* Client = nullptr,
    bool ShouldOwnClient = true,
    const clang::CodeGenOptions* CodeGenOpts =
        nullptr)

Description

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.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:629

Parameters

clang::DiagnosticOptions* Opts
- The diagnostic options; note that the created text diagnostic object contains a reference to these options.
clang::DiagnosticConsumer* Client = nullptr
If non-NULL, a diagnostic client that will be attached to (and, then, owned by) the returned DiagnosticsEngine object.
bool ShouldOwnClient = true
const clang::CodeGenOptions* CodeGenOpts = nullptr
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.

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

Description

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:638

Parameters

IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr

Returns

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

void createFrontendTimer()

Description

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:692

void createModuleFromSource(
    clang::SourceLocation ImportLoc,
    llvm::StringRef ModuleName,
    llvm::StringRef Source)

Description

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.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:797

Parameters

clang::SourceLocation ImportLoc
llvm::StringRef ModuleName
The name of the module to create.
llvm::StringRef Source
The source of the module: a (preprocessed) module map.

std::unique_ptr<raw_pwrite_stream>
createNullOutputFile()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:740

std::unique_ptr<raw_pwrite_stream>
createOutputFile(
    llvm::StringRef OutputPath,
    bool Binary,
    bool RemoveFileOnSignal,
    bool UseTemporary,
    bool CreateMissingDirectories = false)

Description

Create a new output file, optionally deriving the output path name, and add it to the list of tracked output files.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:713

Parameters

llvm::StringRef OutputPath
bool Binary
bool RemoveFileOnSignal
bool UseTemporary
bool CreateMissingDirectories = false

Returns

- Null on error.

Expected<std::unique_ptr<raw_pwrite_stream>>
createOutputFileImpl(
    llvm::StringRef OutputPath,
    bool Binary,
    bool RemoveFileOnSignal,
    bool UseTemporary,
    bool CreateMissingDirectories)

Description

Create a new output file and add it to the list of tracked output files. If \p OutputPath is empty, then createOutputFile will derive an output path location as \p BaseInput, with any suffix removed, and \p Extension appended. If \p OutputPath is not stdout and \p UseTemporary is true, createOutputFile will create a new temporary file that must be renamed to \p OutputPath in the end.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:735

Parameters

llvm::StringRef OutputPath
- If given, the path to the output file.
bool Binary
- The mode to open the file in.
bool RemoveFileOnSignal
- Whether the file should be registered with llvm::sys::RemoveFileOnSignal. Note that this is not safe for multithreaded use, as the underlying signal mechanism is not reentrant
bool UseTemporary
- Create a new temporary file that must be renamed to OutputPath in the end.
bool CreateMissingDirectories
- When \p UseTemporary is true, create missing directories in the output path.

static IntrusiveRefCntPtr<clang::ASTReader>
createPCHExternalASTSource(
    llvm::StringRef Path,
    llvm::StringRef Sysroot,
    clang::DisableValidationForModuleKind
        DisableValidation,
    bool AllowPCHWithCompilerErrors,
    clang::Preprocessor& PP,
    clang::InMemoryModuleCache& ModuleCache,
    clang::ASTContext& Context,
    const clang::PCHContainerReader&
        PCHContainerRdr,
    ArrayRef<std::shared_ptr<ModuleFileExtension>>
        Extensions,
    ArrayRef<std::shared_ptr<DependencyCollector>>
        DependencyCollectors,
    void* DeserializationListener,
    bool OwnDeserializationListener,
    bool Preamble,
    bool UseGlobalModuleIndex)

Description

Create an external AST source to read a PCH file.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:665

Parameters

llvm::StringRef Path
llvm::StringRef Sysroot
clang::DisableValidationForModuleKind DisableValidation
bool AllowPCHWithCompilerErrors
clang::Preprocessor& PP
clang::InMemoryModuleCache& ModuleCache
clang::ASTContext& Context
const clang::PCHContainerReader& PCHContainerRdr
ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions
ArrayRef<std::shared_ptr<DependencyCollector>> DependencyCollectors
void* DeserializationListener
bool OwnDeserializationListener
bool Preamble
bool UseGlobalModuleIndex

Returns

- The new object on success, or null on failure.

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

Description

Create an external AST source to read a PCH file and attach it to the AST context.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:657

Parameters

llvm::StringRef Path
clang::DisableValidationForModuleKind DisableValidation
bool AllowPCHWithCompilerErrors
void* DeserializationListener
bool OwnDeserializationListener

void createPreprocessor(
    clang::TranslationUnitKind TUKind)

Description

Create the preprocessor, using the invocation, file, and source managers, and replace any existing one with it.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:645

Parameters

clang::TranslationUnitKind TUKind

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

Description

Create the Sema object to be used for parsing.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:688

Parameters

clang::TranslationUnitKind TUKind
clang::CodeCompleteConsumer* CompletionConsumer

void createSourceManager(
    clang::FileManager& FileMgr)

Description

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:641

Parameters

clang::FileManager& FileMgr

bool createTarget()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:387

clang::ModuleLoadResult
findOrCompileModuleAndReadAST(
    llvm::StringRef ModuleName,
    clang::SourceLocation ImportLoc,
    clang::SourceLocation ModuleNameLoc,
    bool IsInclusionDirective)

Description

Find a module, potentially compiling it, before reading its AST. This is the guts of loadModule. For prebuilt modules, the Module is not expected to exist in HeaderSearch's ModuleMap. If a ModuleFile by that name is in the ModuleManager, then it will be loaded and looked up. For implicit modules, the Module is expected to already be in the ModuleMap. First attempt to load it from the given path on disk. If that fails, defer to compileModuleAndReadAST, which will first build and then load it.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:787

Parameters

llvm::StringRef ModuleName
clang::SourceLocation ImportLoc
clang::SourceLocation ModuleNameLoc
bool IsInclusionDirective

clang::ASTConsumer& getASTConsumer() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:485

clang::ASTContext& getASTContext() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:462

IntrusiveRefCntPtr<clang::ASTReader>
getASTReader() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:515

clang::AnalyzerOptionsRef getAnalyzerOpts()

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:250

clang::TargetInfo* getAuxTarget() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:381

clang::CodeCompleteConsumer&
getCodeCompletionConsumer() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:560

clang::CodeGenOptions& getCodeGenOpts()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:254

const clang::CodeGenOptions& getCodeGenOpts()
    const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:257

clang::DependencyOutputOptions&
getDependencyOutputOpts()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:261

const clang::DependencyOutputOptions&
getDependencyOutputOpts() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:264

clang::DiagnosticConsumer& getDiagnosticClient()
    const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:342

const clang::DiagnosticOptions&
getDiagnosticOpts() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:271

clang::DiagnosticOptions& getDiagnosticOpts()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:268

clang::DiagnosticsEngine& getDiagnostics() const

Description

Get the current diagnostics engine.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:334

clang::FileManager& getFileManager() const

Description

Return the current file manager to the caller.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:402

clang::FileSystemOptions& getFileSystemOpts()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:275

const clang::FileSystemOptions&
getFileSystemOpts() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:278

clang::FrontendOptions& getFrontendOpts()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:282

const clang::FrontendOptions& getFrontendOpts()
    const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:285

llvm::Timer& getFrontendTimer() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:576

clang::HeaderSearchOptions& getHeaderSearchOpts()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:289

const clang::HeaderSearchOptions&
getHeaderSearchOpts() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:292

std::shared_ptr<HeaderSearchOptions>
getHeaderSearchOptsPtr() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:295

clang::CompilerInvocation& getInvocation()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:229

clang::LangOptions& getLangOpts()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:299

const clang::LangOptions& getLangOpts() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:302

clang::InMemoryModuleCache& getModuleCache() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:817

std::shared_ptr<ModuleDependencyCollector>
getModuleDepCollector() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:518

std::shared_ptr<PCHContainerOperations>
getPCHContainerOperations() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:522

const clang::PCHContainerReader&
getPCHContainerReader() const

Description

Return the appropriate PCHContainerReader depending on the current CodeGenOptions.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:542

const clang::PCHContainerWriter&
getPCHContainerWriter() const

Description

Return the appropriate PCHContainerWriter depending on the current CodeGenOptions.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:528

clang::Preprocessor& getPreprocessor() const

Description

Return the current preprocessor.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:442

clang::PreprocessorOptions& getPreprocessorOpts()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:306

const clang::PreprocessorOptions&
getPreprocessorOpts() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:309

clang::PreprocessorOutputOptions&
getPreprocessorOutputOpts()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:313

const clang::PreprocessorOutputOptions&
getPreprocessorOutputOpts() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:316

std::shared_ptr<Preprocessor> getPreprocessorPtr()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:447

clang::Sema& getSema() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:503

clang::SourceManager& getSourceManager() const

Description

Return the current source manager.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:422

std::string getSpecificModuleCachePath()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:648

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:647

Parameters

llvm::StringRef ModuleHash

clang::TargetInfo& getTarget() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:369

const clang::TargetOptions& getTargetOpts() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:323

clang::TargetOptions& getTargetOpts()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:320

llvm::raw_ostream& getVerboseOutputStream()

Description

Get the current stream for verbose output.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:359

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

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:393

bool hadModuleLoaderFatalFailure() const

Declared at: clang/include/clang/Frontend/CompilerInstance.h:803

bool hasASTConsumer() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:483

bool hasASTContext() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:460

bool hasCodeCompletionConsumer() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:558

bool hasDiagnostics() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:331

bool hasFileManager() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:399

bool hasFrontendTimer() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:574

bool hasInvocation() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:227

bool hasPreprocessor() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:439

bool hasSema() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:501

bool hasSourceManager() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:419

bool hasTarget() const

Description

} {

Declared at: clang/include/clang/Frontend/CompilerInstance.h:367

clang::GlobalModuleIndex* loadGlobalModuleIndex(
    clang::SourceLocation TriggerLoc)

Description

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.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:807

Parameters

clang::SourceLocation TriggerLoc
The location for what triggered the load.

Returns

Returns null if load failed.

clang::ModuleLoadResult loadModule(
    clang::SourceLocation ImportLoc,
    clang::ModuleIdPath Path,
    Module::NameVisibilityKind Visibility,
    bool IsInclusionDirective)

Description

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.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:793

Parameters

clang::SourceLocation ImportLoc
The location of the 'import' keyword.
clang::ModuleIdPath Path
The identifiers (and their locations) of the module "path", e.g., "std.vector" would be split into "std" and "vector".
Module::NameVisibilityKind Visibility
The visibility provided for the names in the loaded module.
bool 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.

bool loadModuleFile(llvm::StringRef FileName)

Declared at: clang/include/clang/Frontend/CompilerInstance.h:773

Parameters

llvm::StringRef FileName

bool lookupMissingImports(
    llvm::StringRef Name,
    clang::SourceLocation TriggerLoc)

Description

Check global module index for missing imports.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:809

Parameters

llvm::StringRef Name
The symbol name to look for.
clang::SourceLocation TriggerLoc
The location for what triggered the load.

Returns

Returns true if any modules with that symbol found.

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

Description

Make the given module visible.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:800

Parameters

clang::Module* Mod
Module::NameVisibilityKind Visibility
clang::SourceLocation ImportLoc

void resetAndLeakASTContext()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:467

void resetAndLeakFileManager()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:407

void resetAndLeakPreprocessor()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:449

void resetAndLeakSema()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:509

void resetAndLeakSourceManager()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:427

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

Description

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:496

Parameters

std::unique_ptr<ASTConsumer> Value

void setASTContext(clang::ASTContext* Value)

Description

setASTContext - Replace the current AST context.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:473

Parameters

clang::ASTContext* Value

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:516

Parameters

IntrusiveRefCntPtr<clang::ASTReader> Reader

void setAuxTarget(clang::TargetInfo* Value)

Description

Replace the current AuxTarget.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:384

Parameters

clang::TargetInfo* Value

void setBuildGlobalModuleIndex(bool Build)

Description

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:242

Parameters

bool Build

void setCodeCompletionConsumer(
    clang::CodeCompleteConsumer* Value)

Description

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:568

Parameters

clang::CodeCompleteConsumer* Value

void setDiagnostics(
    clang::DiagnosticsEngine* Value)

Description

setDiagnostics - Replace the current diagnostics engine.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:340

Parameters

clang::DiagnosticsEngine* Value

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:815

Parameters

IntrusiveRefCntPtr<clang::ExternalSemaSource> ESS

void setFileManager(clang::FileManager* Value)

Description

Replace the current file manager and virtual file system.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:413

Parameters

clang::FileManager* Value

void setInvocation(
    std::shared_ptr<CompilerInvocation> Value)

Description

setInvocation - Replace the current invocation.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:235

Parameters

std::shared_ptr<CompilerInvocation> Value

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:519

Parameters

std::shared_ptr<ModuleDependencyCollector> Collector

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

Description

}

Declared at: clang/include/clang/Frontend/CompilerInstance.h:763

Parameters

std::unique_ptr<llvm::raw_pwrite_stream> OutStream

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

Description

Replace the current preprocessor.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:454

Parameters

std::shared_ptr<Preprocessor> Value

void setSema(clang::Sema* S)

Description

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:477

Parameters

clang::Sema* S

void setSourceManager(clang::SourceManager* Value)

Description

setSourceManager - Replace the current source manager.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:433

Parameters

clang::SourceManager* Value

void setTarget(clang::TargetInfo* Value)

Description

Replace the current Target.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:375

Parameters

clang::TargetInfo* Value

void setVerboseOutputStream(
    llvm::raw_ostream& Value)

Description

Replace the current stream for verbose output.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:353

Parameters

llvm::raw_ostream& Value

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

Description

Replace the current stream for verbose output.

Declared at: clang/include/clang/Frontend/CompilerInstance.h:356

Parameters

std::unique_ptr<raw_ostream> Value

bool shouldBuildGlobalModuleIndex() const

Description

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:238

std::unique_ptr<ASTConsumer> takeASTConsumer()

Description

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

Declared at: clang/include/clang/Frontend/CompilerInstance.h:492

std::unique_ptr<llvm::raw_pwrite_stream>
takeOutputStream()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:767

std::unique_ptr<Sema> takeSema()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:508

~CompilerInstance()

Declared at: clang/include/clang/Frontend/CompilerInstance.h:186