summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2018-05-16 15:08:41 +0200
committerNikolai Kosjar <nikolai.kosjar@qt.io>2018-05-17 07:08:52 +0000
commit0e790628055f8e1edbc4a1176e3cc064cf544a2b (patch)
tree05b34da43ec87e0449c6087516e3bcc4421bdd22 /lib
parent7f349701d3ea0c47be3a43e265699dddd3fd55cf (diff)
[backported/clang-7][Frontend] Avoid running plugins during code completion parse
-------------------------------------------------------------------------- * https://reviews.llvm.org/D46050 * Fixes slow completion if tidy/clazy checks are activated. -------------------------------------------------------------------------- The parsing that is done for code completion is a special case that will discard any generated diagnostics, so avoid running plugins for this case in the first place to avoid performance penalties due to the plugins. A scenario for this is for example libclang with extra plugins like tidy. Change-Id: Ibd325f234823e4650553d2a9a3c20d993d57c87d Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'lib')
-rw-r--r--lib/Frontend/FrontendAction.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp
index 12226b2314..6c95f88bfc 100644
--- a/lib/Frontend/FrontendAction.cpp
+++ b/lib/Frontend/FrontendAction.cpp
@@ -153,6 +153,10 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
if (FrontendPluginRegistry::begin() == FrontendPluginRegistry::end())
return Consumer;
+ // If this is a code completion run, avoid invoking the plugin consumers
+ if (CI.hasCodeCompletionConsumer())
+ return Consumer;
+
// Collect the list of plugins that go before the main action (in Consumers)
// or after it (in AfterConsumers)
std::vector<std::unique_ptr<ASTConsumer>> Consumers;