From fe66433fe119819a033827610f7eae4cdd8b1470 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Tue, 19 Oct 2021 14:50:44 -0700 Subject: [clang] Add plugin ActionType to run command line plugin before main action Currently we have a way to run a plugin if specified on the command line after the main action, and ways to unconditionally run the plugin before or after the main action, but no way to run a plugin if specified on the command line before the main action. This introduces the missing option. This is helpful because -clear-ast-before-backend clears the AST before codegen, while some plugins may want access to the AST. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D112096 --- clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp') diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index dc8409f..8e18f33 100644 --- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -79,7 +79,7 @@ CreateFrontendBaseAction(CompilerInstance &CI) { if (Plugin.getName() == CI.getFrontendOpts().ActionName) { std::unique_ptr P(Plugin.instantiate()); if ((P->getActionType() != PluginASTAction::ReplaceAction && - P->getActionType() != PluginASTAction::Cmdline) || + P->getActionType() != PluginASTAction::CmdlineAfterMainAction) || !P->ParseArgs( CI, CI.getFrontendOpts().PluginArgs[std::string(Plugin.getName())])) -- cgit v1.1