diff options
author | Devang Patel <dpatel@apple.com> | 2009-11-11 00:31:36 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-11-11 00:31:36 +0000 |
commit | 39ae3ff6d13ef71d0f0ecc8499b49935355508af (patch) | |
tree | b4451b2d2db84abae75342c82272383d249e6c8b | |
parent | 64066bd8b593082f622bbc25716938a453363d2f (diff) | |
download | external_llvm-39ae3ff6d13ef71d0f0ecc8499b49935355508af.zip external_llvm-39ae3ff6d13ef71d0f0ecc8499b49935355508af.tar.gz external_llvm-39ae3ff6d13ef71d0f0ecc8499b49935355508af.tar.bz2 |
Do not assume first function scope seen represents current function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86771 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 5 | ||||
-rw-r--r-- | test/DebugInfo/2009-11-10-CurrentFn.ll | 19 |
2 files changed, 22 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 75b42cd..e7e596d 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1347,8 +1347,9 @@ DbgScope *DwarfDebug::getUpdatedDbgScope(MDNode *N, const MachineInstr *MI, NScope->setFirstInsn(MI); if (!Parent && !InlinedAt) { - assert (!CurrentFnDbgScope && "Unexpected function scope!"); - CurrentFnDbgScope = NScope; + StringRef SPName = DISubprogram(N).getLinkageName(); + if (SPName == MF->getFunction()->getName()) + CurrentFnDbgScope = NScope; } if (GetConcreteScope) { diff --git a/test/DebugInfo/2009-11-10-CurrentFn.ll b/test/DebugInfo/2009-11-10-CurrentFn.ll new file mode 100644 index 0000000..c480f46 --- /dev/null +++ b/test/DebugInfo/2009-11-10-CurrentFn.ll @@ -0,0 +1,19 @@ + +declare void @foo() + +define void @bar(i32 %i) nounwind ssp { +entry: + tail call void @foo() nounwind, !dbg !0 + ret void, !dbg !6 +} + +!0 = metadata !{i32 9, i32 0, metadata !1, null} +!1 = metadata !{i32 458798, i32 0, metadata !2, metadata !"baz", metadata !"baz", metadata !"baz", metadata !2, i32 8, metadata !3, i1 true, i1 true}; [DW_TAG_subprogram ] +!2 = metadata !{i32 458769, i32 0, i32 1, metadata !"2007-12-VarArrayDebug.c", metadata !"/Volumes/Data/ddunbar/llvm/test/FrontendC", metadata !"4.2.1 (Based on Apple Inc. build 5653) (LLVM build)", i1 true, i1 true, metadata !"", i32 0}; [DW_TAG_compile_unit ] +!3 = metadata !{i32 458773, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0}; [DW_TAG_subroutine_type ] +!4 = metadata !{null, metadata !5} +!5 = metadata !{i32 458788, metadata !2, metadata !"int", metadata !2, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5}; [DW_TAG_base_type ] +!6 = metadata !{i32 18, i32 0, metadata !7, null} +!7 = metadata !{i32 458798, i32 0, metadata !2, metadata !"bar", metadata !"bar", metadata !"bar", metadata !2, i32 16, metadata !8, i1 false, i1 true}; [DW_TAG_subprogram ] +!8 = metadata !{i32 458773, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !9, i32 0}; [DW_TAG_subroutine_type ] +!9 = metadata !{null} |