summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-11-13 22:55:19 +0000
committerReid Kleckner <reid@kleckner.net>2014-11-13 22:55:19 +0000
commit971c3ea67b7ba140a5d7634111fd1063d86d2cdd (patch)
tree8848ac3f29b9828ac25ca2b3128764362f430a13 /llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
parent8716b58583cf5e753f2dc2cfb214cdf24a839c43 (diff)
downloadbcm5719-llvm-971c3ea67b7ba140a5d7634111fd1063d86d2cdd.tar.gz
bcm5719-llvm-971c3ea67b7ba140a5d7634111fd1063d86d2cdd.zip
Use nullptr instead of NULL for variadic sentinels
Windows defines NULL to 0, which when used as an argument to a variadic function, is not a null pointer constant. As a result, Clang's -Wsentinel fires on this code. Using '0' would be wrong on most 64-bit platforms, but both MSVC and Clang make it work on Windows. Sidestep the issue with nullptr. llvm-svn: 221940
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index e7beb2feb62..a39f1280988 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -759,8 +759,8 @@ Value *LibCallSimplifier::optimizeStrPBrk(CallInst *CI, IRBuilder<> &B) {
bool HasS1 = getConstantStringInfo(CI->getArgOperand(0), S1);
bool HasS2 = getConstantStringInfo(CI->getArgOperand(1), S2);
- // strpbrk(s, "") -> NULL
- // strpbrk("", s) -> NULL
+ // strpbrk(s, "") -> nullptr
+ // strpbrk("", s) -> nullptr
if ((HasS1 && S1.empty()) || (HasS2 && S2.empty()))
return Constant::getNullValue(CI->getType());
@@ -1238,7 +1238,7 @@ Value *LibCallSimplifier::optimizeExp2(CallInst *CI, IRBuilder<> &B) {
Module *M = Caller->getParent();
Value *Callee =
M->getOrInsertFunction(TLI->getName(LdExp), Op->getType(),
- Op->getType(), B.getInt32Ty(), NULL);
+ Op->getType(), B.getInt32Ty(), nullptr);
CallInst *CI = B.CreateCall2(Callee, One, LdExpArg);
if (const Function *F = dyn_cast<Function>(Callee->stripPointerCasts()))
CI->setCallingConv(F->getCallingConv());
@@ -1463,15 +1463,15 @@ void insertSinCosCall(IRBuilder<> &B, Function *OrigCallee, Value *Arg,
// xmm0 and xmm1, which isn't what a real struct would do.
ResTy = T.getArch() == Triple::x86_64
? static_cast<Type *>(VectorType::get(ArgTy, 2))
- : static_cast<Type *>(StructType::get(ArgTy, ArgTy, NULL));
+ : static_cast<Type *>(StructType::get(ArgTy, ArgTy, nullptr));
} else {
Name = "__sincospi_stret";
- ResTy = StructType::get(ArgTy, ArgTy, NULL);
+ ResTy = StructType::get(ArgTy, ArgTy, nullptr);
}
Module *M = OrigCallee->getParent();
Value *Callee = M->getOrInsertFunction(Name, OrigCallee->getAttributes(),
- ResTy, ArgTy, NULL);
+ ResTy, ArgTy, nullptr);
if (Instruction *ArgInst = dyn_cast<Instruction>(Arg)) {
// If the argument is an instruction, it must dominate all uses so put our
OpenPOWER on IntegriCloud