From 68729f94ee8383921ef638a300009a88138dc30f Mon Sep 17 00:00:00 2001 From: James Y Knight Date: Mon, 14 Jan 2019 17:16:55 +0000 Subject: [PATCH] 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 llvm-svn: 351076 --- llvm/include/llvm-c/Core.h | 5 ++--- llvm/lib/IR/Core.cpp | 11 +++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h index e22e4b7..8a67e3b 100644 --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -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); diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index 6f7c7af..357b8cd4 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -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, -- 2.7.4