aboutsummaryrefslogtreecommitdiff
path: root/llvm/include/llvm-c
diff options
context:
space:
mode:
authorMeghan Denny <hello@nektro.net>2023-02-15 09:47:32 +0100
committerNikita Popov <npopov@redhat.com>2023-02-15 09:57:01 +0100
commit35276f16e5a2cae0dfb49c0fbf874d4d2f177acc (patch)
treef860bed3916fa485cce5f83fc0652fd27002fc8a /llvm/include/llvm-c
parent71712440bbb26b8e1789372024c3a14428b68eae (diff)
downloadllvm-35276f16e5a2cae0dfb49c0fbf874d4d2f177acc.zip
llvm-35276f16e5a2cae0dfb49c0fbf874d4d2f177acc.tar.gz
llvm-35276f16e5a2cae0dfb49c0fbf874d4d2f177acc.tar.bz2
[llvm-c] Add C API methods to match 64bit ArrayType C++ API signatures
Fixes https://github.com/llvm/llvm-project/issues/56496. As mentioned in the issue, new functions LLVMArrayType2 and LLVMGetArrayLength2 are created so as to not break the old API. The old methods are then marked as deprecated and callers are updated. Differential Revision: https://reviews.llvm.org/D143700
Diffstat (limited to 'llvm/include/llvm-c')
-rw-r--r--llvm/include/llvm-c/Core.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 94a25ff..df9db59 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -1437,20 +1437,43 @@ unsigned LLVMGetNumContainedTypes(LLVMTypeRef Tp);
* The created type will exist in the context that its element type
* exists in.
*
+ * @deprecated LLVMArrayType is deprecated in favor of the API accurate
+ * LLVMArrayType2
* @see llvm::ArrayType::get()
*/
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
/**
+ * Create a fixed size array type that refers to a specific type.
+ *
+ * The created type will exist in the context that its element type
+ * exists in.
+ *
+ * @see llvm::ArrayType::get()
+ */
+LLVMTypeRef LLVMArrayType2(LLVMTypeRef ElementType, uint64_t ElementCount);
+
+/**
* Obtain the length of an array type.
*
* This only works on types that represent arrays.
*
+ * @deprecated LLVMGetArrayLength is deprecated in favor of the API accurate
+ * LLVMGetArrayLength2
* @see llvm::ArrayType::getNumElements()
*/
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy);
/**
+ * Obtain the length of an array type.
+ *
+ * This only works on types that represent arrays.
+ *
+ * @see llvm::ArrayType::getNumElements()
+ */
+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
@@ -2118,12 +2141,22 @@ LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
/**
* Create a ConstantArray from values.
*
+ * @deprecated LLVMConstArray is deprecated in favor of the API accurate
+ * LLVMConstArray2
* @see llvm::ConstantArray::get()
*/
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
LLVMValueRef *ConstantVals, unsigned Length);
/**
+ * Create a ConstantArray from values.
+ *
+ * @see llvm::ConstantArray::get()
+ */
+LLVMValueRef LLVMConstArray2(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals,
+ uint64_t Length);
+
+/**
* Create a non-anonymous ConstantStruct from values.
*
* @see llvm::ConstantStruct::get()