This revision was automatically updated to reflect the committed changes. Closed by commit rL332469: [Frontend] Avoid running plugins during code completion parse (authored by yvvan, committed by ). Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D46050?vs=146999&id=147078#toc Repository: rL LLVM https://reviews.llvm.org/D46050 Files: cfe/trunk/lib/Frontend/FrontendAction.cpp cfe/trunk/test/Index/complete-and-plugins.c Index: cfe/trunk/test/Index/complete-and-plugins.c =================================================================== --- cfe/trunk/test/Index/complete-and-plugins.c +++ cfe/trunk/test/Index/complete-and-plugins.c @@ -0,0 +1,6 @@ +// RUN: c-index-test -code-completion-at=%s:7:1 -load %llvmshlibdir/PrintFunctionNames%pluginext -add-plugin print-fns %s | FileCheck %s +// REQUIRES: plugins, examples +// CHECK: macro definition:{{.*}} +// CHECK-NOT: top-level-decl: "x" + +void x(); Index: cfe/trunk/lib/Frontend/FrontendAction.cpp =================================================================== --- cfe/trunk/lib/Frontend/FrontendAction.cpp +++ cfe/trunk/lib/Frontend/FrontendAction.cpp @@ -150,12 +150,16 @@ return nullptr; // If there are no registered plugins we don't need to wrap the consumer - if (FrontendPluginRegistry::begin() == FrontendPluginRegistry::end()) - 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; + 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; std::vector<std::unique_ptr<ASTConsumer>> AfterConsumers; for (FrontendPluginRegistry::iterator it = FrontendPluginRegistry::begin(), ie = FrontendPluginRegistry::end();
Index: cfe/trunk/test/Index/complete-and-plugins.c =================================================================== --- cfe/trunk/test/Index/complete-and-plugins.c +++ cfe/trunk/test/Index/complete-and-plugins.c @@ -0,0 +1,6 @@ +// RUN: c-index-test -code-completion-at=%s:7:1 -load %llvmshlibdir/PrintFunctionNames%pluginext -add-plugin print-fns %s | FileCheck %s +// REQUIRES: plugins, examples +// CHECK: macro definition:{{.*}} +// CHECK-NOT: top-level-decl: "x" + +void x(); Index: cfe/trunk/lib/Frontend/FrontendAction.cpp =================================================================== --- cfe/trunk/lib/Frontend/FrontendAction.cpp +++ cfe/trunk/lib/Frontend/FrontendAction.cpp @@ -150,12 +150,16 @@ return nullptr; // If there are no registered plugins we don't need to wrap the consumer - if (FrontendPluginRegistry::begin() == FrontendPluginRegistry::end()) - 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; + 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; std::vector<std::unique_ptr<ASTConsumer>> AfterConsumers; for (FrontendPluginRegistry::iterator it = FrontendPluginRegistry::begin(), ie = FrontendPluginRegistry::end();
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits