18 #ifndef LLVM_CLANG_FRONTEND_FRONTENDACTION_H 19 #define LLVM_CLANG_FRONTEND_FRONTENDACTION_H 26 #include "llvm/ADT/StringRef.h" 33 class CompilerInstance;
38 std::unique_ptr<ASTUnit> CurrentASTUnit;
65 StringRef InFile) = 0;
114 assert(Instance &&
"Compiler instance not registered!");
125 assert(!CurrentInput.
isEmpty() &&
"No current file!");
126 return (
bool)CurrentASTUnit;
134 assert(!CurrentInput.
isEmpty() &&
"No current file!");
139 assert(!CurrentInput.
isEmpty() &&
"No current file!");
144 assert(CurrentASTUnit &&
"No current AST unit!");
145 return *CurrentASTUnit;
151 return std::move(CurrentASTUnit);
155 std::unique_ptr<ASTUnit> AST =
nullptr);
240 virtual void anchor();
243 StringRef InFile)
override = 0;
252 const std::vector<std::string> &arg) = 0;
274 StringRef InFile)
override;
287 std::unique_ptr<FrontendAction> WrappedAction;
291 StringRef InFile)
override;
void EndSourceFile()
Perform any per-file post processing, deallocate per-file objects, and run statistics and output file...
virtual bool hasIRSupport() const
Does this action support use with IR files?
Abstract base class for actions which can be performed by the frontend.
std::unique_ptr< ASTUnit > takeCurrentASTUnit()
virtual bool usesPreprocessorOnly() const =0
Does this action only use the preprocessor?
virtual bool hasASTFileSupport() const
Does this action support use with AST files?
bool usesPreprocessorOnly() const override
Does this action only use the preprocessor?
virtual bool hasCodeCompletionSupport() const
Does this action support use with code completion?
Utility class for loading a ASTContext from an AST file.
bool BeginSourceFile(CompilerInstance &CI, const FrontendInputFile &Input)
Prepare the action for processing the input file Input.
Module * getCurrentModule() const
Describes a module or submodule.
Execute the action before the main action.
friend class WrapperFrontendAction
CompilerInstance & getCompilerInstance() const
Action is determined by the cc1 command-line.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
virtual ~FrontendAction()
virtual bool BeginInvocation(CompilerInstance &CI)
Callback before starting processing a single input, giving the opportunity to modify the CompilerInvo...
ASTUnit & getCurrentASTUnit() const
virtual bool shouldEraseOutputFiles()
Callback at the end of processing a single input, to determine if the output files should be erased o...
void setCurrentInput(const FrontendInputFile &CurrentInput, std::unique_ptr< ASTUnit > AST=nullptr)
Defines the clang::LangOptions interface.
virtual void EndSourceFileAction()
Callback at the end of processing a single input.
virtual std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile)=0
Create the AST consumer object for this action, if supported.
InputKind getCurrentFileKind() const
virtual void ExecuteAction()=0
Callback to run the program action, using the initialized compiler instance.
virtual bool hasPCHSupport() const
Does this action support use with PCH?
virtual ActionType getActionType()
Get the action type for this plugin.
Frontend action adaptor that merges ASTs together.
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
bool Execute()
Set the source manager's main input file, and run the action.
virtual TranslationUnitKind getTranslationUnitKind()
For AST-based actions, the kind of translation unit we're handling.
bool usesPreprocessorOnly() const override
Does this action only use the preprocessor?
Abstract base class to use for AST consumer-based frontend actions.
Abstract base class to use for preprocessor-based frontend actions.
Dataflow Directional Tag Classes.
const FrontendInputFile & getCurrentInput() const
A frontend action which simply wraps some other runtime-specified frontend action.
void setCompilerInstance(CompilerInstance *Value)
virtual bool BeginSourceFileAction(CompilerInstance &CI)
Callback at the start of processing a single input.
TranslationUnitKind
Describes the kind of translation unit being processed.
const StringRef getCurrentFile() const
The translation unit is a complete translation unit.
bool isCurrentFileAST() const
virtual bool isModelParsingAction() const
Is this action invoked on a model file?