]> granicus.if.org Git - llvm/commitdiff
Remove NameLen argument from newly-introduced IR C APIs.
authorJames Y Knight <jyknight@google.com>
Mon, 14 Jan 2019 17:16:55 +0000 (17:16 +0000)
committerJames Y Knight <jyknight@google.com>
Mon, 14 Jan 2019 17:16:55 +0000 (17:16 +0000)
Normally, changing the function signatures of C APIs is disallowed,
but as these two are brand new last week, and haven't been released
yet, it is okay in this instance.

As per discussion in D56556, we will not add NameLen arguments to IR
building APIs, for the following reasons:

1. We do not want to deprecate all of the IR building APIs, just to add a
NameLen argument to each one.

2. Consistency is important, so adding it just to new ones is unfortunate.

3. The IR names are completely optional, useful for readability of IR
only. There is no value in ever supporting nul bytes.

Differential Revision: https://reviews.llvm.org/D56669

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351076 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm-c/Core.h
lib/IR/Core.cpp

index e22e4b78eec63359b58de718050e4c360275d3c3..8a67e3bba3dfdc39bc1305a52fa621c1d3d919a6 100644 (file)
@@ -2812,8 +2812,7 @@ LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn);
  * @see llvm::BasicBlock::Create()
  */
 LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C,
-                                                const char *Name,
-                                                size_t NameLen);
+                                                const char *Name);
 
 /**
  * Append a basic block to the end of a function.
@@ -3644,7 +3643,7 @@ LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef, LLVMValueRef Val,
                                   LLVMTypeRef DestTy, const char *Name);
 LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef, LLVMValueRef Val,
                                LLVMTypeRef DestTy, LLVMBool IsSigned,
-                               const char *Name, size_t NameLen);
+                               const char *Name);
 LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef, LLVMValueRef Val,
                              LLVMTypeRef DestTy, const char *Name);
 
index 6f7c7afc59de2cc2af32458c79f765c8892e353d..357b8cd43ab3b15ecf155bef25ddffb2e65feea1 100644 (file)
@@ -2533,9 +2533,8 @@ LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB) {
 }
 
 LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C,
-                                                const char *Name,
-                                                size_t NameLen) {
-  return wrap(llvm::BasicBlock::Create(*unwrap(C), StringRef(Name, NameLen)));
+                                                const char *Name) {
+  return wrap(llvm::BasicBlock::Create(*unwrap(C), Name));
 }
 
 LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C,
@@ -3542,9 +3541,9 @@ LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val,
 
 LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef B, LLVMValueRef Val,
                                LLVMTypeRef DestTy, LLVMBool IsSigned,
-                               const char *Name, size_t NameLen) {
-  return wrap(unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy),
-                                       IsSigned, StringRef(Name, NameLen)));
+                               const char *Name) {
+  return wrap(
+      unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy), IsSigned, Name));
 }
 
 LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val,