clang API Documentation
#include <CompilerInstance.h>


Classes | |
| struct | OutputFile |
| Holds information about the output file. | |
Public Member Functions | |
| CompilerInstance () | |
| ~CompilerInstance () | |
High-Level Operations | |
{ | |
| bool | ExecuteAction (FrontendAction &Act) |
Compiler Invocation and Options | |
} { | |
| bool | hasInvocation () const |
| CompilerInvocation & | getInvocation () |
| void | setInvocation (CompilerInvocation *Value) |
| setInvocation - Replace the current invocation. | |
Forwarding Methods | |
} { | |
| AnalyzerOptions & | getAnalyzerOpts () |
| const AnalyzerOptions & | getAnalyzerOpts () const |
| CodeGenOptions & | getCodeGenOpts () |
| const CodeGenOptions & | getCodeGenOpts () const |
| DependencyOutputOptions & | getDependencyOutputOpts () |
| const DependencyOutputOptions & | getDependencyOutputOpts () const |
| DiagnosticOptions & | getDiagnosticOpts () |
| const DiagnosticOptions & | getDiagnosticOpts () const |
| const FileSystemOptions & | getFileSystemOpts () const |
| FrontendOptions & | getFrontendOpts () |
| const FrontendOptions & | getFrontendOpts () const |
| HeaderSearchOptions & | getHeaderSearchOpts () |
| const HeaderSearchOptions & | getHeaderSearchOpts () const |
| LangOptions & | getLangOpts () |
| const LangOptions & | getLangOpts () const |
| PreprocessorOptions & | getPreprocessorOpts () |
| const PreprocessorOptions & | getPreprocessorOpts () const |
| PreprocessorOutputOptions & | getPreprocessorOutputOpts () |
| const PreprocessorOutputOptions & | getPreprocessorOutputOpts () const |
| TargetOptions & | getTargetOpts () |
| const TargetOptions & | getTargetOpts () const |
Diagnostics Engine | |
} { | |
| bool | hasDiagnostics () const |
| DiagnosticsEngine & | getDiagnostics () const |
| Get the current diagnostics engine. | |
| void | setDiagnostics (DiagnosticsEngine *Value) |
| setDiagnostics - Replace the current diagnostics engine. | |
| DiagnosticConsumer & | getDiagnosticClient () const |
Target Info | |
} { | |
| bool | hasTarget () const |
| TargetInfo & | getTarget () const |
| void | setTarget (TargetInfo *Value) |
| Replace the current diagnostics engine. | |
File Manager | |
} { | |
| bool | hasFileManager () const |
| FileManager & | getFileManager () const |
| Return the current file manager to the caller. | |
| void | resetAndLeakFileManager () |
| void | setFileManager (FileManager *Value) |
| setFileManager - Replace the current file manager. | |
Source Manager | |
} { | |
| bool | hasSourceManager () const |
| SourceManager & | getSourceManager () const |
| Return the current source manager. | |
| void | resetAndLeakSourceManager () |
| void | setSourceManager (SourceManager *Value) |
| setSourceManager - Replace the current source manager. | |
Preprocessor | |
} { | |
| bool | hasPreprocessor () const |
| Preprocessor & | getPreprocessor () const |
| Return the current preprocessor. | |
| void | resetAndLeakPreprocessor () |
| void | setPreprocessor (Preprocessor *Value) |
| Replace the current preprocessor. | |
ASTContext | |
} { | |
| bool | hasASTContext () const |
| ASTContext & | getASTContext () const |
| void | resetAndLeakASTContext () |
| void | setASTContext (ASTContext *Value) |
| setASTContext - Replace the current AST context. | |
| void | setSema (Sema *S) |
| Replace the current Sema; the compiler instance takes ownership of S. | |
ASTConsumer | |
} { | |
| bool | hasASTConsumer () const |
| ASTConsumer & | getASTConsumer () const |
| ASTConsumer * | takeASTConsumer () |
| void | setASTConsumer (ASTConsumer *Value) |
Semantic analysis | |
} { | |
| bool | hasSema () const |
| Sema & | getSema () const |
| Sema * | takeSema () |
Module Management | |
} { | |
| ASTReader * | getModuleManager () const |
Code Completion | |
} { | |
| bool | hasCodeCompletionConsumer () const |
| CodeCompleteConsumer & | getCodeCompletionConsumer () const |
| CodeCompleteConsumer * | takeCodeCompletionConsumer () |
| void | setCodeCompletionConsumer (CodeCompleteConsumer *Value) |
Frontend timer | |
} { | |
| bool | hasFrontendTimer () const |
| llvm::Timer & | getFrontendTimer () const |
Output Files | |
} { | |
| void | addOutputFile (const OutputFile &OutFile) |
| void | clearOutputFiles (bool EraseFiles) |
Construction Utility Methods | |
|
{ | |
| void | createDiagnostics (int Argc, const char *const *Argv, DiagnosticConsumer *Client=0, bool ShouldOwnClient=true, bool ShouldCloneClient=true) |
| void | createFileManager () |
| 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 () |
| void | createASTContext () |
| Create the AST context. | |
| void | createPCHExternalASTSource (StringRef Path, bool DisablePCHValidation, bool DisableStatCache, bool AllowPCHWithCompilerErrors, void *DeserializationListener) |
| void | createCodeCompletionConsumer () |
| 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. | |
| llvm::raw_fd_ostream * | createDefaultOutputFile (bool Binary=true, StringRef BaseInput="", StringRef Extension="") |
| llvm::raw_fd_ostream * | createOutputFile (StringRef OutputPath, bool Binary=true, bool RemoveFileOnSignal=true, StringRef BaseInput="", StringRef Extension="", bool UseTemporary=false, bool CreateMissingDirectories=false) |
| static IntrusiveRefCntPtr < DiagnosticsEngine > | createDiagnostics (const DiagnosticOptions &Opts, int Argc, const char *const *Argv, DiagnosticConsumer *Client=0, bool ShouldOwnClient=true, bool ShouldCloneClient=true, const CodeGenOptions *CodeGenOpts=0) |
| static ExternalASTSource * | createPCHExternalASTSource (StringRef Path, const std::string &Sysroot, bool DisablePCHValidation, bool DisableStatCache, bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context, void *DeserializationListener, bool Preamble) |
| static CodeCompleteConsumer * | createCodeCompletionConsumer (Preprocessor &PP, const std::string &Filename, unsigned Line, unsigned Column, bool ShowMacros, bool ShowCodePatterns, bool ShowGlobals, raw_ostream &OS) |
| static llvm::raw_fd_ostream * | createOutputFile (StringRef OutputPath, std::string &Error, bool Binary=true, bool RemoveFileOnSignal=true, StringRef BaseInput="", StringRef Extension="", bool UseTemporary=false, bool CreateMissingDirectories=false, std::string *ResultPathName=0, std::string *TempPathName=0) |
Initialization Utility Methods | |
|
{ | |
| bool | InitializeSourceManager (StringRef InputFile, SrcMgr::CharacteristicKind Kind=SrcMgr::C_User) |
| virtual Module * | loadModule (SourceLocation ImportLoc, ModuleIdPath Path, Module::NameVisibilityKind Visibility, bool IsInclusionDirective) |
| } | |
| static bool | InitializeSourceManager (StringRef InputFile, SrcMgr::CharacteristicKind Kind, DiagnosticsEngine &Diags, FileManager &FileMgr, SourceManager &SourceMgr, const FrontendOptions &Opts) |
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 66 of file CompilerInstance.h.
| CompilerInstance::CompilerInstance | ( | ) |
Definition at line 50 of file CompilerInstance.cpp.
| CompilerInstance::~CompilerInstance | ( | ) |
Definition at line 54 of file CompilerInstance.cpp.
| void CompilerInstance::addOutputFile | ( | const OutputFile & | OutFile | ) |
addOutputFile - Add an output file onto the list of tracked output files.
| OutFile | - The output file info. |
Definition at line 438 of file CompilerInstance.cpp.
Referenced by createOutputFile().
| void CompilerInstance::clearOutputFiles | ( | bool | EraseFiles | ) |
clearOutputFiles - Clear the output file list, destroying the contained output streams.
| EraseFiles | - If true, attempt to erase the files from disk. |
Definition at line 443 of file CompilerInstance.cpp.
References getDiagnostics(), and clang::DiagnosticsEngine::Report().
Referenced by clang::FrontendAction::EndSourceFile().
| void CompilerInstance::createASTContext | ( | ) |
Create the AST context.
Definition at line 297 of file CompilerInstance.cpp.
References clang::Preprocessor::getBuiltinInfo(), clang::Preprocessor::getIdentifierTable(), getLangOpts(), getPreprocessor(), clang::Preprocessor::getSelectorTable(), clang::Preprocessor::getSourceManager(), and getTarget().
Referenced by clang::FrontendAction::BeginSourceFile(), and loadModule().
| 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 384 of file CompilerInstance.cpp.
References clang::FrontendOptions::CodeCompletionAt, clang::ParsedSourceLocation::Column, EnableCodeCompletion(), clang::ParsedSourceLocation::FileName, clang::Preprocessor::getDiagnostics(), getFrontendOpts(), getPreprocessor(), clang::ParsedSourceLocation::Line, clang::DiagnosticsEngine::Report(), and setCodeCompletionConsumer().
Referenced by clang::ASTFrontendAction::ExecuteAction().
| CodeCompleteConsumer * CompilerInstance::createCodeCompletionConsumer | ( | Preprocessor & | PP, |
| const std::string & | Filename, | ||
| unsigned | Line, | ||
| unsigned | Column, | ||
| bool | ShowMacros, | ||
| bool | ShowCodePatterns, | ||
| bool | ShowGlobals, | ||
| raw_ostream & | OS | ||
| ) | [static] |
Create a code completion consumer to print code completion results, at
Definition at line 414 of file CompilerInstance.cpp.
References EnableCodeCompletion().
| llvm::raw_fd_ostream * CompilerInstance::createDefaultOutputFile | ( | bool | Binary = true, |
| StringRef | BaseInput = "", |
||
| StringRef | Extension = "" |
||
| ) |
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 function always use temporary files to write to their result (that is, the data is written to a temporary file which will atomically replace the target output on success).
Definition at line 474 of file CompilerInstance.cpp.
References createOutputFile(), and getFrontendOpts().
Referenced by clang::HTMLPrintAction::CreateASTConsumer(), clang::ASTPrintAction::CreateASTConsumer(), clang::ASTDumpXMLAction::CreateASTConsumer(), clang::RewriteObjCAction::CreateASTConsumer(), clang::RewriteMacrosAction::ExecuteAction(), clang::RewriteTestAction::ExecuteAction(), clang::GeneratePTHAction::ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), and GetOutputStream().
| void CompilerInstance::createDiagnostics | ( | int | Argc, |
| const char *const * | Argv, | ||
| DiagnosticConsumer * | Client = 0, |
||
| bool | ShouldOwnClient = true, |
||
| bool | ShouldCloneClient = true |
||
| ) |
Create the diagnostics engine using the invocation's diagnostic options and replace any existing one with it.
Note that this routine also replaces the diagnostic client, allocating one if one is not provided.
| Client | If non-NULL, a diagnostic client that will be attached to (and, then, owned by) the DiagnosticsEngine inside this AST unit. |
| ShouldOwnClient | If Client is non-NULL, specifies whether the diagnostic object should take ownership of the client. |
| ShouldCloneClient | If Client is non-NULL, specifies whether that client should be cloned. |
Definition at line 170 of file CompilerInstance.cpp.
References getCodeGenOpts(), and getDiagnosticOpts().
Referenced by clang::createInvocationFromCommandLine(), and clang::ASTUnit::LoadFromCommandLine().
| IntrusiveRefCntPtr< DiagnosticsEngine > CompilerInstance::createDiagnostics | ( | const DiagnosticOptions & | Opts, |
| int | Argc, | ||
| const char *const * | Argv, | ||
| DiagnosticConsumer * | Client = 0, |
||
| bool | ShouldOwnClient = true, |
||
| bool | ShouldCloneClient = true, |
||
| const CodeGenOptions * | CodeGenOpts = 0 |
||
| ) | [static] |
Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
If no diagnostic client is provided, this creates a DiagnosticConsumer that is owned by the returned diagnostic object, if using directly the caller is responsible for releasing the returned DiagnosticsEngine's client eventually.
| Opts | - The diagnostic options; note that the created text diagnostic object contains a reference to these options and its lifetime must extend past that of the diagnostic engine. |
| Client | If non-NULL, a diagnostic client that will be attached to (and, then, owned by) the returned DiagnosticsEngine object. |
| CodeGenOpts | If non-NULL, the code gen options in use, which may be used by some diagnostics printers (for logging purposes only). |
Definition at line 180 of file CompilerInstance.cpp.
References clang::DiagnosticConsumer::clone(), clang::DiagnosticOptions::DiagnosticLogFile, clang::DiagnosticOptions::DiagnosticSerializationFile, clang::DiagnosticOptions::DumpBuildInformation, clang::ProcessWarningOptions(), SetUpBuildDumpLog(), SetUpDiagnosticLog(), SetupSerializedDiagnostics(), and clang::DiagnosticOptions::VerifyDiagnostics.
| void CompilerInstance::createFileManager | ( | ) |
Create the file manager and replace any existing one with it.
Definition at line 223 of file CompilerInstance.cpp.
References getFileSystemOpts().
Referenced by clang::FrontendAction::BeginSourceFile().
| void CompilerInstance::createFrontendTimer | ( | ) |
Create the frontend timer and replace any existing one with it.
Definition at line 409 of file CompilerInstance.cpp.
Referenced by ExecuteAction().
| llvm::raw_fd_ostream * CompilerInstance::createOutputFile | ( | StringRef | OutputPath, |
| bool | Binary = true, |
||
| bool | RemoveFileOnSignal = true, |
||
| StringRef | BaseInput = "", |
||
| StringRef | Extension = "", |
||
| bool | UseTemporary = false, |
||
| bool | CreateMissingDirectories = false |
||
| ) |
Create a new output file and add it to the list of tracked output files, optionally deriving the output path name.
Definition at line 483 of file CompilerInstance.cpp.
References addOutputFile(), getDiagnostics(), and clang::DiagnosticsEngine::Report().
Referenced by clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::GenerateModuleAction::ComputeASTConsumerArguments(), and createDefaultOutputFile().
| llvm::raw_fd_ostream * CompilerInstance::createOutputFile | ( | StringRef | OutputPath, |
| std::string & | Error, | ||
| bool | Binary = true, |
||
| bool | RemoveFileOnSignal = true, |
||
| StringRef | BaseInput = "", |
||
| StringRef | Extension = "", |
||
| bool | UseTemporary = false, |
||
| bool | CreateMissingDirectories = false, |
||
| std::string * | ResultPathName = 0, |
||
| std::string * | TempPathName = 0 |
||
| ) | [static] |
Create a new output file, optionally deriving the output path name.
If
| OutputPath | - If given, the path to the output file. |
| Error | [out] - On failure, the error message. |
| BaseInput | - If
|
| Extension | - The extension to use for derived output names. |
| Binary | - The mode to open the file in. |
| 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 |
| UseTemporary | - Create a new temporary file that must be renamed to OutputPath in the end. |
| CreateMissingDirectories | - When
|
| ResultPathName | [out] - If given, the result path name will be stored here on success. |
| TempPathName | [out] - If given, the temporary file path name will be stored here on success. |
Definition at line 512 of file CompilerInstance.cpp.
| void CompilerInstance::createPCHExternalASTSource | ( | StringRef | Path, |
| bool | DisablePCHValidation, | ||
| bool | DisableStatCache, | ||
| bool | AllowPCHWithCompilerErrors, | ||
| void * | DeserializationListener | ||
| ) |
Create an external AST source to read a PCH file and attach it to the AST context.
Definition at line 307 of file CompilerInstance.cpp.
References getASTContext(), getHeaderSearchOpts(), getPreprocessor(), getPreprocessorOpts(), clang::PreprocessorOptions::PrecompiledPreambleBytes, and clang::ASTContext::setExternalSource().
Referenced by clang::FrontendAction::BeginSourceFile().
| ExternalASTSource * CompilerInstance::createPCHExternalASTSource | ( | StringRef | Path, |
| const std::string & | Sysroot, | ||
| bool | DisablePCHValidation, | ||
| bool | DisableStatCache, | ||
| bool | AllowPCHWithCompilerErrors, | ||
| Preprocessor & | PP, | ||
| ASTContext & | Context, | ||
| void * | DeserializationListener, | ||
| bool | Preamble | ||
| ) | [static] |
Create an external AST source to read a PCH file.
Definition at line 326 of file CompilerInstance.cpp.
References clang::ASTReader::Failure, clang::ASTReader::IgnorePCH, clang::serialization::MK_PCH, clang::serialization::MK_Preamble, clang::Preprocessor::setPredefines(), and clang::ASTReader::Success.
| void CompilerInstance::createPreprocessor | ( | ) |
Create the preprocessor, using the invocation, file, and source managers, and replace any existing one with it.
Definition at line 235 of file CompilerInstance.cpp.
References clang::AttachDependencyFileGen(), clang::AttachDependencyGraphGen(), clang::AttachHeaderIncludeGen(), clang::PTHManager::Create(), clang::PreprocessorOptions::DetailedRecord, clang::PreprocessorOptions::DetailedRecordConditionalDirectives, clang::DependencyOutputOptions::DOTOutputFile, getDependencyOutputOpts(), getDiagnostics(), getFileManager(), getFrontendOpts(), getHeaderSearchOpts(), getInvocation(), getLangOpts(), getPreprocessorOpts(), getSourceManager(), getTarget(), clang::DependencyOutputOptions::HeaderIncludeOutputFile, clang::InitializePreprocessor(), clang::DependencyOutputOptions::OutputFile, clang::PTHManager::setPreprocessor(), clang::DependencyOutputOptions::ShowHeaderIncludes, clang::HeaderSearchOptions::Sysroot, and clang::PreprocessorOptions::TokenCache.
Referenced by clang::FrontendAction::BeginSourceFile().
| void CompilerInstance::createSema | ( | TranslationUnitKind | TUKind, |
| CodeCompleteConsumer * | CompletionConsumer | ||
| ) |
Create the Sema object to be used for parsing.
Definition at line 430 of file CompilerInstance.cpp.
References getASTConsumer(), getASTContext(), and getPreprocessor().
Referenced by clang::ASTFrontendAction::ExecuteAction().
| void CompilerInstance::createSourceManager | ( | FileManager & | FileMgr | ) |
Create the source manager and replace any existing one with it.
Definition at line 229 of file CompilerInstance.cpp.
References getDiagnostics().
Referenced by clang::FrontendAction::BeginSourceFile().
| bool CompilerInstance::ExecuteAction | ( | FrontendAction & | Act | ) |
ExecuteAction - Execute the provided action against the compiler's CompilerInvocation object.
This function makes the following assumptions:
Note that this routine may write output to 'stderr'.
| Act | - The action to execute. |
Definition at line 635 of file CompilerInstance.cpp.
References clang::FrontendAction::BeginSourceFile(), CLANG_VERSION_STRING, clang::SourceManager::clearIDTables(), createFrontendTimer(), clang::TargetInfo::CreateTargetInfo(), clang::FrontendAction::EndSourceFile(), clang::FrontendAction::Execute(), clang::DiagnosticConsumer::finish(), clang::DiagnosticsEngine::getClient(), getDiagnosticOpts(), getDiagnostics(), getFileManager(), getFrontendOpts(), getHeaderSearchOpts(), getLangOpts(), clang::DiagnosticConsumer::getNumErrors(), clang::DiagnosticConsumer::getNumWarnings(), getSourceManager(), getTarget(), getTargetOpts(), hasDiagnostics(), hasFileManager(), hasSourceManager(), hasTarget(), clang::TargetInfo::noSignedCharForObjCBool(), clang::FileManager::PrintStats(), clang::frontend::RewriteObjC, clang::TargetInfo::setForcedLangOptions(), setTarget(), and clang::FrontendOptions::ShowStats.
Referenced by clang::ExecuteCompilerInvocation().
| AnalyzerOptions& clang::CompilerInstance::getAnalyzerOpts | ( | ) | [inline] |
Definition at line 192 of file CompilerInstance.h.
Referenced by clang::ento::AnalysisAction::CreateASTConsumer(), and clang::ExecuteCompilerInvocation().
| const AnalyzerOptions& clang::CompilerInstance::getAnalyzerOpts | ( | ) | const [inline] |
Definition at line 195 of file CompilerInstance.h.
| ASTConsumer& clang::CompilerInstance::getASTConsumer | ( | ) | const [inline] |
Definition at line 386 of file CompilerInstance.h.
Referenced by createSema(), and loadModule().
| ASTContext& clang::CompilerInstance::getASTContext | ( | ) | const [inline] |
Definition at line 364 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), createASTReader(), createPCHExternalASTSource(), createSema(), clang::ASTMergeAction::ExecuteAction(), and loadModule().
| CodeCompleteConsumer& clang::CompilerInstance::getCodeCompletionConsumer | ( | ) | const [inline] |
Definition at line 423 of file CompilerInstance.h.
Referenced by clang::ASTFrontendAction::ExecuteAction().
| CodeGenOptions& clang::CompilerInstance::getCodeGenOpts | ( | ) | [inline] |
Definition at line 199 of file CompilerInstance.h.
Referenced by clang::CodeGenAction::CreateASTConsumer(), createDiagnostics(), and clang::CodeGenAction::ExecuteAction().
| const CodeGenOptions& clang::CompilerInstance::getCodeGenOpts | ( | ) | const [inline] |
Definition at line 202 of file CompilerInstance.h.
| DependencyOutputOptions& clang::CompilerInstance::getDependencyOutputOpts | ( | ) | [inline] |
Definition at line 206 of file CompilerInstance.h.
Referenced by createPreprocessor().
| const DependencyOutputOptions& clang::CompilerInstance::getDependencyOutputOpts | ( | ) | const [inline] |
Definition at line 209 of file CompilerInstance.h.
| DiagnosticConsumer& clang::CompilerInstance::getDiagnosticClient | ( | ) | const [inline] |
Definition at line 281 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), compileModule(), and clang::FrontendAction::EndSourceFile().
| DiagnosticOptions& clang::CompilerInstance::getDiagnosticOpts | ( | ) | [inline] |
Definition at line 213 of file CompilerInstance.h.
Referenced by clang::RewriteObjCAction::CreateASTConsumer(), createDiagnostics(), and ExecuteAction().
| const DiagnosticOptions& clang::CompilerInstance::getDiagnosticOpts | ( | ) | const [inline] |
Definition at line 216 of file CompilerInstance.h.
| DiagnosticsEngine& clang::CompilerInstance::getDiagnostics | ( | ) | const [inline] |
Get the current diagnostics engine.
Definition at line 273 of file CompilerInstance.h.
Referenced by clang::arcmt::CheckAction::BeginInvocation(), clang::arcmt::ModifyAction::BeginInvocation(), clang::arcmt::MigrateAction::BeginInvocation(), clang::FixItRecompile::BeginInvocation(), clang::arcmt::ObjCMigrateAction::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FixItAction::BeginSourceFileAction(), clang::GenerateModuleAction::BeginSourceFileAction(), clearOutputFiles(), compileModule(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::CodeGenAction::CreateASTConsumer(), clang::RewriteObjCAction::CreateASTConsumer(), CreateFrontendBaseAction(), createOutputFile(), createPreprocessor(), createSourceManager(), clang::FrontendAction::EndSourceFile(), clang::CodeGenAction::ExecuteAction(), clang::ASTMergeAction::ExecuteAction(), ExecuteAction(), clang::ExecuteCompilerInvocation(), InitializeSourceManager(), and loadModule().
| FileManager& clang::CompilerInstance::getFileManager | ( | ) | const [inline] |
Return the current file manager to the caller.
Definition at line 308 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::GenerateModuleAction::BeginSourceFileAction(), clang::arcmt::MigrateSourceAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::arcmt::ObjCMigrateAction::CreateASTConsumer(), createPreprocessor(), clang::ASTMergeAction::ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), ExecuteAction(), InitializeSourceManager(), and loadModule().
| const FileSystemOptions& clang::CompilerInstance::getFileSystemOpts | ( | ) | const [inline] |
Definition at line 220 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), createFileManager(), and clang::ASTMergeAction::ExecuteAction().
| FrontendOptions& clang::CompilerInstance::getFrontendOpts | ( | ) | [inline] |
Definition at line 224 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FixItAction::BeginSourceFileAction(), clang::GeneratePCHAction::ComputeASTConsumerArguments(), clang::GenerateModuleAction::ComputeASTConsumerArguments(), clang::ChainedIncludesSource::create(), clang::ento::AnalysisAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::arcmt::MigrateSourceAction::CreateASTConsumer(), clang::ASTDumpXMLAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), createCodeCompletionConsumer(), createDefaultOutputFile(), CreateFrontendAction(), CreateFrontendBaseAction(), createPreprocessor(), clang::FrontendAction::EndSourceFile(), ExecuteAction(), clang::GeneratePTHAction::ExecuteAction(), clang::ASTFrontendAction::ExecuteAction(), clang::ExecuteCompilerInvocation(), InitializeSourceManager(), and setCodeCompletionConsumer().
| const FrontendOptions& clang::CompilerInstance::getFrontendOpts | ( | ) | const [inline] |
Definition at line 227 of file CompilerInstance.h.
| llvm::Timer& clang::CompilerInstance::getFrontendTimer | ( | ) | const [inline] |
Definition at line 445 of file CompilerInstance.h.
Referenced by clang::FrontendAction::Execute().
| HeaderSearchOptions& clang::CompilerInstance::getHeaderSearchOpts | ( | ) | [inline] |
Definition at line 231 of file CompilerInstance.h.
Referenced by clang::GeneratePCHAction::ComputeASTConsumerArguments(), createPCHExternalASTSource(), createPreprocessor(), ExecuteAction(), and loadModule().
| const HeaderSearchOptions& clang::CompilerInstance::getHeaderSearchOpts | ( | ) | const [inline] |
Definition at line 234 of file CompilerInstance.h.
| CompilerInvocation& clang::CompilerInstance::getInvocation | ( | ) | [inline] |
Definition at line 180 of file CompilerInstance.h.
Referenced by clang::arcmt::CheckAction::BeginInvocation(), clang::arcmt::ModifyAction::BeginInvocation(), clang::arcmt::MigrateAction::BeginInvocation(), compileModule(), clang::ChainedIncludesSource::create(), and createPreprocessor().
| LangOptions& clang::CompilerInstance::getLangOpts | ( | ) | [inline] |
Definition at line 238 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::FixItAction::BeginSourceFileAction(), clang::GenerateModuleAction::BeginSourceFileAction(), clang::GenerateModuleAction::ComputeASTConsumerArguments(), clang::CodeGenAction::CreateASTConsumer(), clang::RewriteObjCAction::CreateASTConsumer(), createASTContext(), createPreprocessor(), clang::CodeGenAction::ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), ExecuteAction(), and loadModule().
| const LangOptions& clang::CompilerInstance::getLangOpts | ( | ) | const [inline] |
Definition at line 241 of file CompilerInstance.h.
| ASTReader* clang::CompilerInstance::getModuleManager | ( | ) | const [inline] |
Definition at line 415 of file CompilerInstance.h.
| Preprocessor& clang::CompilerInstance::getPreprocessor | ( | ) | const [inline] |
Return the current preprocessor.
Definition at line 346 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::GenerateModuleAction::BeginSourceFileAction(), compileModule(), clang::GenerateModuleAction::ComputeASTConsumerArguments(), clang::HTMLPrintAction::CreateASTConsumer(), clang::ento::AnalysisAction::CreateASTConsumer(), clang::arcmt::MigrateSourceAction::CreateASTConsumer(), clang::arcmt::ObjCMigrateAction::CreateASTConsumer(), clang::GeneratePCHAction::CreateASTConsumer(), clang::GenerateModuleAction::CreateASTConsumer(), createASTContext(), createASTReader(), createCodeCompletionConsumer(), createPCHExternalASTSource(), createSema(), clang::FrontendAction::EndSourceFile(), clang::RewriteMacrosAction::ExecuteAction(), clang::RewriteTestAction::ExecuteAction(), clang::DumpRawTokensAction::ExecuteAction(), clang::DumpTokensAction::ExecuteAction(), clang::GeneratePTHAction::ExecuteAction(), clang::PreprocessOnlyAction::ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), and loadModule().
| PreprocessorOptions& clang::CompilerInstance::getPreprocessorOpts | ( | ) | [inline] |
Definition at line 245 of file CompilerInstance.h.
Referenced by clang::arcmt::MigrateSourceAction::BeginInvocation(), clang::FixItRecompile::BeginInvocation(), clang::arcmt::ObjCMigrateAction::BeginInvocation(), clang::FrontendAction::BeginSourceFile(), clang::ChainedIncludesSource::create(), createPCHExternalASTSource(), createPreprocessor(), and loadModule().
| const PreprocessorOptions& clang::CompilerInstance::getPreprocessorOpts | ( | ) | const [inline] |
Definition at line 248 of file CompilerInstance.h.
| PreprocessorOutputOptions& clang::CompilerInstance::getPreprocessorOutputOpts | ( | ) | [inline] |
Definition at line 252 of file CompilerInstance.h.
Referenced by clang::PrintPreprocessedAction::ExecuteAction().
| const PreprocessorOutputOptions& clang::CompilerInstance::getPreprocessorOutputOpts | ( | ) | const [inline] |
Definition at line 255 of file CompilerInstance.h.
| Sema& clang::CompilerInstance::getSema | ( | ) | const [inline] |
Definition at line 404 of file CompilerInstance.h.
Referenced by clang::ASTFrontendAction::ExecuteAction(), and loadModule().
| SourceManager& clang::CompilerInstance::getSourceManager | ( | ) | const [inline] |
Return the current source manager.
Definition at line 327 of file CompilerInstance.h.
Referenced by clang::FixItRecompile::BeginInvocation(), clang::FixItAction::BeginSourceFileAction(), clang::GenerateModuleAction::BeginSourceFileAction(), createPreprocessor(), clang::FrontendAction::EndSourceFile(), clang::CodeGenAction::ExecuteAction(), ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), and InitializeSourceManager().
| TargetInfo& clang::CompilerInstance::getTarget | ( | ) | const [inline] |
Definition at line 293 of file CompilerInstance.h.
Referenced by clang::GenerateModuleAction::BeginSourceFileAction(), createASTContext(), createPreprocessor(), ExecuteAction(), and loadModule().
| TargetOptions& clang::CompilerInstance::getTargetOpts | ( | ) | [inline] |
Definition at line 259 of file CompilerInstance.h.
Referenced by clang::CodeGenAction::CreateASTConsumer(), clang::CodeGenAction::ExecuteAction(), and ExecuteAction().
| const TargetOptions& clang::CompilerInstance::getTargetOpts | ( | ) | const [inline] |
Definition at line 262 of file CompilerInstance.h.
| bool clang::CompilerInstance::hasASTConsumer | ( | ) | const [inline] |
Definition at line 384 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), and loadModule().
| bool clang::CompilerInstance::hasASTContext | ( | ) | const [inline] |
Definition at line 362 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), and loadModule().
| bool clang::CompilerInstance::hasCodeCompletionConsumer | ( | ) | const [inline] |
Definition at line 421 of file CompilerInstance.h.
Referenced by clang::ASTFrontendAction::ExecuteAction().
| bool clang::CompilerInstance::hasDiagnostics | ( | ) | const [inline] |
Definition at line 270 of file CompilerInstance.h.
Referenced by ExecuteAction().
| bool clang::CompilerInstance::hasFileManager | ( | ) | const [inline] |
Definition at line 305 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), and ExecuteAction().
| bool clang::CompilerInstance::hasFrontendTimer | ( | ) | const [inline] |
Definition at line 443 of file CompilerInstance.h.
Referenced by clang::FrontendAction::Execute().
| bool clang::CompilerInstance::hasInvocation | ( | ) | const [inline] |
Definition at line 178 of file CompilerInstance.h.
| bool clang::CompilerInstance::hasPreprocessor | ( | ) | const [inline] |
Definition at line 343 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
| bool clang::CompilerInstance::hasSema | ( | ) | const [inline] |
Definition at line 402 of file CompilerInstance.h.
Referenced by clang::ASTFrontendAction::ExecuteAction(), and loadModule().
| bool clang::CompilerInstance::hasSourceManager | ( | ) | const [inline] |
Definition at line 324 of file CompilerInstance.h.
Referenced by clang::FrontendAction::BeginSourceFile(), and ExecuteAction().
| bool clang::CompilerInstance::hasTarget | ( | ) | const [inline] |
Definition at line 291 of file CompilerInstance.h.
Referenced by ExecuteAction().
| bool CompilerInstance::InitializeSourceManager | ( | StringRef | InputFile, |
| SrcMgr::CharacteristicKind | Kind = SrcMgr::C_User |
||
| ) |
InitializeSourceManager - Initialize the source manager to set InputFile as the main file.
Definition at line 594 of file CompilerInstance.cpp.
References getDiagnostics(), getFileManager(), getFrontendOpts(), and getSourceManager().
Referenced by clang::FrontendAction::Execute().
| bool CompilerInstance::InitializeSourceManager | ( | StringRef | InputFile, |
| SrcMgr::CharacteristicKind | Kind, | ||
| DiagnosticsEngine & | Diags, | ||
| FileManager & | FileMgr, | ||
| SourceManager & | SourceMgr, | ||
| const FrontendOptions & | Opts | ||
| ) | [static] |
InitializeSourceManager - Initialize the source manager to set InputFile as the main file.
Definition at line 601 of file CompilerInstance.cpp.
References clang::SourceManager::createMainFileID(), clang::FileManager::getFile(), clang::SourceManager::getMainFileID(), clang::FileManager::getVirtualFile(), clang::FileID::isInvalid(), clang::SourceManager::overrideFileContents(), and clang::DiagnosticsEngine::Report().
| Module * CompilerInstance::loadModule | ( | SourceLocation | ImportLoc, |
| ModuleIdPath | Path, | ||
| Module::NameVisibilityKind | Visibility, | ||
| bool | IsInclusionDirective | ||
| ) | [virtual] |
}
Implements clang::ModuleLoader.
Definition at line 848 of file CompilerInstance.cpp.
References clang::DeclContext::addDecl(), compileModule(), createASTContext(), clang::ImportDecl::CreateImplicit(), clang::FixItHint::CreateReplacement(), clang::LangOptions::CurrentModule, clang::PreprocessorOptions::DisablePCHValidation, clang::PreprocessorOptions::DisableStatCache, clang::ASTReader::Failure, clang::Module::findSubmodule(), getASTConsumer(), getASTContext(), getDiagnostics(), clang::FileManager::getFile(), getFileManager(), clang::Module::getFullModuleName(), getHeaderSearchOpts(), getLangOpts(), clang::FileEntry::getName(), getPreprocessor(), getPreprocessorOpts(), getSema(), getTarget(), clang::ASTContext::getTranslationUnitDecl(), hasASTConsumer(), hasASTContext(), hasSema(), clang::ASTReader::IgnorePCH, clang::ASTReader::InitializeSema(), clang::Module::isAvailable(), clang::Module::IsFromModuleFile, clang::SourceLocation::isInvalid(), clang::ASTReader::makeModuleVisible(), clang::serialization::MK_Module, clang::PreprocessorOptions::ModuleBuildPath, clang::ASTReader::ReadAST(), clang::DiagnosticsEngine::Report(), clang::ASTContext::setASTMutationListener(), clang::ASTReader::setDeserializationListener(), clang::ASTContext::setExternalSource(), clang::ASTReader::StartTranslationUnit(), clang::Module::submodule_begin(), clang::Module::submodule_end(), clang::ASTReader::Success, and clang::HeaderSearchOptions::Sysroot.
| void clang::CompilerInstance::resetAndLeakASTContext | ( | ) | [inline] |
Definition at line 369 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
| void clang::CompilerInstance::resetAndLeakFileManager | ( | ) | [inline] |
Definition at line 313 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
| void clang::CompilerInstance::resetAndLeakPreprocessor | ( | ) | [inline] |
Definition at line 351 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
| void clang::CompilerInstance::resetAndLeakSourceManager | ( | ) | [inline] |
Definition at line 332 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
| void CompilerInstance::setASTConsumer | ( | ASTConsumer * | Value | ) |
setASTConsumer - Replace the current AST consumer; the compiler instance takes ownership of
Definition at line 85 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().
| void CompilerInstance::setASTContext | ( | ASTContext * | Value | ) |
setASTContext - Replace the current AST context.
Definition at line 79 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::BeginSourceFile(), and clang::FrontendAction::EndSourceFile().
| void CompilerInstance::setCodeCompletionConsumer | ( | CodeCompleteConsumer * | Value | ) |
setCodeCompletionConsumer - Replace the current code completion consumer; the compiler instance takes ownership of
Definition at line 89 of file CompilerInstance.cpp.
References getFrontendOpts(), and clang::FrontendOptions::SkipFunctionBodies.
Referenced by createCodeCompletionConsumer().
| void CompilerInstance::setDiagnostics | ( | DiagnosticsEngine * | Value | ) |
setDiagnostics - Replace the current diagnostics engine.
Definition at line 61 of file CompilerInstance.cpp.
| void CompilerInstance::setFileManager | ( | FileManager * | Value | ) |
setFileManager - Replace the current file manager.
Definition at line 69 of file CompilerInstance.cpp.
Referenced by clang::FixItRecompile::BeginInvocation(), and clang::FrontendAction::BeginSourceFile().
| void CompilerInstance::setInvocation | ( | CompilerInvocation * | Value | ) |
setInvocation - Replace the current invocation.
Definition at line 57 of file CompilerInstance.cpp.
Referenced by compileModule().
| void CompilerInstance::setPreprocessor | ( | Preprocessor * | Value | ) |
Replace the current preprocessor.
Definition at line 77 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::BeginSourceFile().
| void CompilerInstance::setSema | ( | Sema * | S | ) |
Replace the current Sema; the compiler instance takes ownership of S.
Definition at line 81 of file CompilerInstance.cpp.
Referenced by clang::FrontendAction::EndSourceFile().
| void CompilerInstance::setSourceManager | ( | SourceManager * | Value | ) |
setSourceManager - Replace the current source manager.
Definition at line 73 of file CompilerInstance.cpp.
Referenced by clang::FixItRecompile::BeginInvocation(), and clang::FrontendAction::BeginSourceFile().
| void CompilerInstance::setTarget | ( | TargetInfo * | Value | ) |
Replace the current diagnostics engine.
Definition at line 65 of file CompilerInstance.cpp.
Referenced by ExecuteAction().
| ASTConsumer* clang::CompilerInstance::takeASTConsumer | ( | ) | [inline] |
takeASTConsumer - Remove the current AST consumer and give ownership to the caller.
Definition at line 393 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().
| CodeCompleteConsumer* clang::CompilerInstance::takeCodeCompletionConsumer | ( | ) | [inline] |
takeCodeCompletionConsumer - Remove the current code completion consumer and give ownership to the caller.
Definition at line 431 of file CompilerInstance.h.
| Sema* clang::CompilerInstance::takeSema | ( | ) | [inline] |
Definition at line 409 of file CompilerInstance.h.
Referenced by clang::FrontendAction::EndSourceFile().