diff options
Diffstat (limited to 'src/zig_llvm.cpp')
| -rw-r--r-- | src/zig_llvm.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp index e5b9df625c..5a66d0ba6a 100644 --- a/src/zig_llvm.cpp +++ b/src/zig_llvm.cpp @@ -39,6 +39,7 @@ #include <llvm/Object/COFFModuleDefinition.h> #include <llvm/PassRegistry.h> #include <llvm/Support/CommandLine.h> +#include <llvm/Support/Host.h> #include <llvm/Support/FileSystem.h> #include <llvm/Support/TargetParser.h> #include <llvm/Support/Timer.h> @@ -308,7 +309,9 @@ ZIG_EXTERN_C LLVMTypeRef ZigLLVMTokenTypeInContext(LLVMContextRef context_ref) { LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, ZigLLVM_CallingConv CC, ZigLLVM_CallAttr attr, const char *Name) { - CallInst *call_inst = CallInst::Create(unwrap(Fn), makeArrayRef(unwrap(Args), NumArgs), Name); + Value *V = unwrap(Fn); + FunctionType *FnT = cast<FunctionType>(cast<PointerType>(V->getType())->getElementType()); + CallInst *call_inst = CallInst::Create(FnT, V, makeArrayRef(unwrap(Args), NumArgs), Name); call_inst->setCallingConv(static_cast<CallingConv::ID>(CC)); switch (attr) { case ZigLLVM_CallAttrAuto: |
