Follow-up to r204790: don't try to emit line tables if there are no functions with DI in the TU

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204795 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Timur Iskhodzhanov
2014-03-26 11:24:36 +00:00
parent 95f4d65d4f
commit 2b84dba718
2 changed files with 61 additions and 2 deletions

View File

@ -304,11 +304,18 @@ void WinCodeViewLineTables::beginFunction(const MachineFunction *MF) {
}
}
void WinCodeViewLineTables::endFunction(const MachineFunction *) {
void WinCodeViewLineTables::endFunction(const MachineFunction *MF) {
if (!Asm || !CurFn) // We haven't created any debug info for this function.
return;
if (!CurFn->Instrs.empty()) {
const Function *GV = MF->getFunction();
assert(FnDebugInfo.count(GV) == true);
assert(CurFn == &FnDebugInfo[GV]);
if (CurFn->Instrs.empty()) {
FnDebugInfo.erase(GV);
VisitedFunctions.pop_back();
} else {
// Define end label for subprogram.
MCSymbol *FunctionEndSym = Asm->OutStreamer.getContext().CreateTempSymbol();
Asm->OutStreamer.EmitLabel(FunctionEndSym);