[llvm] r346197 - [LLVM-C] Fix Windows Build of Core
Robert Widmann via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 5 17:54:12 PST 2018
Author: codafi
Date: Mon Nov 5 17:54:12 2018
New Revision: 346197
URL: http://llvm.org/viewvc/llvm-project?rev=346197&view=rev
Log:
[LLVM-C] Fix Windows Build of Core
strndup doesn't exist outside of GNU-land and modern macOSes. Use
strdup instead as c_str() is guaranteed to be NUL-terminated.
Modified:
llvm/trunk/lib/IR/Core.cpp
Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=346197&r1=346196&r2=346197&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Mon Nov 5 17:54:12 2018
@@ -2316,7 +2316,7 @@ const char *LLVMIntrinsicCopyOverloadedN
ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
auto Str = llvm::Intrinsic::getName(IID, Tys);
*NameLength = Str.length();
- return strndup(Str.c_str(), Str.length());
+ return strdup(Str.c_str());
}
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID) {
More information about the llvm-commits
mailing list