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.

llvm-svn: 213213

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

index a7e0444..4d31104 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 058cee8..0e933a3 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);
@@ -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/clang/test/CodeGenCXX/debug-info-class-limited-plugin.test b/clang/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/clang/test/CodeGenCXX/debug-info-class-limited.test b/clang/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