diff options
| author | Devang Patel <dpatel@apple.com> | 2009-10-12 23:11:24 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2009-10-12 23:11:24 +0000 |
| commit | 0f58bec599eefcd81bd5c986939afb784af7ca98 (patch) | |
| tree | 1cfe71ebc76c607d89ac92ed4c1c8f15153db7e9 /llvm/lib/CodeGen/AsmPrinter | |
| parent | 0af2a420cd439e081d4774964f6bb595e64a831a (diff) | |
| download | bcm5719-llvm-0f58bec599eefcd81bd5c986939afb784af7ca98.tar.gz bcm5719-llvm-0f58bec599eefcd81bd5c986939afb784af7ca98.zip | |
Find enclosing subprogram info.
llvm-svn: 83922
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index f0579fe588a..811bf65d9d0 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1894,6 +1894,24 @@ bool DwarfDebug::ExtractScopeInformation(MachineFunction *MF) { return !DbgScopeMap.empty(); } +static DISubprogram getDISubprogram(MDNode *N) { + + DIDescriptor D(N); + if (D.isNull()) + return DISubprogram(); + + if (D.isCompileUnit()) + return DISubprogram(); + + if (D.isSubprogram()) + return DISubprogram(N); + + if (D.isLexicalBlock()) + return getDISubprogram(DILexicalBlock(N).getContext().getNode()); + + assert (0 && "Unexpected Descriptor!"); +} + /// BeginFunction - Gather pre-function debug information. Assumes being /// emitted immediately after the function entry point. void DwarfDebug::BeginFunction(MachineFunction *MF) { @@ -1923,7 +1941,7 @@ void DwarfDebug::BeginFunction(MachineFunction *MF) { if (!FDL.isUnknown()) { DebugLocTuple DLT = MF->getDebugLocTuple(FDL); unsigned LabelID = 0; - DISubprogram SP(DLT.CompileUnit); + DISubprogram SP = getDISubprogram(DLT.CompileUnit); if (!SP.isNull()) LabelID = RecordSourceLine(SP.getLineNumber(), 0, DLT.CompileUnit); else |

