Index: include/llvm/MC/MCStreamer.h =================================================================== --- include/llvm/MC/MCStreamer.h +++ include/llvm/MC/MCStreamer.h @@ -222,6 +222,8 @@ return DwarfFrameInfos; } + bool hasUnfinishedDwarfFrameInfo(); + unsigned getNumWinFrameInfos() { return WinFrameInfos.size(); } ArrayRef getWinFrameInfos() const { return WinFrameInfos; Index: lib/MC/MCStreamer.cpp =================================================================== --- lib/MC/MCStreamer.cpp +++ lib/MC/MCStreamer.cpp @@ -174,6 +174,11 @@ return &DwarfFrameInfos.back(); } +bool MCStreamer::hasUnfinishedDwarfFrameInfo() { + MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo(); + return CurFrame && !CurFrame->End; +} + void MCStreamer::EnsureValidDwarfFrame() { MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo(); if (!CurFrame || CurFrame->End) @@ -238,8 +243,7 @@ } void MCStreamer::EmitCFIStartProc(bool IsSimple) { - MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo(); - if (CurFrame && !CurFrame->End) + if (hasUnfinishedDwarfFrameInfo()) report_fatal_error("Starting a frame before finishing the previous one!"); MCDwarfFrameInfo Frame;