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())\r
+ return Consumer;\r
+\r
+ // If this is a code completion run, avoid invoking the plugin consumers\r
+ if (CI.hasCodeCompletionConsumer())\r
+ return Consumer;\r
+\r
+ // Collect the list of plugins that go before the main action (in Consumers)\r
+ // or after it (in AfterConsumers)\r
+ std::vector<std::unique_ptr<ASTConsumer>> Consumers;\r
std::vector<std::unique_ptr<ASTConsumer>> AfterConsumers;
for (FrontendPluginRegistry::iterator it = FrontendPluginRegistry::begin(),
ie = FrontendPluginRegistry::end();
--- /dev/null
+// RUN: c-index-test -code-completion-at=%s:7:1 -load %llvmshlibdir/PrintFunctionNames%pluginext -add-plugin print-fns %s | FileCheck %s\r
+// REQUIRES: plugins, examples\r
+// CHECK: macro definition:{{.*}}\r
+// CHECK-NOT: top-level-decl: "x"\r
+\r
+void x();\r