summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/StackProtector.cpp
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2017-04-06 20:09:31 +0000
committerMehdi Amini <mehdi.amini@apple.com>2017-04-06 20:09:31 +0000
commit579540a8f7967fdbc8b0bf7cd214a6b12a98a362 (patch)
tree09f39a11e4a7fde5de6cb576bd373684b4870ad7 /llvm/lib/CodeGen/StackProtector.cpp
parent0680968ff3e4971a870932ef0c9ff6f793bdb289 (diff)
downloadbcm5719-llvm-579540a8f7967fdbc8b0bf7cd214a6b12a98a362.tar.gz
bcm5719-llvm-579540a8f7967fdbc8b0bf7cd214a6b12a98a362.zip
Turn some C-style vararg into variadic templates
Module::getOrInsertFunction is using C-style vararg instead of variadic templates. From a user prospective, it forces the use of an annoying nullptr to mark the end of the vararg, and there's not type checking on the arguments. The variadic template is an obvious solution to both issues. Patch by: Serge Guelton <serge.guelton@telecom-bretagne.eu> Differential Revision: https://reviews.llvm.org/D31070 llvm-svn: 299699
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r--llvm/lib/CodeGen/StackProtector.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp
index e3fdb96f620..7230b01fe2c 100644
--- a/llvm/lib/CodeGen/StackProtector.cpp
+++ b/llvm/lib/CodeGen/StackProtector.cpp
@@ -481,16 +481,15 @@ BasicBlock *StackProtector::CreateFailBB() {
IRBuilder<> B(FailBB);
B.SetCurrentDebugLocation(DebugLoc::get(0, 0, F->getSubprogram()));
if (Trip.isOSOpenBSD()) {
- Constant *StackChkFail =
- M->getOrInsertFunction("__stack_smash_handler",
- Type::getVoidTy(Context),
- Type::getInt8PtrTy(Context), nullptr);
+ Constant *StackChkFail = M->getOrInsertFunction(
+ "__stack_smash_handler", Type::getVoidTy(Context),
+ Type::getInt8PtrTy(Context));
B.CreateCall(StackChkFail, B.CreateGlobalStringPtr(F->getName(), "SSH"));
} else {
Constant *StackChkFail =
- M->getOrInsertFunction("__stack_chk_fail", Type::getVoidTy(Context),
- nullptr);
+ M->getOrInsertFunction("__stack_chk_fail", Type::getVoidTy(Context));
+
B.CreateCall(StackChkFail, {});
}
B.CreateUnreachable();
OpenPOWER on IntegriCloud