[llvm] r177566 - Refactor file/directory path in namespace debug info to refer directly to the pair rather than the DIFile

David Blaikie dblaikie at gmail.com
Wed Mar 20 12:39:15 PDT 2013


Author: dblaikie
Date: Wed Mar 20 14:39:15 2013
New Revision: 177566

URL: http://llvm.org/viewvc/llvm-project?rev=177566&view=rev
Log:
Refactor file/directory path in namespace debug info to refer directly to the pair rather than the DIFile

(paired to a Clang test - excuse the buildbot skew/fallout)

Modified:
    llvm/trunk/include/llvm/DebugInfo.h
    llvm/trunk/lib/IR/DIBuilder.cpp
    llvm/trunk/lib/IR/DebugInfo.cpp
    llvm/trunk/test/DebugInfo/namespace.ll

Modified: llvm/trunk/include/llvm/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=177566&r1=177565&r2=177566&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/DebugInfo.h Wed Mar 20 14:39:15 2013
@@ -646,12 +646,6 @@ namespace llvm {
     explicit DINameSpace(const MDNode *N = 0) : DIScope(N) {}
     DIScope getContext() const     { return getFieldAs<DIScope>(2);      }
     StringRef getName() const      { return getStringField(3);           }
-    StringRef getDirectory() const  {
-      return getFieldAs<DIFile>(1).getDirectory();
-    }
-    StringRef getFilename() const  {
-      return getFieldAs<DIFile>(1).getFilename();
-    }
     unsigned getLineNumber() const { return getUnsignedField(4);         }
     bool Verify() const;
   };

Modified: llvm/trunk/lib/IR/DIBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=177566&r1=177565&r2=177566&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DIBuilder.cpp (original)
+++ llvm/trunk/lib/IR/DIBuilder.cpp Wed Mar 20 14:39:15 2013
@@ -984,7 +984,7 @@ DINameSpace DIBuilder::createNameSpace(D
                                        DIFile File, unsigned LineNo) {
   Value *Elts[] = {
     GetTagConstant(VMContext, dwarf::DW_TAG_namespace),
-    File,
+    File.getFileNode(),
     getNonCompileUnitScope(Scope),
     MDString::get(VMContext, Name),
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNo)

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=177566&r1=177565&r2=177566&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Wed Mar 20 14:39:15 2013
@@ -672,8 +672,6 @@ StringRef DIScope::getFilename() const {
     return DISubprogram(DbgNode).getFilename();
   if (isCompileUnit())
     return DICompileUnit(DbgNode).getFilename();
-  if (isNameSpace())
-    return DINameSpace(DbgNode).getFilename();
   return ::getStringField(getNodeField(DbgNode, 1), 0);
 }
 
@@ -688,8 +686,6 @@ StringRef DIScope::getDirectory() const
     return DISubprogram(DbgNode).getDirectory();
   if (isCompileUnit())
     return DICompileUnit(DbgNode).getDirectory();
-  if (isNameSpace())
-    return DINameSpace(DbgNode).getDirectory();
   return ::getStringField(getNodeField(DbgNode, 1), 1);
 }
 

Modified: llvm/trunk/test/DebugInfo/namespace.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/namespace.ll?rev=177566&r1=177565&r2=177566&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/namespace.ll (original)
+++ llvm/trunk/test/DebugInfo/namespace.ll Wed Mar 20 14:39:15 2013
@@ -1,13 +1,20 @@
 ; RUN: llc -O0 -filetype=obj < %s > %t
-; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
+; RUN: llvm-dwarfdump %t | FileCheck %s
+; CHECK: debug_info contents
 ; CHECK: DW_TAG_namespace
 ; CHECK-NEXT: DW_AT_name{{.*}} = "A"
+; CHECK-NEXT: DW_AT_decl_file{{.*}}(0x0[[F1:[0-9]]])
+; CHECK-NEXT: DW_AT_decl_line{{.*}}(0x03)
 ; CHECK-NOT: NULL
 ; CHECK: DW_TAG_namespace
 ; CHECK-NEXT: DW_AT_name{{.*}} = "B"
+; CHECK-NEXT: DW_AT_decl_file{{.*}}(0x0[[F2:[0-9]]])
+; CHECK-NEXT: DW_AT_decl_line{{.*}}(0x01)
 ; CHECK-NOT: NULL
 ; CHECK: DW_TAG_variable
 ; CHECK-NEXT: DW_AT_name{{.*}}= "i"
+; CHECK: file_names[  [[F1]]]{{.*}}debug-info-namespace.cpp
+; CHECK: file_names[  [[F2]]]{{.*}}foo.cpp
 
 ; IR generated from clang/test/CodeGenCXX/debug-info-namespace.cpp, file paths
 ; changed to protect the guilty. The C++ source code is simply:
@@ -28,8 +35,8 @@
 !3 = metadata !{i32 0}
 !4 = metadata !{metadata !5}
 !5 = metadata !{i32 786484, i32 0, metadata !6, metadata !"i", metadata !"i", metadata !"_ZN1A1B1iE", metadata !7, i32 2, metadata !10, i32 0, i32 1, i32* @_ZN1A1B1iE, null} ; [ DW_TAG_variable ] [i] [line 2] [def]
-!6 = metadata !{i32 786489, metadata !7, metadata !9, metadata !"B", i32 1} ; [ DW_TAG_namespace ] [B] [line 1]
+!6 = metadata !{i32 786489, metadata !8, metadata !9, metadata !"B", i32 1} ; [ DW_TAG_namespace ] [B] [line 1]
 !7 = metadata !{i32 786473, metadata !8}          ; [ DW_TAG_file_type ] [/home/foo/foo.cpp]
 !8 = metadata !{metadata !"foo.cpp", metadata !"/home/foo"}
-!9 = metadata !{i32 786489, metadata !1, null, metadata !"A", i32 3} ; [ DW_TAG_namespace ] [A] [line 3]
+!9 = metadata !{i32 786489, metadata !2, null, metadata !"A", i32 3} ; [ DW_TAG_namespace ] [A] [line 3]
 !10 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]





More information about the llvm-commits mailing list