summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2014-03-26 09:50:36 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2014-03-26 09:50:36 +0000
commit8499a12259e9d827c7f6fad554e1f5c6ccac58bb (patch)
tree4eb52d2df2ef4a082770e012c16b2ae81576cfb3 /llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
parente32ef937ebe4126693875f594e877a08952427e1 (diff)
downloadbcm5719-llvm-8499a12259e9d827c7f6fad554e1f5c6ccac58bb.tar.gz
bcm5719-llvm-8499a12259e9d827c7f6fad554e1f5c6ccac58bb.zip
Fix PR19239 - Add support for generating debug info for functions without lexical scopes and/or debug info at all
llvm-svn: 204790
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp b/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
index bb8b0735e50..9363303572f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
@@ -131,9 +131,12 @@ void WinCodeViewLineTables::emitDebugInfoForFunction(const Function *GV) {
// For each function there is a separate subsection
// which holds the PC to file:line table.
const MCSymbol *Fn = Asm->getSymbol(GV);
- const FunctionInfo &FI = FnDebugInfo[GV];
assert(Fn);
- assert(FI.Instrs.size() > 0);
+
+ const FunctionInfo &FI = FnDebugInfo[GV];
+ if (FI.Instrs.empty())
+ return;
+ assert(FI.End && "Don't know where the function ends?");
// PCs/Instructions are grouped into segments sharing the same filename.
// Pre-calculate the lengths (in instructions) of these segments and store
@@ -264,12 +267,6 @@ void WinCodeViewLineTables::beginFunction(const MachineFunction *MF) {
if (!Asm || !Asm->MMI->hasDebugInfo())
return;
- // Grab the lexical scopes for the function, if we don't have any of those
- // then we're not going to be able to do anything.
- LScopes.initialize(*MF);
- if (LScopes.empty())
- return;
-
const Function *GV = MF->getFunction();
assert(FnDebugInfo.count(GV) == false);
VisitedFunctions.push_back(GV);
@@ -311,13 +308,12 @@ void WinCodeViewLineTables::endFunction(const MachineFunction *) {
if (!Asm || !CurFn) // We haven't created any debug info for this function.
return;
- if (CurFn->Instrs.empty())
- llvm_unreachable("Can this ever happen?");
-
- // Define end label for subprogram.
- MCSymbol *FunctionEndSym = Asm->OutStreamer.getContext().CreateTempSymbol();
- Asm->OutStreamer.EmitLabel(FunctionEndSym);
- CurFn->End = FunctionEndSym;
+ if (!CurFn->Instrs.empty()) {
+ // Define end label for subprogram.
+ MCSymbol *FunctionEndSym = Asm->OutStreamer.getContext().CreateTempSymbol();
+ Asm->OutStreamer.EmitLabel(FunctionEndSym);
+ CurFn->End = FunctionEndSym;
+ }
CurFn = 0;
}
OpenPOWER on IntegriCloud