// 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;
--- /dev/null
+// 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;