diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -149,6 +149,10 @@ have been removed. * Removed ``LLVMPassManagerBuilderRef`` and functions interacting with it. These belonged to the no longer supported legacy pass manager. +* Removed various typed pointer APIs: + * Removed ``LLVMPointerType``: Use ``LLVMPointerTypeInContext`` instead + * Removed ``LLVMPointerTypeIsOpaque`` + * ``LLVMGetElementType`` no longer gives the pointee type for typed pointers Changes to the FastISel infrastructure -------------------------------------- diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -1473,25 +1473,6 @@ */ uint64_t LLVMGetArrayLength2(LLVMTypeRef ArrayTy); -/** - * Create a pointer type that points to a defined type. - * - * The created type will exist in the context that its pointee type - * exists in. - * - * @see llvm::PointerType::get() - */ -LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace); - -/** - * Determine whether a pointer is opaque. - * - * True if this is an instance of an opaque PointerType. - * - * @see llvm::Type::isOpaquePointerTy() - */ -LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty); - /** * Create an opaque pointer type in a context. * diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -792,10 +792,6 @@ return wrap(ArrayType::get(unwrap(ElementType), ElementCount)); } -LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace) { - return wrap(PointerType::get(unwrap(ElementType), AddressSpace)); -} - LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty) { return unwrap(Ty)->isOpaquePointerTy(); } @@ -811,8 +807,6 @@ LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy) { auto *Ty = unwrap(WrappedTy); - if (auto *PTy = dyn_cast(Ty)) - return wrap(PTy->getNonOpaquePointerElementType()); if (auto *ATy = dyn_cast(Ty)) return wrap(ATy->getElementType()); return wrap(cast(Ty)->getElementType()); diff --git a/llvm/tools/llvm-c-test/calc.c b/llvm/tools/llvm-c-test/calc.c --- a/llvm/tools/llvm-c-test/calc.c +++ b/llvm/tools/llvm-c-test/calc.c @@ -118,8 +118,8 @@ LLVMModuleRef M = LLVMModuleCreateWithName(name); LLVMTypeRef I64ty = LLVMInt64Type(); - LLVMTypeRef I64Ptrty = LLVMPointerType(I64ty, 0); - LLVMTypeRef Fty = LLVMFunctionType(I64ty, &I64Ptrty, 1, 0); + LLVMTypeRef Ptrty = LLVMPointerTypeInContext(LLVMGetGlobalContext(), 0); + LLVMTypeRef Fty = LLVMFunctionType(I64ty, &Ptrty, 1, 0); LLVMValueRef F = LLVMAddFunction(M, name, Fty); LLVMBuilderRef builder = LLVMCreateBuilder(); diff --git a/llvm/tools/llvm-c-test/echo.cpp b/llvm/tools/llvm-c-test/echo.cpp --- a/llvm/tools/llvm-c-test/echo.cpp +++ b/llvm/tools/llvm-c-test/echo.cpp @@ -136,11 +136,7 @@ return LLVMArrayType2(Clone(LLVMGetElementType(Src)), LLVMGetArrayLength2(Src)); case LLVMPointerTypeKind: - if (LLVMPointerTypeIsOpaque(Src)) - return LLVMPointerTypeInContext(Ctx, LLVMGetPointerAddressSpace(Src)); - else - return LLVMPointerType(Clone(LLVMGetElementType(Src)), - LLVMGetPointerAddressSpace(Src)); + return LLVMPointerTypeInContext(Ctx, LLVMGetPointerAddressSpace(Src)); case LLVMVectorTypeKind: return LLVMVectorType( Clone(LLVMGetElementType(Src)),