clang 10.0.0git

Public Member Functions | Friends | List of all members
clang::FrontendAction Class Referenceabstract

Abstract base class for actions which can be performed by the frontend. More...

`#include "clang/Frontend/FrontendAction.h"`

Inheritance diagram for clang::FrontendAction:
[legend]

## 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
StringRef | getCurrentFile () const
StringRef | getCurrentFileOrBufferName () const
InputKind | getCurrentFileKind () const
ASTUnit & | getCurrentASTUnit () const
Module * | getCurrentModule () const
std::unique_ptr< ASTUnit > | takeCurrentASTUnit ()
void | setCurrentInput (const FrontendInputFile &CurrentInput, std::unique_ptr< ASTUnit > AST=nullptr)
Supported Modes
virtual bool | isModelParsingAction () const
| Is this action invoked on a model file? More...
virtual bool | usesPreprocessorOnly () const =0
| Does this action only use the preprocessor? More...
virtual TranslationUnitKind | getTranslationUnitKind ()
| For AST-based actions, the kind of translation unit we're handling. More...
virtual bool | hasPCHSupport () const
| Does this action support use with PCH? More...
virtual bool | hasASTFileSupport () const
| Does this action support use with AST files? More...
virtual bool | hasIRSupport () const
| Does this action support use with IR files? More...
virtual bool | hasCodeCompletionSupport () const
| Does this action support use with code completion? More...
Public Action Interface
bool | PrepareToExecute (CompilerInstance &CI)
| Prepare the action to execute on the given compiler instance. More...
bool | BeginSourceFile (CompilerInstance &CI, const FrontendInputFile &Input)
| Prepare the action for processing the input file `Input`. More...
llvm::Error | Execute ()
| Set the source manager's main input file, and run the action. More...
void | EndSourceFile ()
| Perform any per-file post processing, deallocate per-file objects, and run statistics and output file cleanup code. More...

## Protected Member Functions
Implementation Action Interface
virtual bool | PrepareToExecuteAction (CompilerInstance &CI)
| Prepare to execute the action on the given CompilerInstance. More...
virtual std::unique_ptr< ASTConsumer > | CreateASTConsumer (CompilerInstance &CI, StringRef InFile)=0
| Create the AST consumer object for this action, if supported. More...
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. More...
virtual bool | BeginSourceFileAction (CompilerInstance &CI)
| Callback at the start of processing a single input. More...
virtual void | ExecuteAction ()=0
| Callback to run the program action, using the initialized compiler instance. More...
virtual void | EndSourceFileAction ()
| Callback at the end of processing a single input. More...
virtual bool | shouldEraseOutputFiles ()
| Callback at the end of processing a single input, to determine if the output files should be erased or not. More...

## Friends
class | ASTMergeAction
class | WrapperFrontendAction

## Detailed Description

Abstract base class for actions which can be performed by the frontend.

Definition at line 36 of file FrontendAction.h.

## Constructor & Destructor Documentation

## ◆ FrontendAction()

FrontendAction::FrontendAction | ( |  | ) |

Definition at line 133 of file FrontendAction.cpp.

Referenced by EndSourceFileAction().

## ◆ ~FrontendAction()

FrontendAction::~FrontendAction | ( |  | ) |
| virtual

Definition at line 135 of file FrontendAction.cpp.

Referenced by EndSourceFileAction().

## Member Function Documentation

## ◆ BeginInvocation()

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.

Returns
  True on success; on failure BeginSourceFileAction(), ExecuteAction() and EndSourceFileAction() will not be called.

Reimplemented in clang::WrapperFrontendAction, clang::DumpModuleInfoAction, clang::arcmt::ObjCMigrateAction, clang::FixItRecompile, clang::arcmt::MigrateAction, clang::arcmt::MigrateSourceAction, clang::arcmt::ModifyAction, and clang::arcmt::CheckAction.

Definition at line 79 of file FrontendAction.h.

Referenced by BeginSourceFile(), clang::GenerateModuleAction::CreateASTConsumer(), and clang::FixItRecompile::FixItRecompile().

## ◆ BeginSourceFile()

bool FrontendAction::BeginSourceFile | ( | CompilerInstance & | CI,
|  | const FrontendInputFile & | Input
| ) |  |

Prepare the action for processing the input file `Input`.

This is run after the options and frontend have been initialized, but prior to executing any per-file processing.

Parameters

  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 BeginSourceFile() and EndSourceFile().

Returns
  True on success; on failure the compilation of this file should be aborted and neither Execute() nor EndSourceFile() should be called.

Definition at line 538 of file FrontendAction.cpp.

References BeginInvocation(), clang::DiagnosticConsumer::BeginSourceFile(), BeginSourceFileAction(), clang::CompilerInstance::createFileManager(), clang::CompilerInstance::createSourceManager(), clang::Preprocessor::getBuiltinInfo(), clang::CompilerInstance::getCodeGenOpts(), clang::CompilerInstance::getDiagnosticClient(), clang::CompilerInstance::getDiagnostics(), clang::FileManager::getDirectory(), clang::FrontendInputFile::getFile(), clang::FileManager::getFile(), clang::CompilerInstance::getFileManager(), clang::CompilerInstance::getFileSystemOpts(), clang::InputKind::getFormat(), clang::CompilerInstance::getFrontendOpts(), clang::CompilerInstance::getHeaderSearchOpts(), clang::Preprocessor::getIdentifierTable(), clang::FrontendInputFile::getKind(), clang::CompilerInstance::getLangOpts(), clang::Preprocessor::getLangOpts(), clang::InputKind::getLanguage(), clang::ASTReader::getModuleManager(), clang::FileEntry::getName(), clang::CompilerInstance::getPCHContainerReader(), clang::CompilerInstance::getPreprocessor(), clang::CompilerInstance::getPreprocessorOpts(), clang::serialization::ModuleManager::getPrimaryModule(), clang::CompilerInstance::getSourceManager(), clang::CompilerInstance::getSpecificModuleCachePath(), clang::CompilerInstance::hasASTConsumer(), hasASTFileSupport(), clang::CompilerInstance::hasFileManager(), hasIRSupport(), clang::CompilerInstance::hasSourceManager(), clang::PreprocessorOptions::ImplicitPCHInclude, clang::Builtin::Context::initializeBuiltins(), clang::SourceManager::initializeForReplay(), clang::CompilerInstance::InitializeSourceManager(), clang::FrontendInputFile::isEmpty(), clang::LLVM_IR, clang::ASTUnit::LoadEverything, clang::ASTUnit::LoadFromASTFile(), clang::ASTUnit::LoadPreprocessorOnly, clang::FrontendOptions::ModuleFiles, clang::InputKind::ModuleMap, clang::FrontendOptions::ModuleMapFiles, clang::FrontendOptions::ModulesEmbedAllFiles, clang::FrontendOptions::ModulesEmbedFiles, clang::InputKind::Precompiled, clang::Module::PresumedModuleMapFile, clang::DiagnosticsEngine::Report(), clang::SourceManager::setAllFilesAreTransient(), clang::CompilerInstance::setASTConsumer(), clang::CompilerInstance::setASTContext(), setCompilerInstance(), setCurrentInput(), clang::SourceManager::setFileIsTransient(), clang::CompilerInstance::setFileManager(), clang::CompilerInstance::setPreprocessor(), clang::CompilerInstance::setSourceManager(), usesPreprocessorOnly(), and clang::ASTReader::visitTopLevelModuleMaps().

Referenced by clang::ASTUnit::LoadFromCompilerInvocationAction(), and PrepareToExecute().

## ◆ BeginSourceFileAction()

virtual bool clang::FrontendAction::BeginSourceFileAction | ( | CompilerInstance & | CI | ) |
| inline protected virtual

Callback at the start of processing a single input.

Returns
  True on success; on failure ExecutionAction() and EndSourceFileAction() will not be called.

Reimplemented in clang::WrapperFrontendAction, clang::ASTMergeAction, clang::GeneratePCHAction, clang::RewriteIncludesAction, and clang::FixItAction.

Definition at line 85 of file FrontendAction.h.

References ExecuteAction().

Referenced by BeginSourceFile(), clang::GenerateModuleAction::CreateASTConsumer(), clang::GeneratePCHAction::hasASTFileSupport(), and clang::tooling::newFrontendActionFactory().

## ◆ CreateASTConsumer()

virtual std::unique_ptr<ASTConsumer> clang::FrontendAction::CreateASTConsumer | ( | CompilerInstance & | CI,
|  | StringRef | InFile
| ) |  |
| protected pure virtual

Create the AST consumer object for this action, if supported.

This routine is called as part of BeginSourceFile(), which will fail if the AST consumer cannot be created. This will not be called if the action has indicated that it only uses the preprocessor.

Parameters

  CI | - The current compiler instance, provided as a convenience, see getCompilerInstance().
  InFile | - The current input file, provided as a convenience, see getCurrentFile().

Returns
  The new AST consumer, or null on failure.

Implemented in clang::WrapperFrontendAction, clang::PreprocessorFrontendAction, clang::PluginASTAction, clang::PrintDependencyDirectivesSourceMinimizerAction, clang::PrintPreambleAction, clang::ASTMergeAction, clang::TemplightDumpAction, clang::VerifyPCHAction, clang::DumpModuleInfoAction, clang::SyntaxOnlyAction, clang::GenerateInterfaceIfsExpV1Action, clang::GenerateModuleAction, clang::GeneratePCHAction, clang::ASTViewAction, clang::arcmt::ObjCMigrateAction, clang::ASTDeclListAction, clang::CodeGenAction, clang::ASTDumpAction, clang::RewriteObjCAction, clang::ASTPrintAction, clang::ento::ParseModelFileAction, clang::arcmt::MigrateSourceAction, clang::FixItAction, clang::ento::AnalysisAction, and clang::HTMLPrintAction.

Referenced by getCurrentModule(), and PrepareToExecuteAction().

## ◆ EndSourceFile()

void FrontendAction::EndSourceFile | ( |  | ) |

Perform any per-file post processing, deallocate per-file objects, and run statistics and output file cleanup code.

Definition at line 958 of file FrontendAction.cpp.

References clang::CompilerInstance::clearOutputFiles(), clang::LangOptions::CMK_None, clang::FrontendOptions::DisableFree, clang::Preprocessor::EndSourceFile(), clang::DiagnosticConsumer::EndSourceFile(), EndSourceFileAction(), getCompilerInstance(), getCurrentFile(), clang::CompilerInstance::getDiagnosticClient(), clang::CompilerInstance::getFrontendOpts(), clang::Preprocessor::getHeaderSearchInfo(), clang::Preprocessor::getIdentifierTable(), clang::CompilerInstance::getLangOpts(), clang::CompilerInstance::getPreprocessor(), clang::CompilerInstance::getSourceManager(), clang::CompilerInstance::hasPreprocessor(), isCurrentFileAST(), clang::IdentifierTable::PrintStats(), clang::HeaderSearch::PrintStats(), clang::SourceManager::PrintStats(), clang::Preprocessor::PrintStats(), clang::CompilerInstance::resetAndLeakASTContext(), clang::CompilerInstance::resetAndLeakFileManager(), clang::CompilerInstance::resetAndLeakPreprocessor(), clang::CompilerInstance::resetAndLeakSema(), clang::CompilerInstance::resetAndLeakSourceManager(), clang::CompilerInstance::setASTConsumer(), clang::CompilerInstance::setASTContext(), setCompilerInstance(), setCurrentInput(), clang::CompilerInstance::setFileManager(), clang::CompilerInstance::setPreprocessor(), clang::CompilerInstance::setSema(), clang::CompilerInstance::setSourceManager(), shouldEraseOutputFiles(), clang::FrontendOptions::ShowStats, and clang::CompilerInstance::takeASTConsumer().

Referenced by clang::ASTUnit::LoadFromCompilerInvocationAction(), and PrepareToExecute().

## ◆ EndSourceFileAction()

virtual void clang::FrontendAction::EndSourceFileAction | ( |  | ) |
| inline protected virtual

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 100 of file FrontendAction.h.

References FrontendAction(), shouldEraseOutputFiles(), and ~FrontendAction().

Referenced by EndSourceFile(), and clang::tooling::newFrontendActionFactory().

## ◆ Execute()

llvm::Error FrontendAction::Execute | ( |  | ) |

Set the source manager's main input file, and run the action.

Definition at line 929 of file FrontendAction.cpp.

References clang::Error, ExecuteAction(), getCompilerInstance(), clang::CompilerInstance::getFileManager(), clang::CompilerInstance::getFrontendTimer(), clang::Preprocessor::getHeaderSearchInfo(), clang::HeaderSearch::getModuleCachePath(), clang::CompilerInstance::getPCHContainerReader(), clang::CompilerInstance::getPreprocessor(), clang::CompilerInstance::hasFileManager(), clang::CompilerInstance::hasFrontendTimer(), clang::CompilerInstance::hasPreprocessor(), clang::CompilerInstance::shouldBuildGlobalModuleIndex(), and clang::GlobalModuleIndex::writeIndex().

Referenced by clang::ASTUnit::LoadFromCompilerInvocationAction(), and PrepareToExecute().

## ◆ ExecuteAction()

virtual void clang::FrontendAction::ExecuteAction | ( |  | ) |
| protected pure virtual

Callback to run the program action, using the initialized compiler instance.

This is guaranteed to only be called between BeginSourceFileAction() and EndSourceFileAction().

Implemented in clang::WrapperFrontendAction, clang::PrintPreprocessedAction, clang::PreprocessOnlyAction, clang::DumpTokensAction, clang::DumpRawTokensAction, clang::PrintDependencyDirectivesSourceMinimizerAction, clang::ASTFrontendAction, clang::PrintPreambleAction, clang::ASTMergeAction, clang::TemplightDumpAction, clang::VerifyPCHAction, clang::DumpModuleInfoAction, clang::RewriteIncludesAction, clang::RewriteTestAction, clang::RewriteMacrosAction, and clang::CodeGenAction.

Referenced by BeginSourceFileAction(), and Execute().

## ◆ getCompilerInstance()

CompilerInstance& clang::FrontendAction::getCompilerInstance | ( |  | ) | const
| inline

Definition at line 119 of file FrontendAction.h.

Referenced by clang::FixItAction::BeginSourceFileAction(), EndSourceFile(), clang::CodeGenAction::EndSourceFileAction(), Execute(), clang::CodeGenAction::ExecuteAction(), clang::RewriteMacrosAction::ExecuteAction(), clang::RewriteTestAction::ExecuteAction(), clang::RewriteIncludesAction::ExecuteAction(), clang::DumpModuleInfoAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), clang::TemplightDumpAction::ExecuteAction(), clang::ASTMergeAction::ExecuteAction(), clang::PrintPreambleAction::ExecuteAction(), clang::ASTFrontendAction::ExecuteAction(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), clang::DumpRawTokensAction::ExecuteAction(), clang::DumpTokensAction::ExecuteAction(), clang::PreprocessOnlyAction::ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), getCurrentModule(), clang::GeneratePCHAction::shouldEraseOutputFiles(), and shouldEraseOutputFiles().

## ◆ getCurrentASTUnit()

ASTUnit& clang::FrontendAction::getCurrentASTUnit | ( |  | ) | const
| inline

Definition at line 156 of file FrontendAction.h.

References getCurrentModule().

## ◆ getCurrentFile()

StringRef clang::FrontendAction::getCurrentFile | ( |  | ) | const
| inline

Definition at line 139 of file FrontendAction.h.

References clang::FrontendInputFile::getFile(), and clang::FrontendInputFile::isEmpty().

Referenced by EndSourceFile(), clang::CodeGenAction::ExecuteAction(), clang::DumpModuleInfoAction::ExecuteAction(), clang::VerifyPCHAction::ExecuteAction(), and clang::PrintPreambleAction::ExecuteAction().

## ◆ getCurrentFileKind()

InputKind clang::FrontendAction::getCurrentFileKind | ( |  | ) | const
| inline

Definition at line 151 of file FrontendAction.h.

References clang::FrontendInputFile::getKind(), and clang::FrontendInputFile::isEmpty().

Referenced by clang::CodeGenAction::ExecuteAction(), and clang::PrintPreambleAction::ExecuteAction().

## ◆ getCurrentFileOrBufferName()

StringRef clang::FrontendAction::getCurrentFileOrBufferName | ( |  | ) | const
| inline

Definition at line 144 of file FrontendAction.h.

References clang::FrontendInputFile::getBuffer(), clang::FrontendInputFile::getFile(), clang::FrontendInputFile::isEmpty(), and clang::FrontendInputFile::isFile().

Referenced by clang::RewriteIncludesAction::BeginSourceFileAction(), clang::RewriteMacrosAction::ExecuteAction(), clang::RewriteTestAction::ExecuteAction(), and clang::PrintPreprocessedAction::ExecuteAction().

## ◆ getCurrentInput()

const FrontendInputFile& clang::FrontendAction::getCurrentInput | ( |  | ) | const
| inline

Definition at line 135 of file FrontendAction.h.

Referenced by clang::arcmt::CheckAction::BeginInvocation(), clang::arcmt::ModifyAction::BeginInvocation(), clang::arcmt::MigrateAction::BeginInvocation(), clang::RewriteIncludesAction::BeginSourceFileAction(), clang::ASTMergeAction::BeginSourceFileAction(), clang::WrapperFrontendAction::BeginSourceFileAction(), and clang::PrintPreprocessedAction::ExecuteAction().

## ◆ getCurrentModule()

Module * FrontendAction::getCurrentModule | ( |  | ) | const

Definition at line 143 of file FrontendAction.cpp.

References clang::PluginASTAction::AddAfterMainAction, clang::PluginASTAction::AddBeforeMainAction, clang::FrontendOptions::AddPluginActions, clang::C, clang::PluginASTAction::Cmdline, CreateASTConsumer(), clang::LangOptions::CurrentModule, getCompilerInstance(), clang::CompilerInstance::getDiagnostics(), clang::CompilerInstance::getFrontendOpts(), clang::Preprocessor::getHeaderSearchInfo(), clang::CompilerInstance::getLangOpts(), clang::CompilerInstance::getPreprocessor(), clang::CompilerInstance::hasCodeCompletionConsumer(), clang::HeaderSearch::lookupModule(), P, clang::FrontendOptions::PluginArgs, and clang::DiagnosticsEngine::Report().

Referenced by clang::RewriteIncludesAction::BeginSourceFileAction(), clang::PrintPreprocessedAction::ExecuteAction(), and getCurrentASTUnit().

## ◆ getTranslationUnitKind()

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::GenerateInterfaceStubAction, clang::GenerateModuleAction, and clang::GeneratePCHAction.

Definition at line 188 of file FrontendAction.h.

References clang::TU_Complete.

Referenced by clang::ASTFrontendAction::ExecuteAction(), and clang::ASTUnit::LoadFromCompilerInvocationAction().

## ◆ hasASTFileSupport()

virtual bool clang::FrontendAction::hasASTFileSupport | ( |  | ) | const
| inline virtual

Does this action support use with AST files?

Reimplemented in clang::WrapperFrontendAction, clang::ASTMergeAction, clang::DumpModuleInfoAction, clang::GenerateInterfaceStubAction, clang::GenerateModuleAction, clang::GeneratePCHAction, and clang::FixItAction.

Definition at line 194 of file FrontendAction.h.

Referenced by BeginSourceFile().

## ◆ hasCodeCompletionSupport()

virtual bool clang::FrontendAction::hasCodeCompletionSupport | ( |  | ) | const
| inline virtual

Does this action support use with code completion?

Reimplemented in clang::WrapperFrontendAction, clang::ASTMergeAction, clang::VerifyPCHAction, clang::DumpModuleInfoAction, and clang::SyntaxOnlyAction.

Definition at line 200 of file FrontendAction.h.

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

## ◆ hasIRSupport()

virtual bool clang::FrontendAction::hasIRSupport | ( |  | ) | const
| inline virtual

Does this action support use with IR files?

Reimplemented in clang::WrapperFrontendAction, clang::DumpModuleInfoAction, and clang::CodeGenAction.

Definition at line 197 of file FrontendAction.h.

Referenced by BeginSourceFile().

## ◆ hasPCHSupport()

virtual bool clang::FrontendAction::hasPCHSupport | ( |  | ) | const
| inline virtual

Does this action support use with PCH?

Reimplemented in clang::WrapperFrontendAction, clang::PrintPreprocessedAction, clang::ASTMergeAction, and clang::DumpModuleInfoAction.

Definition at line 191 of file FrontendAction.h.

## ◆ isCurrentFileAST()

bool clang::FrontendAction::isCurrentFileAST | ( |  | ) | const
| inline

Definition at line 130 of file FrontendAction.h.

References clang::FrontendInputFile::isEmpty().

Referenced by EndSourceFile().

## ◆ isModelParsingAction()

virtual bool clang::FrontendAction::isModelParsingAction | ( |  | ) | const
| inline virtual

Is this action invoked on a model file?

Model files are incomplete translation units that relies on type information from another translation unit. Check ParseModelFileAction for details.

Reimplemented in clang::ento::ParseModelFileAction.

Definition at line 179 of file FrontendAction.h.

References usesPreprocessorOnly().

## ◆ PrepareToExecute()

bool clang::FrontendAction::PrepareToExecute | ( | CompilerInstance & | CI | ) |
| inline

Prepare the action to execute on the given compiler instance.

Definition at line 207 of file FrontendAction.h.

References BeginSourceFile(), EndSourceFile(), clang::Error, Execute(), and PrepareToExecuteAction().

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

## ◆ PrepareToExecuteAction()

virtual bool clang::FrontendAction::PrepareToExecuteAction | ( | CompilerInstance & | CI | ) |
| inline protected virtual

Prepare to execute the action on the given CompilerInstance.

This is called before executing the action on any inputs, and can modify the configuration as needed (including adjusting the input list).

Reimplemented in clang::WrapperFrontendAction.

Definition at line 55 of file FrontendAction.h.

References CreateASTConsumer().

Referenced by clang::GenerateModuleAction::CreateASTConsumer(), and PrepareToExecute().

## ◆ setCompilerInstance()

void clang::FrontendAction::setCompilerInstance | ( | CompilerInstance * | Value | ) |
| inline

Definition at line 124 of file FrontendAction.h.

Referenced by BeginSourceFile(), and EndSourceFile().

## ◆ setCurrentInput()

void FrontendAction::setCurrentInput | ( | const FrontendInputFile & | CurrentInput,
|  | std::unique_ptr< ASTUnit > | AST = `nullptr`
| ) |  |

Definition at line 137 of file FrontendAction.cpp.

Referenced by BeginSourceFile(), clang::WrapperFrontendAction::BeginSourceFileAction(), EndSourceFile(), and takeCurrentASTUnit().

## ◆ shouldEraseOutputFiles()

bool FrontendAction::shouldEraseOutputFiles | ( |  | ) |
| protected virtual

Callback at the end of processing a single input, to determine if the output files should be erased or not.

By default it returns true if a compiler error occurred. This is guaranteed to only be called following a successful call to BeginSourceFileAction (and BeginSourceFile).

Reimplemented in clang::GeneratePCHAction.

Definition at line 1016 of file FrontendAction.cpp.

References getCompilerInstance(), clang::CompilerInstance::getDiagnostics(), and clang::DiagnosticsEngine::hasErrorOccurred().

Referenced by EndSourceFile(), EndSourceFileAction(), clang::GeneratePCHAction::hasASTFileSupport(), and clang::GeneratePCHAction::shouldEraseOutputFiles().

## ◆ takeCurrentASTUnit()

std::unique_ptr<ASTUnit> clang::FrontendAction::takeCurrentASTUnit | ( |  | ) |
| inline

Definition at line 163 of file FrontendAction.h.

References setCurrentInput().

Referenced by clang::ASTMergeAction::BeginSourceFileAction().

## ◆ usesPreprocessorOnly()

virtual bool clang::FrontendAction::usesPreprocessorOnly | ( |  | ) | const
| pure virtual

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::PrintDependencyDirectivesSourceMinimizerAction, clang::ASTFrontendAction, clang::PrintPreambleAction, clang::ASTMergeAction, clang::DumpCompilerOptionsAction, and clang::InitOnlyAction.

Referenced by BeginSourceFile(), and isModelParsingAction().

## Friends And Related Function Documentation

## ◆ ASTMergeAction

friend class ASTMergeAction
| friend

Definition at line 40 of file FrontendAction.h.

## ◆ WrapperFrontendAction

friend class WrapperFrontendAction
| friend

Definition at line 41 of file FrontendAction.h.

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

- include/clang/Frontend/FrontendAction.h
- lib/Frontend/FrontendAction.cpp