<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 18, 2015 at 1:13 AM, Katya Romanova <span dir="ltr"><<a href="mailto:Katya_Romanova@playstation.sony.com" target="_blank">Katya_Romanova@playstation.sony.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Added PS4 flag (as David requested).<br>
Modified the tests accordingly.<br>
<br>
<br>
<a href="http://reviews.llvm.org/D7895" target="_blank">http://reviews.llvm.org/D7895</a><br>
<br>
Files:<br>
  lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
<span class="">  test/DebugInfo/anonymous-namespace.ll<br>
<br>
Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
===================================================================<br>
--- lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
+++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
</span>@@ -1231,6 +1231,14 @@<br>
<span class="">     Name = "(anonymous namespace)";<br>
   DD->addAccelNamespace(Name, NDie);<br>
   addGlobalName(Name, NDie, NS.getContext());<br>
</span>+  if (Triple(Asm->getTargetTriple()).isPS4() && !Name.empty()) {<br>
<span class="">+    // For anonymous namespaces, add a DW_TAG_imported_module tag<br>
+    // containing a DW_AT_import attribute with the reference to this<br>
+    // namespace entry.<br>
+    DIE &IDie = createAndAddDIE(dwarf::DW_TAG_imported_module, *ContextDIE);<br>
+    addDIEEntry(IDie, dwarf::DW_AT_import, NDie);<br>
+    addFlag(IDie, dwarf::DW_AT_artificial);<br>
</span><span class="">+  }<br>
   addSourceLine(NDie, NS);<br>
   return &NDie;<br>
 }<br>
</span><span class="">Index: test/DebugInfo/anonymous-namespace.ll<br>
===================================================================<br>
--- test/DebugInfo/anonymous-namespace.ll<br>
+++ test/DebugInfo/anonymous-namespace.ll<br>
</span>@@ -0,0 +1,36 @@<br>
+; RUN: %llc_dwarf -mtriple=x86_64-scei-ps4 -O0 -filetype=obj %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s<br></blockquote><div><br>You could add another run line here with a different triple (oh, you'll need to put this in the x86 subdirectory, since it requires the x86 target to be built for this test to run, btw) to test the negative case - ensuring that the imported module is not emitted for that non-ps4 triple.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="">+; If the namespace is anonymous, add a DW_TAG_imported_module tag<br>
+; containing DW_AT_import attribute with the reference to this namespace<br>
+; entry.<br>
+<br>
+; namespace<br>
+; {<br>
+;   int a = 5;<br>
+; }<br>
+; int *b = &a;<br>
+<br>
+; ModuleID = 'anon.cpp'<br>
+<br>
+@_ZN12_GLOBAL__N_11aE = internal global i32 5, align 4<br>
+@b = global i32* @_ZN12_GLOBAL__N_11aE, align 8<br>
+<br>
+!<a href="http://llvm.dbg.cu" target="_blank">llvm.dbg.cu</a> = !{!0}<br>
</span>+!llvm.module.flags = !{!9, !10}<br>
+!llvm.ident = !{!11}<br>
+<br>
+!0 = !MDCompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.7.0 (trunk 232565)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !2, globals: !3, imports: !2)<br>
+!1 = !MDFile(filename: "test.cpp", directory: "/home/test/DebugInfo")<br>
+!2 = !{}<br>
+!3 = !{!4, !7}<br>
+!4 = !MDGlobalVariable(name: "b", scope: !0, file: !1, line: 5, type: !5, isLocal: false, isDefinition: true, variable: i32** @b)<br>
+!5 = !MDDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64, align: 64)<br>
+!6 = !MDBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)<br>
+!7 = !MDGlobalVariable(name: "a", linkageName: "_ZN12_GLOBAL__N_11aE", scope: !8, file: !1, line: 3, type: !6, isLocal: true, isDefinition: true, variable: i32* @_ZN12_GLOBAL__N_11aE)<br>
+!8 = !MDNamespace(scope: null, file: !1, line: 2)<br>
+!9 = !{i32 2, !"Dwarf Version", i32 4}<br>
+!10 = !{i32 2, !"Debug Info Version", i32 3}<br>
+!11 = !{!"clang version 3.7.0 (trunk 232565)"}<br>
+<br>
+;CHECK: DW_TAG_imported_module<br>
+;CHECK: DW_AT_import<br>
<div class="HOEnZb"><div class="h5">+;CHECK-NEXT: DW_AT_artificial<br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
</div></div></blockquote></div><br></div></div>