summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2018-05-17 09:21:07 +0000
committerIvan Donchevskii <ivan.donchevskii@qt.io>2018-05-17 09:21:07 +0000
commit270ef5b85c9c0898ef76fee3e4ba5e3e5cb46c29 (patch)
treefe5ec9a2e89672dc4bd4bd1f3cee111a7eb3a346 /clang/lib
parentf70d28b1f458c79aa70bcf85111c35442588d01e (diff)
downloadbcm5719-llvm-270ef5b85c9c0898ef76fee3e4ba5e3e5cb46c29.tar.gz
bcm5719-llvm-270ef5b85c9c0898ef76fee3e4ba5e3e5cb46c29.zip
[Frontend] Avoid running plugins during code completion parse
Second attempt. Proper line endings. 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. Patch by Nikolai Kosjar Differential Revision: https://reviews.llvm.org/D46050 llvm-svn: 332586
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index e4fb022c2a1..122dc23388c 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud