[llvm-commits] [llvm] r147897 - in /llvm/trunk: lib/Analysis/DebugInfo.cpp test/DebugInfo/X86/pointer-type-size.ll

Eric Christopher echristo at apple.com
Tue Jan 10 16:01:29 PST 2012


Author: echristo
Date: Tue Jan 10 18:01:29 2012
New Revision: 147897

URL: http://llvm.org/viewvc/llvm-project?rev=147897&view=rev
Log:
Don't avoid recursing for pointer types, just reference types. Expand on
the comment.

Fixes constvars.exp on the gdb test builder.

Added:
    llvm/trunk/test/DebugInfo/X86/pointer-type-size.ll
Modified:
    llvm/trunk/lib/Analysis/DebugInfo.cpp

Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=147897&r1=147896&r2=147897&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Tue Jan 10 18:01:29 2012
@@ -492,9 +492,10 @@
     if (!BaseType.isValid())
       return getSizeInBits();
     // If this is a derived type, go ahead and get the base type, unless
-    // it's a reference or pointer type, then it's just the size of the field.
-    if (BaseType.getTag() == dwarf::DW_TAG_reference_type ||
-        BaseType.getTag() == dwarf::DW_TAG_pointer_type)
+    // it's a reference then it's just the size of the field. Pointer types
+    // have no need of this since they're a different type of qualification
+    // on the type.
+    if (BaseType.getTag() == dwarf::DW_TAG_reference_type)
       return getSizeInBits();
     else if (BaseType.isDerivedType())
       return DIDerivedType(BaseType).getOriginalTypeSize();

Added: llvm/trunk/test/DebugInfo/X86/pointer-type-size.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/pointer-type-size.ll?rev=147897&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/pointer-type-size.ll (added)
+++ llvm/trunk/test/DebugInfo/X86/pointer-type-size.ll Tue Jan 10 18:01:29 2012
@@ -0,0 +1,25 @@
+; RUN: llc -mtriple=x86_64-apple-macosx10.7 %s -o %t -filetype=obj
+; RUN: llvm-dwarfdump %t | FileCheck %s
+
+; CHECK: ptr
+; CHECK-NOT: AT_bit_size
+
+%struct.crass = type { i8* }
+
+ at crass = common global %struct.crass zeroinitializer, align 8
+
+!llvm.dbg.cu = !{!0}
+
+!0 = metadata !{i32 720913, i32 0, i32 12, metadata !"foo.c", metadata !"/Users/echristo/tmp", metadata !"clang version 3.1 (trunk 147882)", i1 true, i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !1, metadata !3} ; [ DW_TAG_compile_unit ]
+!1 = metadata !{metadata !2}
+!2 = metadata !{i32 0}
+!3 = metadata !{metadata !4}
+!4 = metadata !{metadata !5}
+!5 = metadata !{i32 720948, i32 0, null, metadata !"crass", metadata !"crass", metadata !"", metadata !6, i32 1, metadata !7, i32 0, i32 1, %struct.crass* @crass} ; [ DW_TAG_variable ]
+!6 = metadata !{i32 720937, metadata !"foo.c", metadata !"/Users/echristo/tmp", null} ; [ DW_TAG_file_type ]
+!7 = metadata !{i32 720915, null, metadata !"crass", metadata !6, i32 1, i64 64, i64 64, i32 0, i32 0, null, metadata !8, i32 0, i32 0} ; [ DW_TAG_structure_type ]
+!8 = metadata !{metadata !9}
+!9 = metadata !{i32 720909, metadata !7, metadata !"ptr", metadata !6, i32 1, i64 64, i64 64, i64 0, i32 0, metadata !10} ; [ DW_TAG_member ]
+!10 = metadata !{i32 720934, null, metadata !"", null, i32 0, i64 0, i64 0, i64 0, i32 0, metadata !11} ; [ DW_TAG_const_type ]
+!11 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !12} ; [ DW_TAG_pointer_type ]
+!12 = metadata !{i32 720932, null, metadata !"char", null, i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ]





More information about the llvm-commits mailing list