[llvm] r177492 - Reorder the DIFile parameter in DINameSpace

David Blaikie dblaikie at gmail.com
Tue Mar 19 23:27:06 PDT 2013


Author: dblaikie
Date: Wed Mar 20 01:27:06 2013
New Revision: 177492

URL: http://llvm.org/viewvc/llvm-project?rev=177492&view=rev
Log:
Reorder the DIFile parameter in DINameSpace

Moving the DIFile parameter to immediately proceed the tag so that it will be a
common prefix with other DIScopes (once the DIFile is replaced with the raw
file/directory pair).

Modified:
    llvm/trunk/include/llvm/DebugInfo.h
    llvm/trunk/lib/IR/DIBuilder.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=177492&r1=177491&r2=177492&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/DebugInfo.h Wed Mar 20 01:27:06 2013
@@ -644,13 +644,13 @@ namespace llvm {
     void printInternal(raw_ostream &OS) const;
   public:
     explicit DINameSpace(const MDNode *N = 0) : DIScope(N) {}
-    DIScope getContext() const     { return getFieldAs<DIScope>(1);      }
-    StringRef getName() const      { return getStringField(2);           }
+    DIScope getContext() const     { return getFieldAs<DIScope>(2);      }
+    StringRef getName() const      { return getStringField(3);           }
     StringRef getDirectory() const  {
-      return getFieldAs<DIFile>(3).getDirectory();
+      return getFieldAs<DIFile>(1).getDirectory();
     }
     StringRef getFilename() const  {
-      return getFieldAs<DIFile>(3).getFilename();
+      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=177492&r1=177491&r2=177492&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DIBuilder.cpp (original)
+++ llvm/trunk/lib/IR/DIBuilder.cpp Wed Mar 20 01:27:06 2013
@@ -975,9 +975,9 @@ DINameSpace DIBuilder::createNameSpace(D
                                        DIFile File, unsigned LineNo) {
   Value *Elts[] = {
     GetTagConstant(VMContext, dwarf::DW_TAG_namespace),
+    File,
     getNonCompileUnitScope(Scope),
     MDString::get(VMContext, Name),
-    File,
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNo)
   };
   DINameSpace R(MDNode::get(VMContext, Elts));

Modified: llvm/trunk/test/DebugInfo/namespace.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/namespace.ll?rev=177492&r1=177491&r2=177492&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/namespace.ll (original)
+++ llvm/trunk/test/DebugInfo/namespace.ll Wed Mar 20 01:27:06 2013
@@ -1,6 +1,7 @@
 ; RUN: llc -O0 -filetype=obj < %s > %t
 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
 ; CHECK: DW_TAG_namespace
+; CHECK-NEXT: DW_AT_name{{.*}} = "A"
 ; CHECK-NOT: NULL
 ; CHECK: DW_TAG_variable
 ; CHECK-NEXT: DW_AT_name{{.*}}= "i"
@@ -21,5 +22,5 @@
 !3 = metadata !{i32 0}
 !4 = metadata !{metadata !5}
 !5 = metadata !{i32 786484, i32 0, metadata !6, metadata !"i", metadata !"i", metadata !"_ZN1A1iE", metadata !1, i32 4, metadata !7, i32 0, i32 1, i32* @_ZN1A1iE, null} ; [ DW_TAG_variable ] [i] [line 4] [def]
-!6 = metadata !{i32 786489, null, metadata !"A", metadata !1, i32 3} ; [ DW_TAG_namespace ] [A] [line 3]
+!6 = metadata !{i32 786489, metadata !1, null, metadata !"A", i32 3} ; [ DW_TAG_namespace ] [A] [line 3]
 !7 = 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