aboutsummaryrefslogtreecommitdiff
path: root/src/zig_llvm.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-07-24 16:49:57 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-07-24 16:49:57 -0700
commitc8ea8cf5df8261995b1e451085e39cd612c9e038 (patch)
tree48904bad6f45623c4eec6f28081619aca1490894 /src/zig_llvm.cpp
parentcd91e17b7384fe857c5cf847b106cd0f98cb4d6a (diff)
downloadzig-c8ea8cf5df8261995b1e451085e39cd612c9e038.tar.gz
zig-c8ea8cf5df8261995b1e451085e39cd612c9e038.zip
update LLVM C++ API wrappers from llvm 10 to 11
Diffstat (limited to 'src/zig_llvm.cpp')
-rw-r--r--src/zig_llvm.cpp5
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: