[PATCH] D17579: Add capability to push/pop DFI in MCStreamer. NFC
Amaury SECHET via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 24 12:56:49 PST 2016
deadalnix created this revision.
deadalnix added reviewers: davidxl, reames, sanjoy, MatzeB, pete.
deadalnix added a subscriber: llvm-commits.
This is extracted from D17555
http://reviews.llvm.org/D17579
Files:
include/llvm/MC/MCStreamer.h
lib/MC/MCStreamer.cpp
Index: lib/MC/MCStreamer.cpp
===================================================================
--- lib/MC/MCStreamer.cpp
+++ lib/MC/MCStreamer.cpp
@@ -174,6 +174,25 @@
return &DwarfFrameInfos.back();
}
+bool MCStreamer::hasUnfinishedDwarfFrameInfo() {
+ MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
+ return CurFrame && !CurFrame->End;
+}
+
+MCDwarfFrameInfo MCStreamer::popDwarfFrameInfo() {
+ if (!hasUnfinishedDwarfFrameInfo())
+ report_fatal_error("Can only pop unfinished frames!");
+ auto DFI = DwarfFrameInfos.back();
+ DwarfFrameInfos.pop_back();
+ return DFI;
+}
+
+void MCStreamer::pushDwarfFrameInfo(MCDwarfFrameInfo DFI) {
+ if (hasUnfinishedDwarfFrameInfo())
+ report_fatal_error("Pushing a frame before finishing the previous one!");
+ DwarfFrameInfos.push_back(DFI);
+}
+
void MCStreamer::EnsureValidDwarfFrame() {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame || CurFrame->End)
@@ -238,8 +257,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;
Index: include/llvm/MC/MCStreamer.h
===================================================================
--- include/llvm/MC/MCStreamer.h
+++ include/llvm/MC/MCStreamer.h
@@ -222,6 +222,10 @@
return DwarfFrameInfos;
}
+ bool hasUnfinishedDwarfFrameInfo();
+ MCDwarfFrameInfo popDwarfFrameInfo();
+ void pushDwarfFrameInfo(MCDwarfFrameInfo DFI);
+
unsigned getNumWinFrameInfos() { return WinFrameInfos.size(); }
ArrayRef<WinEH::FrameInfo *> getWinFrameInfos() const {
return WinFrameInfos;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17579.48969.patch
Type: text/x-patch
Size: 1791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160224/dec9a7c5/attachment.bin>
More information about the llvm-commits
mailing list