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,8 @@ have been removed. * Removed ``LLVMPassManagerBuilderRef`` and functions interacting with it. These belonged to the no longer supported legacy pass manager. +* Added the convenience ``LLVMPointerType2`` function to create an opaque + pointer in the global context. 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 @@ -1483,6 +1483,13 @@ */ LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace); +/** + * Create an opaque pointer type in the global context. + * + * @see llvm::PointerType::get() + */ +LLVMTypeRef LLVMPointerType2(unsigned AddressSpace); + /** * Determine whether a pointer is opaque. * 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 @@ -857,6 +857,9 @@ return wrap(Type::getMetadataTy(*unwrap(C))); } +LLVMTypeRef LLVMPointerType2(unsigned AddressSpace) { + return LLVMPointerTypeInContext(LLVMGetGlobalContext(), AddressSpace); +} LLVMTypeRef LLVMVoidType(void) { return LLVMVoidTypeInContext(LLVMGetGlobalContext()); }