Skip to content

Commit

Permalink
Enable opaque pointers in LLVM 16.
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottslaughter committed Aug 25, 2023
1 parent cb3f5ec commit f780d98
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/tcompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f780d98

Please sign in to comment.