summaryrefslogtreecommitdiff
path: root/include/clang/Frontend/FrontendAction.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Frontend/FrontendAction.h')
-rw-r--r--include/clang/Frontend/FrontendAction.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h
index c407ff80ac562..384499a3d82a7 100644
--- a/include/clang/Frontend/FrontendAction.h
+++ b/include/clang/Frontend/FrontendAction.h
@@ -130,7 +130,7 @@ public:
const FrontendInputFile &getCurrentInput() const {
return CurrentInput;
}
-
+
const StringRef getCurrentFile() const {
assert(!CurrentInput.isEmpty() && "No current file!");
return CurrentInput.getFile();
@@ -157,7 +157,7 @@ public:
/// @name Supported Modes
/// @{
- /// \brief Is this action invoked on a model file?
+ /// \brief 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
@@ -249,6 +249,19 @@ public:
/// CompilerInstance's Diagnostic object to report errors.
virtual bool ParseArgs(const CompilerInstance &CI,
const std::vector<std::string> &arg) = 0;
+
+ enum ActionType {
+ Cmdline, ///< Action is determined by the cc1 command-line
+ ReplaceAction, ///< Replace the main action
+ AddBeforeMainAction, ///< Execute the action before the main action
+ AddAfterMainAction ///< Execute the action after the main action
+ };
+ /// \brief Get the action type for this plugin
+ ///
+ /// \return The action type. If the type is Cmdline then by default the
+ /// plugin does nothing and what it does is determined by the cc1
+ /// command-line.
+ virtual ActionType getActionType() { return Cmdline; }
};
/// \brief Abstract base class to use for preprocessor-based frontend actions.
@@ -283,7 +296,7 @@ protected:
public:
/// Construct a WrapperFrontendAction from an existing action, taking
/// ownership of it.
- WrapperFrontendAction(FrontendAction *WrappedAction);
+ WrapperFrontendAction(std::unique_ptr<FrontendAction> WrappedAction);
bool usesPreprocessorOnly() const override;
TranslationUnitKind getTranslationUnitKind() override;