[PATCH] D15881: [DWARF] Omitting the explicit import of an anonymous namespace is a debugger-tuning decision, not a target decision.

Paul Robinson via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 4 18:02:32 PST 2016


probinson created this revision.
probinson added reviewers: echristo, dblaikie, aprantl.
probinson added a subscriber: cfe-commits.

GDB and LLDB don't mind if we omit the explicit import of an anonymous namespace.


http://reviews.llvm.org/D15881

Files:
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGenCXX/debug-info-anon-namespace.cpp

Index: test/CodeGenCXX/debug-info-anon-namespace.cpp
===================================================================
--- test/CodeGenCXX/debug-info-anon-namespace.cpp
+++ test/CodeGenCXX/debug-info-anon-namespace.cpp
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-scei-ps4 -O0 %s -o - | FileCheck --check-prefix=PS4 %s
-// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-unknown-linux-gnu -O0 %s -o - | FileCheck --check-prefix=NON-PS4 %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited -debugger-tuning=gdb -O0 %s -o - | FileCheck --check-prefix=NOIMPORT %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited -debugger-tuning=lldb -O0 %s -o - | FileCheck --check-prefix=NOIMPORT %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited -debugger-tuning=sce -O0 %s -o - | FileCheck --check-prefix=IMPORT %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited -O0 %s -o - | FileCheck --check-prefix=IMPORT %s
 
 namespace
 {
@@ -18,9 +20,9 @@
 int *b2 = &a2;
 
 
-// PS4:  [[NS:![0-9]+]] = !DINamespace
-// PS4:  [[NS2:![0-9]+]] = !DINamespace
-// PS4: !DIImportedEntity(tag: DW_TAG_imported_module, scope: !0, entity: [[NS]])
-// PS4: !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[NS]], entity: [[NS2]], line: {{[0-9]+}})
-// NON-PS4-NOT: !DIImportedEntity
+// IMPORT:  [[NS:![0-9]+]] = !DINamespace
+// IMPORT:  [[NS2:![0-9]+]] = !DINamespace
+// IMPORT: !DIImportedEntity(tag: DW_TAG_imported_module, scope: !0, entity: [[NS]])
+// IMPORT: !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[NS]], entity: [[NS2]], line: {{[0-9]+}})
+// NOIMPORT-NOT: !DIImportedEntity
 
Index: lib/Frontend/CompilerInvocation.cpp
===================================================================
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -360,6 +360,14 @@
   }
 }
 
+// Convenience functions for debugger tuning.
+static bool tuneForGDB(CodeGenOptions &Opts) {
+  return Opts.getDebuggerTuning() == CodeGenOptions::DebuggerKindGDB;
+}
+static bool tuneForLLDB(CodeGenOptions &Opts) {
+  return Opts.getDebuggerTuning() == CodeGenOptions::DebuggerKindLLDB;
+}
+
 static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
                              DiagnosticsEngine &Diags,
                              const TargetOptions &TargetOpts) {
@@ -417,7 +425,7 @@
   Opts.EmitCodeView = Args.hasArg(OPT_gcodeview);
   Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);
   Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs);
-  Opts.DebugExplicitImport = Triple.isPS4CPU(); 
+  Opts.DebugExplicitImport = !tuneForGDB(Opts) && !tuneForLLDB(Opts);
 
   for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ))
     Opts.DebugPrefixMap.insert(StringRef(Arg).split('='));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15881.43953.patch
Type: text/x-patch
Size: 2957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160105/30bb3527/attachment.bin>


More information about the cfe-commits mailing list