]> granicus.if.org Git - clang/commitdiff
DebugInfo: Forward HandleTagDeclRequiredDefinition through MultiplexConsumer to fix...
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 16 Jul 2014 23:52:46 +0000 (23:52 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 16 Jul 2014 23:52:46 +0000 (23:52 +0000)
When plugins are used the Multiplex(AST)Consumer is employed to dispatch
to both the plugin ASTConsumers and the IRGen ASTConsumer. It wasn't
dispatching a critical call for debug info, resulting in plugin users
having a negative debugging experience.

While I'm here, forward a bunch of other missing calls through the
consumer that seem like they should be there.

To test this, use the example plugin (requires plugins and examples) and
split the test case up so that the plugin testing can be done under that
requirement while the non-plugin testing will execute even in builds
that don't include plugin support or examples.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213213 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Frontend/MultiplexConsumer.h
lib/Frontend/MultiplexConsumer.cpp
test/CodeGenCXX/Inputs/debug-info-class-limited.cpp [moved from test/CodeGenCXX/debug-info-class-limited.cpp with 91% similarity]
test/CodeGenCXX/debug-info-class-limited-plugin.test [new file with mode: 0644]
test/CodeGenCXX/debug-info-class-limited.test [new file with mode: 0644]

index a7e0444885f1619ad1fe50e6523af4ebb93fe4bf..4d31104cce18dc18105143bf5dc123a23885a154 100644 (file)
@@ -40,8 +40,14 @@ public:
   void HandleInterestingDecl(DeclGroupRef D) override;
   void HandleTranslationUnit(ASTContext &Ctx) override;
   void HandleTagDeclDefinition(TagDecl *D) override;
+  void HandleTagDeclRequiredDefinition(const TagDecl *D) override;
   void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D) override;
   void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override;
+  void HandleImplicitImportDecl(ImportDecl *D) override;
+  void HandleLinkerOptionPragma(llvm::StringRef Opts) override;
+  void HandleDetectMismatch(llvm::StringRef Name,
+                            llvm::StringRef Value) override;
+  void HandleDependentLibrary(llvm::StringRef Lib) override;
   void CompleteTentativeDefinition(VarDecl *D) override;
   void HandleVTable(CXXRecordDecl *RD, bool DefinitionRequired) override;
   ASTMutationListener *GetASTMutationListener() override;
index 058cee8244b3e6c0f5f117f4b684a7716e35abbd..0e933a3f165f229b814a0e29636bbcc285736f30 100644 (file)
@@ -251,6 +251,11 @@ void MultiplexConsumer::HandleTagDeclDefinition(TagDecl *D) {
     Consumers[i]->HandleTagDeclDefinition(D);
 }
 
+void MultiplexConsumer::HandleTagDeclRequiredDefinition(const TagDecl *D) {
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleTagDeclRequiredDefinition(D);
+}
+
 void MultiplexConsumer::HandleCXXImplicitFunctionInstantiation(FunctionDecl *D){
   for (size_t i = 0, e = Consumers.size(); i != e; ++i)
     Consumers[i]->HandleCXXImplicitFunctionInstantiation(D);
@@ -261,6 +266,26 @@ void MultiplexConsumer::HandleTopLevelDeclInObjCContainer(DeclGroupRef D) {
     Consumers[i]->HandleTopLevelDeclInObjCContainer(D);
 }
 
+void MultiplexConsumer::HandleImplicitImportDecl(ImportDecl *D) {
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleImplicitImportDecl(D);
+}
+
+void MultiplexConsumer::HandleLinkerOptionPragma(llvm::StringRef Opts) {
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleLinkerOptionPragma(Opts);
+}
+
+void MultiplexConsumer::HandleDetectMismatch(llvm::StringRef Name, llvm::StringRef Value) {
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleDetectMismatch(Name, Value);
+}
+
+void MultiplexConsumer::HandleDependentLibrary(llvm::StringRef Lib) {
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleDependentLibrary(Lib);
+}
+
 void MultiplexConsumer::CompleteTentativeDefinition(VarDecl *D) {
   for (size_t i = 0, e = Consumers.size(); i != e; ++i)
     Consumers[i]->CompleteTentativeDefinition(D);
similarity index 91%
rename from test/CodeGenCXX/debug-info-class-limited.cpp
rename to test/CodeGenCXX/Inputs/debug-info-class-limited.cpp
index 92326f7b539b12d5749b3fd2358065f17bda4a2f..31a026101bb6671a3c1343189f63077282ce90eb 100644 (file)
@@ -1,4 +1,3 @@
-// RUN: %clang -emit-llvm -fno-standalone-debug -g -S %s -o - | FileCheck %s
 
 // CHECK-DAG: [ DW_TAG_structure_type ] [PR16214] [line [[@LINE+1]], {{.*}} [def]
 struct PR16214 {
diff --git a/test/CodeGenCXX/debug-info-class-limited-plugin.test b/test/CodeGenCXX/debug-info-class-limited-plugin.test
new file mode 100644 (file)
index 0000000..61d258d
--- /dev/null
@@ -0,0 +1,2 @@
+RUN: %clang_cc1 -emit-llvm -fno-standalone-debug -g -o - -load %llvmshlibdir/PrintFunctionNames%pluginext -add-plugin print-function-names %S/Inputs/debug-info-class-limited.cpp 2>&1 | FileCheck %S/Inputs/debug-info-class-limited.cpp
+REQUIRES: plugins, examples
diff --git a/test/CodeGenCXX/debug-info-class-limited.test b/test/CodeGenCXX/debug-info-class-limited.test
new file mode 100644 (file)
index 0000000..0b10728
--- /dev/null
@@ -0,0 +1 @@
+RUN: %clang_cc1 -emit-llvm -fno-standalone-debug -g %S/Inputs/debug-info-class-limited.cpp -o - | FileCheck %S/Inputs/debug-info-class-limited.cpp