clang API Documentation
#include <FrontendAction.h>

Public Member Functions | |
| FrontendAction () | |
| virtual | ~FrontendAction () |
Compiler Instance Access | |
| CompilerInstance & | getCompilerInstance () const |
| void | setCompilerInstance (CompilerInstance *Value) |
Current File Information | |
| bool | isCurrentFileAST () const |
| const FrontendInputFile & | getCurrentInput () const |
| const std::string & | getCurrentFile () const |
| InputKind | getCurrentFileKind () const |
| ASTUnit & | getCurrentASTUnit () const |
| ASTUnit * | takeCurrentASTUnit () |
| void | setCurrentInput (const FrontendInputFile &CurrentInput, ASTUnit *AST=0) |
Supported Modes | |
| virtual bool | usesPreprocessorOnly () const =0 |
| virtual TranslationUnitKind | getTranslationUnitKind () |
| For AST-based actions, the kind of translation unit we're handling. | |
| virtual bool | hasPCHSupport () const |
| hasPCHSupport - Does this action support use with PCH? | |
| virtual bool | hasASTFileSupport () const |
| hasASTFileSupport - Does this action support use with AST files? | |
| virtual bool | hasIRSupport () const |
| hasIRSupport - Does this action support use with IR files? | |
| virtual bool | hasCodeCompletionSupport () const |
Public Action Interface | |
| bool | BeginSourceFile (CompilerInstance &CI, const FrontendInputFile &Input) |
| void | Execute () |
| Execute - Set the source managers main input file, and run the action. | |
| void | EndSourceFile () |
Protected Member Functions | |
Implementation Action Interface | |
| virtual ASTConsumer * | CreateASTConsumer (CompilerInstance &CI, StringRef InFile)=0 |
| virtual bool | BeginInvocation (CompilerInstance &CI) |
| Callback before starting processing a single input, giving the opportunity to modify the CompilerInvocation or do some other action before BeginSourceFileAction is called. | |
| virtual bool | BeginSourceFileAction (CompilerInstance &CI, StringRef Filename) |
| virtual void | ExecuteAction ()=0 |
| virtual void | EndSourceFileAction () |
Friends | |
| class | ASTMergeAction |
| class | WrapperFrontendAction |
FrontendAction - Abstract base class for actions which can be performed by the frontend.
Definition at line 29 of file FrontendAction.h.
| FrontendAction::FrontendAction | ( | ) |
Definition at line 115 of file FrontendAction.cpp.
| FrontendAction::~FrontendAction | ( | ) | [virtual] |
Definition at line 117 of file FrontendAction.cpp.
| virtual bool clang::FrontendAction::BeginInvocation | ( | CompilerInstance & | CI | ) | [inline, protected, virtual] |
Callback before starting processing a single input, giving the opportunity to modify the CompilerInvocation or do some other action before BeginSourceFileAction is called.
Reimplemented in clang::WrapperFrontendAction, clang::arcmt::ObjCMigrateAction, clang::FixItRecompile, clang::arcmt::MigrateAction, clang::arcmt::MigrateSourceAction, clang::arcmt::ModifyAction, and clang::arcmt::CheckAction.
Definition at line 67 of file FrontendAction.h.
Referenced by BeginSourceFile().
| bool FrontendAction::BeginSourceFile | ( | CompilerInstance & | CI, |
| const FrontendInputFile & | Input | ||
| ) |
BeginSourceFile - Prepare the action for processing the input file
| CI | - The compiler instance this action is being run from. The action may store and use this object up until the matching EndSourceFile action. |
| Input | - The input filename and kind. Some input kinds are handled specially, for example AST inputs, since the AST file itself contains several objects which would normally be owned by the CompilerInstance. When processing AST input files, these objects should generally not be initialized in the CompilerInstance -- they will automatically be shared with the AST file in between |
Create the AST consumer.
Create the AST context and consumer unless this is a preprocessor only action.
Definition at line 158 of file FrontendAction.cpp.
References clang::PreprocessorOptions::AllowPCHWithCompilerErrors, BeginInvocation(), clang::DiagnosticConsumer::BeginSourceFile(), BeginSourceFileAction(), clang::PreprocessorOptions::ChainedIncludes, clang::ChainedIncludesSource::create(), clang::CompilerInstance::createASTContext(), clang::CompilerInstance::createFileManager(), clang::CompilerInstance::createPCHExternalASTSource(), clang::CompilerInstance::createPreprocessor(), clang::CompilerInstance::createSourceManager(), clang::PreprocessorOptions::DeserializedPCHDeclsToErrorOn, clang::PreprocessorOptions::DisablePCHValidation, clang::PreprocessorOptions::DisableStatCache, clang::PreprocessorOptions::DumpDeserializedPCHDecls, clang::DiagnosticConsumer::EndSourceFile(), clang::FrontendInputFile::File, clang::CompilerInstance::getASTContext(), clang::ASTUnit::getASTContext(), clang::Preprocessor::getBuiltinInfo(), clang::CompilerInstance::getDiagnosticClient(), clang::CompilerInstance::getDiagnostics(), clang::ASTContext::getExternalSource(), clang::CompilerInstance::getFileManager(), clang::ASTUnit::getFileManager(), clang::CompilerInstance::getFileSystemOpts(), clang::CompilerInstance::getFrontendOpts(), clang::Preprocessor::getIdentifierTable(), clang::CompilerInstance::getLangOpts(), clang::Preprocessor::getLangOpts(), clang::CompilerInstance::getPreprocessor(), clang::ASTUnit::getPreprocessor(), clang::CompilerInstance::getPreprocessorOpts(), clang::ASTUnit::getSourceManager(), clang::CompilerInstance::hasASTConsumer(), clang::CompilerInstance::hasASTContext(), hasASTFileSupport(), clang::CompilerInstance::hasFileManager(), hasIRSupport(), hasPCHSupport(), clang::CompilerInstance::hasSourceManager(), clang::IK_AST, clang::IK_LLVM_IR, clang::PreprocessorOptions::ImplicitPCHInclude, clang::Builtin::Context::InitializeBuiltins(), isCurrentFileAST(), clang::FrontendInputFile::Kind, clang::ASTUnit::LoadFromASTFile(), clang::FrontendOptions::OverrideRecordLayoutsFile, clang::CompilerInstance::setASTConsumer(), clang::CompilerInstance::setASTContext(), clang::ASTContext::setASTMutationListener(), setCompilerInstance(), setCurrentInput(), clang::ASTContext::setExternalSource(), clang::CompilerInstance::setFileManager(), clang::CompilerInstance::setPreprocessor(), clang::CompilerInstance::setSourceManager(), and usesPreprocessorOnly().
Referenced by clang::CompilerInstance::ExecuteAction(), and clang::ASTUnit::LoadFromCompilerInvocationAction().
| virtual bool clang::FrontendAction::BeginSourceFileAction | ( | CompilerInstance & | CI, |
| StringRef | Filename | ||
| ) | [inline, protected, virtual] |
BeginSourceFileAction - Callback at the start of processing a single input.
Reimplemented in clang::WrapperFrontendAction, clang::ASTMergeAction, clang::GenerateModuleAction, and clang::FixItAction.
Definition at line 74 of file FrontendAction.h.
Referenced by BeginSourceFile(), and clang::ASTMergeAction::BeginSourceFileAction().
| virtual ASTConsumer* clang::FrontendAction::CreateASTConsumer | ( | CompilerInstance & | CI, |
| StringRef | InFile | ||
| ) | [protected, pure virtual] |
CreateASTConsumer - Create the AST consumer object for this action, if supported.
This routine is called as part of
| CI | - The current compiler instance, provided as a convenience, |
| InFile | - The current input file, provided as a convenience, |
Implemented in clang::WrapperFrontendAction, clang::PreprocessorFrontendAction, clang::PluginASTAction, clang::PrintPreambleAction, clang::ASTMergeAction, clang::SyntaxOnlyAction, clang::GenerateModuleAction, clang::GeneratePCHAction, clang::arcmt::ObjCMigrateAction, clang::DeclContextPrintAction, clang::RewriteObjCAction, clang::ASTViewAction, clang::ASTDumpXMLAction, clang::ASTDumpAction, clang::ASTPrintAction, clang::arcmt::MigrateSourceAction, clang::CodeGenAction, clang::FixItAction, clang::HTMLPrintAction, and clang::ento::AnalysisAction.
Referenced by clang::ASTMergeAction::CreateASTConsumer().
| void FrontendAction::EndSourceFile | ( | ) |
EndSourceFile - Perform any per-file post processing, deallocate per-file objects, and run statistics and output file cleanup code.
Definition at line 338 of file FrontendAction.cpp.
References clang::CompilerInstance::clearOutputFiles(), clang::FrontendOptions::DisableFree, clang::Preprocessor::EndSourceFile(), clang::DiagnosticConsumer::EndSourceFile(), EndSourceFileAction(), getCompilerInstance(), getCurrentFile(), clang::CompilerInstance::getDiagnosticClient(), clang::CompilerInstance::getDiagnostics(), clang::CompilerInstance::getFrontendOpts(), clang::Preprocessor::getHeaderSearchInfo(), clang::Preprocessor::getIdentifierTable(), clang::CompilerInstance::getPreprocessor(), clang::CompilerInstance::getSourceManager(), clang::DiagnosticsEngine::hasErrorOccurred(), clang::CompilerInstance::hasPreprocessor(), isCurrentFileAST(), clang::IdentifierTable::PrintStats(), clang::HeaderSearch::PrintStats(), clang::Preprocessor::PrintStats(), clang::SourceManager::PrintStats(), clang::CompilerInstance::resetAndLeakASTContext(), clang::CompilerInstance::resetAndLeakFileManager(), clang::CompilerInstance::resetAndLeakPreprocessor(), clang::CompilerInstance::resetAndLeakSourceManager(), clang::CompilerInstance::setASTConsumer(), clang::CompilerInstance::setASTContext(), setCompilerInstance(), setCurrentInput(), clang::CompilerInstance::setSema(), clang::FrontendOptions::ShowStats, clang::CompilerInstance::takeASTConsumer(), and clang::CompilerInstance::takeSema().
Referenced by clang::CompilerInstance::ExecuteAction(), and clang::ASTUnit::LoadFromCompilerInvocationAction().
| virtual void clang::FrontendAction::EndSourceFileAction | ( | ) | [inline, protected, virtual] |
EndSourceFileAction - Callback at the end of processing a single input; this is guaranteed to only be called following a successful call to BeginSourceFileAction (and BeginSourceFile).
Reimplemented in clang::WrapperFrontendAction, clang::ASTMergeAction, clang::CodeGenAction, and clang::FixItAction.
Definition at line 89 of file FrontendAction.h.
Referenced by EndSourceFile(), and clang::ASTMergeAction::EndSourceFileAction().
| void FrontendAction::Execute | ( | ) |
Execute - Set the source managers main input file, and run the action.
Definition at line 318 of file FrontendAction.cpp.
References clang::SrcMgr::C_System, clang::SrcMgr::C_User, ExecuteAction(), getCompilerInstance(), getCurrentFile(), getCurrentInput(), clang::CompilerInstance::getFrontendTimer(), clang::CompilerInstance::hasFrontendTimer(), clang::CompilerInstance::InitializeSourceManager(), and isCurrentFileAST().
Referenced by clang::CompilerInstance::ExecuteAction(), and clang::ASTUnit::LoadFromCompilerInvocationAction().
| virtual void clang::FrontendAction::ExecuteAction | ( | ) | [protected, pure virtual] |
ExecuteAction - Callback to run the program action, using the initialized compiler instance.
This routine is guaranteed to only be called between
Implemented in clang::WrapperFrontendAction, clang::ASTFrontendAction, clang::PrintPreprocessedAction, clang::PreprocessOnlyAction, clang::GeneratePTHAction, clang::DumpTokensAction, clang::DumpRawTokensAction, clang::PrintPreambleAction, clang::ASTMergeAction, clang::RewriteTestAction, clang::RewriteMacrosAction, and clang::CodeGenAction.
Referenced by Execute(), and clang::ASTMergeAction::ExecuteAction().
| CompilerInstance& clang::FrontendAction::getCompilerInstance | ( | ) | const [inline] |
Definition at line 100 of file FrontendAction.h.
Referenced by clang::FixItAction::BeginSourceFileAction(), EndSourceFile(), clang::CodeGenAction::EndSourceFileAction(), Execute(), clang::CodeGenAction::ExecuteAction(), clang::RewriteMacrosAction::ExecuteAction(), clang::RewriteTestAction::ExecuteAction(), clang::ASTMergeAction::ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), clang::DumpRawTokensAction::ExecuteAction(), clang::DumpTokensAction::ExecuteAction(), clang::GeneratePTHAction::ExecuteAction(), clang::PreprocessOnlyAction::ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), and clang::ASTFrontendAction::ExecuteAction().
| ASTUnit& clang::FrontendAction::getCurrentASTUnit | ( | ) | const [inline] |
Definition at line 130 of file FrontendAction.h.
| const std::string& clang::FrontendAction::getCurrentFile | ( | ) | const [inline] |
Definition at line 120 of file FrontendAction.h.
References clang::FrontendInputFile::File.
Referenced by EndSourceFile(), Execute(), clang::CodeGenAction::ExecuteAction(), clang::RewriteMacrosAction::ExecuteAction(), clang::RewriteTestAction::ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), clang::GeneratePTHAction::ExecuteAction(), and clang::PrintPreprocessedAction::ExecuteAction().
| InputKind clang::FrontendAction::getCurrentFileKind | ( | ) | const [inline] |
Definition at line 125 of file FrontendAction.h.
References clang::FrontendInputFile::File, and clang::FrontendInputFile::Kind.
Referenced by clang::GenerateModuleAction::BeginSourceFileAction(), clang::CodeGenAction::ExecuteAction(), and clang::PrintPreambleAction::ExecuteAction().
| const FrontendInputFile& clang::FrontendAction::getCurrentInput | ( | ) | const [inline] |
Definition at line 116 of file FrontendAction.h.
Referenced by clang::arcmt::CheckAction::BeginInvocation(), clang::arcmt::ModifyAction::BeginInvocation(), clang::arcmt::MigrateAction::BeginInvocation(), clang::ASTMergeAction::BeginSourceFileAction(), clang::WrapperFrontendAction::BeginSourceFileAction(), and Execute().
| virtual TranslationUnitKind clang::FrontendAction::getTranslationUnitKind | ( | ) | [inline, virtual] |
For AST-based actions, the kind of translation unit we're handling.
Reimplemented in clang::WrapperFrontendAction, clang::ASTMergeAction, clang::GenerateModuleAction, and clang::GeneratePCHAction.
Definition at line 151 of file FrontendAction.h.
References clang::TU_Complete.
Referenced by clang::ASTFrontendAction::ExecuteAction(), clang::ASTMergeAction::getTranslationUnitKind(), and clang::ASTUnit::LoadFromCompilerInvocationAction().
| virtual bool clang::FrontendAction::hasASTFileSupport | ( | ) | const [inline, virtual] |
hasASTFileSupport - Does this action support use with AST files?
Reimplemented in clang::WrapperFrontendAction, clang::ASTMergeAction, clang::GenerateModuleAction, clang::GeneratePCHAction, and clang::FixItAction.
Definition at line 157 of file FrontendAction.h.
References usesPreprocessorOnly().
Referenced by BeginSourceFile(), and clang::ASTMergeAction::hasASTFileSupport().
| virtual bool clang::FrontendAction::hasCodeCompletionSupport | ( | ) | const [inline, virtual] |
hasCodeCompletionSupport - Does this action support use with code completion?
Reimplemented in clang::WrapperFrontendAction, clang::ASTMergeAction, and clang::SyntaxOnlyAction.
Definition at line 164 of file FrontendAction.h.
Referenced by clang::ASTFrontendAction::ExecuteAction(), and clang::ASTMergeAction::hasCodeCompletionSupport().
| virtual bool clang::FrontendAction::hasIRSupport | ( | ) | const [inline, virtual] |
hasIRSupport - Does this action support use with IR files?
Reimplemented in clang::WrapperFrontendAction, and clang::CodeGenAction.
Definition at line 160 of file FrontendAction.h.
Referenced by BeginSourceFile().
| virtual bool clang::FrontendAction::hasPCHSupport | ( | ) | const [inline, virtual] |
hasPCHSupport - Does this action support use with PCH?
Reimplemented in clang::WrapperFrontendAction, clang::PrintPreprocessedAction, and clang::ASTMergeAction.
Definition at line 154 of file FrontendAction.h.
References usesPreprocessorOnly().
Referenced by BeginSourceFile(), and clang::ASTMergeAction::hasPCHSupport().
| bool clang::FrontendAction::isCurrentFileAST | ( | ) | const [inline] |
Definition at line 111 of file FrontendAction.h.
References clang::FrontendInputFile::File.
Referenced by BeginSourceFile(), EndSourceFile(), and Execute().
| void clang::FrontendAction::setCompilerInstance | ( | CompilerInstance * | Value | ) | [inline] |
Definition at line 105 of file FrontendAction.h.
Referenced by BeginSourceFile(), clang::ASTMergeAction::BeginSourceFileAction(), and EndSourceFile().
| void FrontendAction::setCurrentInput | ( | const FrontendInputFile & | CurrentInput, |
| ASTUnit * | AST = 0 |
||
| ) |
Definition at line 119 of file FrontendAction.cpp.
Referenced by BeginSourceFile(), clang::GenerateModuleAction::BeginSourceFileAction(), clang::ASTMergeAction::BeginSourceFileAction(), and EndSourceFile().
| ASTUnit* clang::FrontendAction::takeCurrentASTUnit | ( | ) | [inline] |
Definition at line 135 of file FrontendAction.h.
Referenced by clang::ASTMergeAction::BeginSourceFileAction().
| virtual bool clang::FrontendAction::usesPreprocessorOnly | ( | ) | const [pure virtual] |
usesPreprocessorOnly - Does this action only use the preprocessor? If so no AST context will be created and this action will be invalid with AST file inputs.
Implemented in clang::WrapperFrontendAction, clang::PreprocessorFrontendAction, clang::ASTFrontendAction, clang::PrintPreambleAction, clang::ASTMergeAction, and clang::InitOnlyAction.
Referenced by BeginSourceFile(), hasASTFileSupport(), hasPCHSupport(), and clang::ASTMergeAction::usesPreprocessorOnly().
friend class ASTMergeAction [friend] |
Definition at line 33 of file FrontendAction.h.
friend class WrapperFrontendAction [friend] |
Definition at line 34 of file FrontendAction.h.