From 7f5e7144062afcf7b984308f8c540ea22018e228 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 3 Apr 2015 23:37:34 +0000 Subject: [WinEH] Fill out CatchHigh in the TryBlockMap Now all fields in the WinEH xdata have been filled out. llvm-svn: 234067 --- llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp index 676ce65dedb..3bfcaa96593 100644 --- a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp @@ -421,11 +421,16 @@ void Win64Exception::emitCXXFrameHandler3Table(const MachineFunction *MF) { HandlerMaps.push_back(HandlerMapXData); + int CatchHigh = -1; + for (WinEHHandlerType &HT : TBME.HandlerArray) + CatchHigh = + std::max(CatchHigh, FuncInfo.CatchHandlerMaxState[HT.Handler]); + assert(TBME.TryLow <= TBME.TryHigh); - assert(TBME.CatchHigh > TBME.TryHigh); + assert(CatchHigh > TBME.TryHigh); OS.EmitIntValue(TBME.TryLow, 4); // TryLow OS.EmitIntValue(TBME.TryHigh, 4); // TryHigh - OS.EmitIntValue(TBME.CatchHigh, 4); // CatchHigh + OS.EmitIntValue(CatchHigh, 4); // CatchHigh OS.EmitIntValue(TBME.HandlerArray.size(), 4); // NumCatches OS.EmitValue(createImageRel32(HandlerMapXData), 4); // HandlerArray } -- cgit v1.2.3