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
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user