[PATCH] DebugInfo: Permit DW_TAG_structure_type, DW_TAG_member, DW_TAG_typedef tags with empty file names.

Peter Collingbourne peter at pcc.me.uk
Tue Mar 24 14:09:36 PDT 2015


- Add test case


http://reviews.llvm.org/D8588

Files:
  lib/IR/DebugInfo.cpp
  test/DebugInfo/verifier.ll

Index: lib/IR/DebugInfo.cpp
===================================================================
--- lib/IR/DebugInfo.cpp
+++ lib/IR/DebugInfo.cpp
@@ -283,7 +283,9 @@
         Tag != dwarf::DW_TAG_restrict_type && Tag != dwarf::DW_TAG_array_type &&
         Tag != dwarf::DW_TAG_enumeration_type &&
         Tag != dwarf::DW_TAG_subroutine_type &&
-        Tag != dwarf::DW_TAG_inheritance && Tag != dwarf::DW_TAG_friend)
+        Tag != dwarf::DW_TAG_inheritance && Tag != dwarf::DW_TAG_friend &&
+        Tag != dwarf::DW_TAG_structure_type && Tag != dwarf::DW_TAG_member &&
+        Tag != dwarf::DW_TAG_typedef)
       return false;
   }
 
Index: test/DebugInfo/verifier.ll
===================================================================
--- /dev/null
+++ test/DebugInfo/verifier.ll
@@ -0,0 +1,24 @@
+; RUN: opt -verify -S -o /dev/null %s
+
+; Test that we accept DW_TAG_structure_type, DW_TAG_member and DW_TAG_typedef
+; with no source location. These can come up in some languages with predefined
+; types.
+
+!0 = !MDCompositeType(tag: DW_TAG_structure_type, name: "foo", elements: !3)
+!1 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "x", type: !5)
+!2 = !MDExpression()
+!3 = !{!4}
+!4 = !MDDerivedType(tag: DW_TAG_member, name: "m", baseType: !0)
+!5 = !MDDerivedType(tag: DW_TAG_typedef, name: "td", baseType: !0)
+
+define void @foo() {
+  %x = alloca i32
+  call void @llvm.dbg.declare(metadata i32* %x, metadata !1, metadata !2)
+  ret void
+}
+
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
+
+!llvm.module.flags = !{!100, !101}
+!100 = !{i32 2, !"Dwarf Version", i32 2}
+!101 = !{i32 2, !"Debug Info Version", i32 3}

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8588.22599.patch
Type: text/x-patch
Size: 1663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150324/5e06f26b/attachment.bin>


More information about the llvm-commits mailing list