[PATCH] D145712: [llvm-c] Add LLVMPointerType2

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 11:16:48 PST 2023


aeubanks created this revision.
aeubanks added a reviewer: nikic.
Herald added a reviewer: deadalnix.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In preparation for removing some of the typed pointer APIs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145712

Files:
  llvm/docs/ReleaseNotes.rst
  llvm/include/llvm-c/Core.h
  llvm/lib/IR/Core.cpp


Index: llvm/lib/IR/Core.cpp
===================================================================
--- llvm/lib/IR/Core.cpp
+++ 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());
 }
Index: llvm/include/llvm-c/Core.h
===================================================================
--- llvm/include/llvm-c/Core.h
+++ 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.
  *
Index: llvm/docs/ReleaseNotes.rst
===================================================================
--- llvm/docs/ReleaseNotes.rst
+++ 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
 --------------------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145712.503857.patch
Type: text/x-patch
Size: 1471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230309/c8c7b558/attachment.bin>


More information about the llvm-commits mailing list