[llvm] [llvm-c] Add C API methods to match size_t ConstantDataArray C++ API signatures (PR #84433)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 01:55:58 PST 2024


================
@@ -2165,23 +2165,48 @@ double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *losesInfo);
 /**
  * Create a ConstantDataSequential and initialize it with a string.
  *
+ * @deprecated LLVMConstStringInContext is deprecated in favor of the API
+ * accurate LLVMConstStringInContext2
  * @see llvm::ConstantDataArray::getString()
  */
 LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str,
                                       unsigned Length, LLVMBool DontNullTerminate);
 
+/**
+ * Create a ConstantDataSequential and initialize it with a string.
+ *
+ * @see llvm::ConstantDataArray::getString()
+ */
+LLVMValueRef LLVMConstStringInContext2(LLVMContextRef C, const char *Str,
+                                       size_t Length,
+                                       LLVMBool DontNullTerminate);
+
 /**
  * Create a ConstantDataSequential with string content in the global context.
  *
  * This is the same as LLVMConstStringInContext except it operates on the
  * global context.
  *
+ * @deprecated LLVMConstString is deprecated in favor of the API accurate
+ * LLVMConstString2
  * @see LLVMConstStringInContext()
  * @see llvm::ConstantDataArray::getString()
  */
 LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
                              LLVMBool DontNullTerminate);
 
+/**
+ * Create a ConstantDataSequential with string content in the global context.
+ *
+ * This is the same as LLVMConstStringInContext2 except it operates on the
+ * global context.
+ *
+ * @see LLVMConstStringInContext2()
+ * @see llvm::ConstantDataArray::getString()
+ */
+LLVMValueRef LLVMConstString2(const char *Str, unsigned Length,
----------------
klensy wrote:

`Length` still `unsigned` here.

https://github.com/llvm/llvm-project/pull/84433


More information about the llvm-commits mailing list