[PATCH] Anonymous namespaces are missing import DW_TAG_imported_module.

Katya Romanova Katya_Romanova at playstation.sony.com
Mon Mar 23 01:47:28 PDT 2015


I re-implemented the fix in the FE, updated the test.


http://reviews.llvm.org/D7895

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-anon-namespace.cpp

Index: lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -3375,6 +3375,10 @@
   llvm::DINameSpace NS =
     DBuilder.createNameSpace(Context, NSDecl->getName(), FileD, LineNo);
   NameSpaceCache[NSDecl].reset(NS);
+  if (CGM.getTarget().getTriple().isPS4CPU() && NSDecl->isAnonymousNamespace()) { 
+    DBuilder.createImportedModule(
+      getContextDescriptor(dyn_cast<Decl>(NSDecl->getDeclContext())), NS, 0);
+  }
   return NS;
 }
 
Index: test/CodeGenCXX/debug-info-anon-namespace.cpp
===================================================================
--- test/CodeGenCXX/debug-info-anon-namespace.cpp
+++ test/CodeGenCXX/debug-info-anon-namespace.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-scei-ps4 -O0 %s -o - | FileCheck --check-prefix=PS4 %s
+// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-unknown-linux-gnu -O0 %s -o - | FileCheck --check-prefix=NON-PS4 %s
+
+namespace
+{
+  int a = 5;
+}
+int *b = &a;
+
+// PS4:  [[NS:![0-9]+]] = !MDNamespace
+// PS4: !MDImportedEntity(tag: DW_TAG_imported_module, scope: !0, entity: [[NS]])
+// NON-PS4-NOT: !MDImportedEntity 
+

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7895.22448.patch
Type: text/x-patch
Size: 1219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150323/5e9e2852/attachment.bin>


More information about the llvm-commits mailing list