[llvm] r351076 - Remove NameLen argument from newly-introduced IR C APIs.
James Y Knight via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 14 09:16:55 PST 2019
Author: jyknight
Date: Mon Jan 14 09:16:55 2019
New Revision: 351076
URL: http://llvm.org/viewvc/llvm-project?rev=351076&view=rev
Log:
Remove NameLen argument from newly-introduced IR C APIs.
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
Modified:
llvm/trunk/include/llvm-c/Core.h
llvm/trunk/lib/IR/Core.cpp
Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=351076&r1=351075&r2=351076&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Mon Jan 14 09:16:55 2019
@@ -2812,8 +2812,7 @@ LLVMBasicBlockRef LLVMGetEntryBasicBlock
* @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(LLVMBu
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);
Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=351076&r1=351075&r2=351076&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Mon Jan 14 09:16:55 2019
@@ -2533,9 +2533,8 @@ LLVMBasicBlockRef LLVMGetPreviousBasicBl
}
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(LLVMBu
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,
More information about the llvm-commits
mailing list