r268460 - [modules][debuginfo] Only include imported modules when targeting LLDB

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 16:06:41 PDT 2016


Author: dblaikie
Date: Tue May  3 18:06:40 2016
New Revision: 268460

URL: http://llvm.org/viewvc/llvm-project?rev=268460&view=rev
Log:
[modules][debuginfo] Only include imported modules when targeting LLDB

These constructs are only applicable to a debugger capable of loading a
Clang AST, so omit them for brevity when not doing so.

We could potentially propagate more of CodeGenOptions through the
ObjectFilePCGContainerOperations for consistency (so the next person who
adds some CodeGenOpts feature that tweaks debug info output doesn't get
caught by this), so I'm open to objections/alternatives there, but went
with this for now.

Tested just a couple of basic cases (one direct, one indirect (through
the ObjectFilePCHContainerOperations) & fixed up other cases to pass the
-debugger-tuning flag as appropriate.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
    cfe/trunk/test/Modules/DebugInfoSubmoduleImport.c
    cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
    cfe/trunk/test/Modules/debug-info-moduleimport.m
    cfe/trunk/test/Modules/getSourceDescriptor-crash.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=268460&r1=268459&r2=268460&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue May  3 18:06:40 2016
@@ -3505,6 +3505,8 @@ void CGDebugInfo::EmitUsingDecl(const Us
 }
 
 void CGDebugInfo::EmitImportDecl(const ImportDecl &ID) {
+  if (CGM.getCodeGenOpts().getDebuggerTuning() != llvm::DebuggerKind::LLDB)
+    return;
   if (Module *M = ID.getImportedModule()) {
     auto Info = ExternalASTSource::ASTSourceDescriptor(*M);
     DBuilder.createImportedDeclaration(

Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=268460&r1=268459&r2=268460&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
+++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Tue May  3 18:06:40 2016
@@ -152,6 +152,7 @@ public:
     CodeGenOpts.ThreadModel = "single";
     CodeGenOpts.DebugTypeExtRefs = true;
     CodeGenOpts.setDebugInfo(codegenoptions::FullDebugInfo);
+    CodeGenOpts.setDebuggerTuning(CI.getCodeGenOpts().getDebuggerTuning());
   }
 
   ~PCHContainerGenerator() override = default;

Modified: cfe/trunk/test/Modules/DebugInfoSubmoduleImport.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoSubmoduleImport.c?rev=268460&r1=268459&r2=268460&view=diff
==============================================================================
--- cfe/trunk/test/Modules/DebugInfoSubmoduleImport.c (original)
+++ cfe/trunk/test/Modules/DebugInfoSubmoduleImport.c Tue May  3 18:06:40 2016
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited -dwarf-ext-refs \
 // RUN:     -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \
-// RUN:     %s -emit-llvm -o - | FileCheck %s
+// RUN:     %s -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s
 #include "DebugSubmoduleA.h"
 #include "DebugSubmoduleB.h"
 

Modified: cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoTransitiveImport.m?rev=268460&r1=268459&r2=268460&view=diff
==============================================================================
--- cfe/trunk/test/Modules/DebugInfoTransitiveImport.m (original)
+++ cfe/trunk/test/Modules/DebugInfoTransitiveImport.m Tue May  3 18:06:40 2016
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited -dwarf-ext-refs \
 // RUN:     -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs \
-// RUN:     %s -mllvm -debug-only=pchcontainer 2>&1 | FileCheck %s
+// RUN:     %s -mllvm -debug-only=pchcontainer -debugger-tuning=lldb 2>&1 | FileCheck %s
 // REQUIRES: asserts
 
 @import diamond_left;
@@ -20,3 +20,9 @@
 // Skeleton for top:
 // CHECK: !DICompileUnit({{.*}}splitDebugFilename: {{.*}}diamond_top{{.*}}dwoId:
 
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited -dwarf-ext-refs \
+// RUN:     -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs \
+// RUN:     %s -mllvm -debug-only=pchcontainer 2>&1 | FileCheck %s --check-prefix=NOIMPORT
+
+// NOIMPORT-NOT: !DIImportedEntity

Modified: cfe/trunk/test/Modules/debug-info-moduleimport.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/debug-info-moduleimport.m?rev=268460&r1=268459&r2=268460&view=diff
==============================================================================
--- cfe/trunk/test/Modules/debug-info-moduleimport.m (original)
+++ cfe/trunk/test/Modules/debug-info-moduleimport.m Tue May  3 18:06:40 2016
@@ -1,10 +1,16 @@
 // RUN: rm -rf %t
-// RUN: %clang_cc1 -debug-info-kind=limited -fmodules -DGREETING="Hello World" -UNDEBUG -fimplicit-module-maps -fmodules-cache-path=%t %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=limited -fmodules -DGREETING="Hello World" -UNDEBUG -fimplicit-module-maps -fmodules-cache-path=%t %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -o - | FileCheck %s --check-prefix=NOIMPORT
+
+// NOIMPORT-NOT: !DIImportedEntity
+// NOIMPORT-NOT: !DIModule
+
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -debug-info-kind=limited -fmodules -DGREETING="Hello World" -UNDEBUG -fimplicit-module-maps -fmodules-cache-path=%t %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s
 
 // CHECK: ![[CU:.*]] = distinct !DICompileUnit
 @import DebugObjC;
 // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: ![[CU]],
-// CHECK-SAME:              entity: ![[MODULE:.*]], line: 5)
+// CHECK-SAME:              entity: ![[MODULE:.*]], line: [[@LINE-2]])
 // CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugObjC",
 // CHECK-SAME:  configMacros: "\22-DGREETING=Hello World\22 \22-UNDEBUG\22",
 // CHECK-SAME:  includePath: "{{.*}}test{{.*}}Modules{{.*}}Inputs",

Modified: cfe/trunk/test/Modules/getSourceDescriptor-crash.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/getSourceDescriptor-crash.cpp?rev=268460&r1=268459&r2=268460&view=diff
==============================================================================
--- cfe/trunk/test/Modules/getSourceDescriptor-crash.cpp (original)
+++ cfe/trunk/test/Modules/getSourceDescriptor-crash.cpp Tue May  3 18:06:40 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -I %S/Inputs/getSourceDescriptor-crash -S -emit-llvm -debug-info-kind=limited -fimplicit-module-maps %s -o - | FileCheck %s
+// RUN: %clang_cc1 -I %S/Inputs/getSourceDescriptor-crash -S -emit-llvm -debug-info-kind=limited -debugger-tuning=lldb -fimplicit-module-maps %s -o - | FileCheck %s
 
 #include "h1.h"
 #include "h1.h"




More information about the cfe-commits mailing list