// Emit all Dwarf sections that should come after the content.
void DwarfDebug::endModule() {
assert(CurFn == 0);
+ assert(CurMI == 0);
if (!FirstCU)
return;
}
// Gather and emit post-function debug information.
-void DwarfDebug::endFunction() {
+void DwarfDebug::endFunction(const MachineFunction *MF) {
+ // Every beginFunction(MF) call should be followed by an endFunction(MF) call,
+ // though the beginFunction may not be called at all.
+ // We should handle both cases.
+ if (CurFn == 0)
+ CurFn = MF;
+ else
+ assert(CurFn == MF);
assert(CurFn != 0);
if (!MMI->hasDebugInfo() || LScopes.empty()) {