From 54af66f2ef8f63caae9fa2166dd42a6e5e33c6f1 Mon Sep 17 00:00:00 2001 From: Mariusz Sikora Date: Wed, 26 Jul 2023 16:04:57 +0200 Subject: [PATCH] Stop using opaque pointer API for LLVM 18+ (#60) LLVM 17 will be the last version with opaque pointer API support. --- lib/Dialect/Utils.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Dialect/Utils.cpp b/lib/Dialect/Utils.cpp index bad4bc9..b938121 100644 --- a/lib/Dialect/Utils.cpp +++ b/lib/Dialect/Utils.cpp @@ -50,11 +50,14 @@ static std::string getMangledTypeStr(Type *Ty, bool &HasUnnamedType) { std::string Result; if (PointerType *PTyp = dyn_cast(Ty)) { Result += "p" + utostr(PTyp->getAddressSpace()); +#if HAVE_LLVM_VERSION_MAJOR <= 17 // Opaque pointer doesn't have pointee type information, so we just mangle // address space for opaque pointer. + // After llvm-18+ opaque pointer API will be removed from LLVM. if (!PTyp->isOpaque()) Result += getMangledTypeStr(PTyp->getNonOpaquePointerElementType(), HasUnnamedType); +#endif } else if (ArrayType *ATyp = dyn_cast(Ty)) { Result += "a" + utostr(ATyp->getNumElements()) + getMangledTypeStr(ATyp->getElementType(), HasUnnamedType);