diff --git a/gen/functions.cpp b/gen/functions.cpp index cccb84e6..6c9ecd7a 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -256,15 +256,15 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype, lidx++; } - // Now we can modify irFty safely. - irFty = newIrFty; - // let the abi rewrite the types as necesary - abi->rewriteFunctionType(f, irFty); + abi->rewriteFunctionType(f, newIrFty); // Tell the ABI we're done with this function type abi->doneWithFunctionType(); + // Now we can modify irFty safely. + irFty = llvm_move(newIrFty); + // build the function type std::vector argtypes; argtypes.reserve(lidx); diff --git a/gen/llvmcompat.h b/gen/llvmcompat.h index 6435153b..f84e93dc 100644 --- a/gen/llvmcompat.h +++ b/gen/llvmcompat.h @@ -32,4 +32,8 @@ #define HAS_ATTRIBUTES(x) (x) #endif +#if LDC_LLVM_VER < 302 +#define llvm_move(value) (value) +#endif + #endif