r213213 - DebugInfo: Forward HandleTagDeclRequiredDefinition through MultiplexConsumer to fix debug info emission in the presence of plugins.

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Wed May 25 10:28:40 PDT 2016


Zombie review comment: ".test" isn't part of test/lit.cfg::config.suffixes,
so the two .test files added in this change never run unless you explicitly
run them (e.g. with `bin/llvm-lit
../llvm-rw/tools/clang/test/CodeGenCXX/*.test`).
CodeGenCXX/debug-info-class-limited.test fails when I run it like that.

(resending with cfe-commits address changed to new address)

On Wed, Jul 16, 2014 at 7:52 PM, David Blaikie <dblaikie at gmail.com> wrote:

> Author: dblaikie
> Date: Wed Jul 16 18:52:46 2014
> New Revision: 213213
>
> URL: http://llvm.org/viewvc/llvm-project?rev=213213&view=rev
> Log:
> DebugInfo: Forward HandleTagDeclRequiredDefinition through
> MultiplexConsumer to fix debug info emission in the presence of plugins.
>
> 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.
>
> Added:
>     cfe/trunk/test/CodeGenCXX/Inputs/debug-info-class-limited.cpp
>       - copied, changed from r213212,
> cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp
>     cfe/trunk/test/CodeGenCXX/debug-info-class-limited-plugin.test
>     cfe/trunk/test/CodeGenCXX/debug-info-class-limited.test
> Removed:
>     cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp
> Modified:
>     cfe/trunk/include/clang/Frontend/MultiplexConsumer.h
>     cfe/trunk/lib/Frontend/MultiplexConsumer.cpp
>
> Modified: cfe/trunk/include/clang/Frontend/MultiplexConsumer.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/MultiplexConsumer.h?rev=213213&r1=213212&r2=213213&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Frontend/MultiplexConsumer.h (original)
> +++ cfe/trunk/include/clang/Frontend/MultiplexConsumer.h Wed Jul 16
> 18:52:46 2014
> @@ -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;
>
> Modified: cfe/trunk/lib/Frontend/MultiplexConsumer.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/MultiplexConsumer.cpp?rev=213213&r1=213212&r2=213213&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Frontend/MultiplexConsumer.cpp (original)
> +++ cfe/trunk/lib/Frontend/MultiplexConsumer.cpp Wed Jul 16 18:52:46 2014
> @@ -251,6 +251,11 @@ void MultiplexConsumer::HandleTagDeclDef
>      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::HandleTopLevelDe
>      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);
>
> Copied: cfe/trunk/test/CodeGenCXX/Inputs/debug-info-class-limited.cpp
> (from r213212, cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp)
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/Inputs/debug-info-class-limited.cpp?p2=cfe/trunk/test/CodeGenCXX/Inputs/debug-info-class-limited.cpp&p1=cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp&r1=213212&r2=213213&rev=213213&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/Inputs/debug-info-class-limited.cpp Wed Jul
> 16 18:52:46 2014
> @@ -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 {
>
> Added: cfe/trunk/test/CodeGenCXX/debug-info-class-limited-plugin.test
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class-limited-plugin.test?rev=213213&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/debug-info-class-limited-plugin.test (added)
> +++ cfe/trunk/test/CodeGenCXX/debug-info-class-limited-plugin.test Wed Jul
> 16 18:52:46 2014
> @@ -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
>
> Removed: cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp?rev=213212&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp (removed)
> @@ -1,50 +0,0 @@
> -// 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 {
> -  int i;
> -};
> -
> -typedef PR16214 bar;
> -
> -bar *a;
> -bar b;
> -
> -namespace PR14467 {
> -// CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}}
> [def]
> -struct foo {
> -};
> -
> -foo *bar(foo *a) {
> -  foo *b = new foo(*a);
> -  return b;
> -}
> -}
> -
> -namespace test1 {
> -// CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}}
> [def]
> -struct foo {
> -};
> -
> -extern int bar(foo *a);
> -int baz(foo *a) {
> -  return bar(a);
> -}
> -}
> -
> -namespace test2 {
> -// FIXME: if we were a bit fancier, we could realize that the 'foo' type
> is only
> -// required because of the 'bar' type which is not required at all (or
> might
> -// only be required to be declared)
> -// CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}}
> [def]
> -struct foo {
> -};
> -
> -struct bar {
> -  foo f;
> -};
> -
> -void func() {
> -  foo *f;
> -}
> -}
>
> Added: cfe/trunk/test/CodeGenCXX/debug-info-class-limited.test
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class-limited.test?rev=213213&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/debug-info-class-limited.test (added)
> +++ cfe/trunk/test/CodeGenCXX/debug-info-class-limited.test Wed Jul 16
> 18:52:46 2014
> @@ -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
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160525/dd2a4acf/attachment-0001.html>


More information about the cfe-commits mailing list