Avoid crashing when failing to emit a thunk
If we crash, we raise a crash handler dialog, and that's really annoying. Even though we can't emit correct IR until we have musttail, don't crash. llvm-svn: 205948
This commit is contained in:
parent
48c8c07d0a
commit
9df1d975b8
|
@ -2546,8 +2546,14 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|||
// FIXME: Do this earlier rather than hacking it in here!
|
||||
llvm::Value *ArgMemory = 0;
|
||||
if (llvm::StructType *ArgStruct = CallInfo.getArgStruct()) {
|
||||
llvm::AllocaInst *AI = new llvm::AllocaInst(
|
||||
ArgStruct, "argmem", CallArgs.getStackBase()->getNextNode());
|
||||
llvm::Instruction *IP = CallArgs.getStackBase();
|
||||
llvm::AllocaInst *AI;
|
||||
if (IP) {
|
||||
IP = IP->getNextNode();
|
||||
AI = new llvm::AllocaInst(ArgStruct, "argmem", IP);
|
||||
} else {
|
||||
AI = Builder.CreateAlloca(ArgStruct, nullptr, "argmem");
|
||||
}
|
||||
AI->setUsedWithInAlloca(true);
|
||||
assert(AI->isUsedWithInAlloca() && !AI->isStaticAlloca());
|
||||
ArgMemory = AI;
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple=i386-pc-win32 %s -verify
|
||||
|
||||
struct A {
|
||||
A();
|
||||
~A();
|
||||
int a;
|
||||
};
|
||||
struct B {
|
||||
virtual void f(A); // expected-error {{cannot compile this non-trivial argument copy for thunk yet}}
|
||||
};
|
||||
void (B::*mp)(A) = &B::f;
|
Loading…
Reference in New Issue