aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-11-11 00:18:40 +0000
committerDevang Patel <dpatel@apple.com>2009-11-11 00:18:40 +0000
commit2f105c6e18b1cf0507be74dd03779b675d254a30 (patch)
treef0b2c45ec8c84c6dd9bf98dc5222bd73a31553df
parentf40888dc9b2b1a28fb4e7ba9a1fc930461e251aa (diff)
While creating DbgScopes, do not forget parent scope.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86763 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp2
-rw-r--r--test/DebugInfo/2009-11-10-ParentScope.ll26
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 2849723af3..75b42cd698 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2124,6 +2124,8 @@ void DwarfDebug::createDbgScope(MDNode *Scope, MDNode *InlinedAt) {
return;
WScope = new DbgScope(NULL, DIDescriptor(Scope), NULL);
DbgScopeMap.insert(std::make_pair(Scope, WScope));
+ if (DIDescriptor(Scope).isLexicalBlock())
+ createDbgScope(DILexicalBlock(Scope).getContext().getNode(), NULL);
return;
}
diff --git a/test/DebugInfo/2009-11-10-ParentScope.ll b/test/DebugInfo/2009-11-10-ParentScope.ll
new file mode 100644
index 0000000000..df5155f7de
--- /dev/null
+++ b/test/DebugInfo/2009-11-10-ParentScope.ll
@@ -0,0 +1,26 @@
+; RUN: llc < %s -o /dev/null
+%struct.htab = type { i32 (i8*)*, i32 (i8*, i8*)*, void (i8*)*, i8**, i64, i64, i64, i32, i32, i8* (i64, i64)*, void (i8*)*, i8*, i8* (i8*, i64, i64)*, void (i8*, i8*)*, i32, [4 x i8] }
+
+define i8* @htab_find_with_hash(%struct.htab* %htab, i8* %element, i32 %hash) nounwind {
+entry:
+ br i1 undef, label %land.lhs.true, label %if.end, !dbg !0
+
+land.lhs.true: ; preds = %entry
+ unreachable
+
+if.end: ; preds = %entry
+ store i8* undef, i8** undef, !dbg !7
+ ret i8* undef, !dbg !10
+}
+
+!0 = metadata !{i32 571, i32 3, metadata !1, null}
+!1 = metadata !{i32 458763, metadata !2}; [DW_TAG_lexical_block ]
+!2 = metadata !{i32 458798, i32 0, metadata !3, metadata !"htab_find_with_hash", metadata !"htab_find_with_hash", metadata !"htab_find_with_hash", metadata !3, i32 561, metadata !4, i1 false, i1 true}; [DW_TAG_subprogram ]
+!3 = metadata !{i32 458769, i32 0, i32 12, metadata !"hashtab.c", metadata !"/usr/src/gnu/usr.bin/cc/cc_tools/../../../../contrib/gcclibs/libiberty", metadata !"clang 1.1", i1 true, i1 false, metadata !"", i32 0}; [DW_TAG_compile_unit ]
+!4 = metadata !{i32 458773, metadata !3, metadata !"", null, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !5, i32 0}; [DW_TAG_subroutine_type ]
+!5 = metadata !{metadata !6}
+!6 = metadata !{i32 458767, metadata !3, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, null}; [DW_TAG_pointer_type ]
+!7 = metadata !{i32 583, i32 7, metadata !8, null}
+!8 = metadata !{i32 458763, metadata !9}; [DW_TAG_lexical_block ]
+!9 = metadata !{i32 458763, metadata !1}; [DW_TAG_lexical_block ]
+!10 = metadata !{i32 588, i32 1, metadata !2, null}