Merge commit ce5173c0e from llvm git (by Reid Kleckner):
Use FinishThunk to finish musttail thunks FinishThunk, and the invariant of setting and then unsetting CurCodeDecl, was added in 7f416cc42638 (2015). The invariant didn't exist when I added this musttail codepath in ab2090d10765 (2014). Recently in 28328c3771, I started using this codepath on non-Windows platforms, and users reported problems during release testing (PR44987). The issue was already present for users of EH on i686-windows-msvc, so I added a test for that case as well. Reviewed By: hans Differential Revision: https://reviews.llvm.org/D76444 This should fix 'Assertion failed: (!empty() && "popping exception stack when not empty"), function popTerminate, file /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGCleanup.h, line 583' when building the net-p2p/libtorrent-rasterbar PR: 244830 Reported by: jbeich, yuri MFC after: 6 weeks X-MFC-With: 358851
This commit is contained in:
parent
b9bf16adfb
commit
3788a439e9
@ -437,7 +437,8 @@ void CodeGenFunction::EmitMustTailThunk(GlobalDecl GD,
|
||||
// Finish the function to maintain CodeGenFunction invariants.
|
||||
// FIXME: Don't emit unreachable code.
|
||||
EmitBlock(createBasicBlock());
|
||||
FinishFunction();
|
||||
|
||||
FinishThunk();
|
||||
}
|
||||
|
||||
void CodeGenFunction::generateThunk(llvm::Function *Fn,
|
||||
@ -564,7 +565,7 @@ llvm::Constant *CodeGenVTables::maybeEmitThunk(GlobalDecl GD,
|
||||
CGM.SetLLVMFunctionAttributesForDefinition(GD.getDecl(), ThunkFn);
|
||||
|
||||
// Thunks for variadic methods are special because in general variadic
|
||||
// arguments cannot be perferctly forwarded. In the general case, clang
|
||||
// arguments cannot be perfectly forwarded. In the general case, clang
|
||||
// implements such thunks by cloning the original function body. However, for
|
||||
// thunks with no return adjustment on targets that support musttail, we can
|
||||
// use musttail to perfectly forward the variadic arguments.
|
||||
|
Loading…
Reference in New Issue
Block a user