diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-11-13 22:55:19 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-11-13 22:55:19 +0000 |
commit | 971c3ea67b7ba140a5d7634111fd1063d86d2cdd (patch) | |
tree | 8848ac3f29b9828ac25ca2b3128764362f430a13 /llvm/lib/CodeGen | |
parent | 8716b58583cf5e753f2dc2cfb214cdf24a839c43 (diff) | |
download | bcm5719-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/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/ShadowStackGC.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SjLjEHPrepare.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/StackProtector.cpp | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/ShadowStackGC.cpp b/llvm/lib/CodeGen/ShadowStackGC.cpp index f7c64dac612..0be00f0e7ce 100644 --- a/llvm/lib/CodeGen/ShadowStackGC.cpp +++ b/llvm/lib/CodeGen/ShadowStackGC.cpp @@ -144,7 +144,7 @@ namespace { LLVMContext &C = F.getContext(); BasicBlock *CleanupBB = BasicBlock::Create(C, CleanupBBName, &F); Type *ExnTy = StructType::get(Type::getInt8PtrTy(C), - Type::getInt32Ty(C), NULL); + Type::getInt32Ty(C), nullptr); Constant *PersFn = F.getParent()-> getOrInsertFunction("__gcc_personality_v0", diff --git a/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/llvm/lib/CodeGen/SjLjEHPrepare.cpp index 396fa5239da..df6ba0b723a 100644 --- a/llvm/lib/CodeGen/SjLjEHPrepare.cpp +++ b/llvm/lib/CodeGen/SjLjEHPrepare.cpp @@ -99,7 +99,7 @@ bool SjLjEHPrepare::doInitialization(Module &M) { VoidPtrTy, // __personality VoidPtrTy, // __lsda ArrayType::get(VoidPtrTy, 5), // __jbuf - NULL); + nullptr); RegisterFn = M.getOrInsertFunction( "_Unwind_SjLj_Register", Type::getVoidTy(M.getContext()), PointerType::getUnqual(FunctionContextTy), (Type *)nullptr); diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp index e478f31d545..91cc7b70e7f 100644 --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/lib/CodeGen/StackProtector.cpp @@ -480,12 +480,12 @@ BasicBlock *StackProtector::CreateFailBB() { if (Trip.getOS() == llvm::Triple::OpenBSD) { Constant *StackChkFail = M->getOrInsertFunction( "__stack_smash_handler", Type::getVoidTy(Context), - Type::getInt8PtrTy(Context), NULL); + Type::getInt8PtrTy(Context), nullptr); B.CreateCall(StackChkFail, B.CreateGlobalStringPtr(F->getName(), "SSH")); } else { Constant *StackChkFail = M->getOrInsertFunction( - "__stack_chk_fail", Type::getVoidTy(Context), NULL); + "__stack_chk_fail", Type::getVoidTy(Context), nullptr); B.CreateCall(StackChkFail); } B.CreateUnreachable(); |