From f780d983d138f20ababcddda680f0b0a2d39d55d Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Fri, 25 Aug 2023 11:28:21 -0700 Subject: [PATCH] Enable opaque pointers in LLVM 16. --- src/tcompiler.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tcompiler.cpp b/src/tcompiler.cpp index 592b62dc..03e269d4 100644 --- a/src/tcompiler.cpp +++ b/src/tcompiler.cpp @@ -270,7 +270,7 @@ int terra_inittarget(lua_State *L) { TT->next_unused_id = 0; TT->ctx = new LLVMContext(); -#if LLVM_VERSION >= 150 +#if LLVM_VERSION >= 150 && LLVM_VERSION < 160 // Hack: This is a workaround to avoid the opaque pointer // transition, but we will need to deal with it eventually. // FIXME: https://github.com/terralang/terra/issues/553 @@ -2348,12 +2348,18 @@ struct FunctionEmitter { return result; } bool isPointerToFunction(Type *t) { - return t->isPointerTy() && t->getPointerElementType()->isFunctionTy(); + return t->isPointerTy() +#if LLVM_VERSION < 160 + && t->getPointerElementType()->isFunctionTy() +#endif +; } Value *emitStructSelect(Obj *structType, Value *structPtr, int index, Obj *entryType) { assert(structPtr->getType()->isPointerTy()); +#if LLVM_VERSION < 160 assert(structPtr->getType()->getPointerElementType()->isStructTy()); +#endif Ty->EnsureTypeIsComplete(structType); Obj layout;