summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-11-16 16:56:03 +0000
committerAnders Carlsson <andersca@mac.com>2009-11-16 16:56:03 +0000
commit0d82fa66a561cb0456968e1ec569f68373ad657e (patch)
treec034409af4f7d6afb81ad5ca226bfba2082f2ac8 /clang/lib/CodeGen/CodeGenModule.cpp
parent2dc8d5fa3ea16c00ce01dd3eed74861489dd998f (diff)
downloadbcm5719-llvm-0d82fa66a561cb0456968e1ec569f68373ad657e.tar.gz
bcm5719-llvm-0d82fa66a561cb0456968e1ec569f68373ad657e.zip
The ssp and sspreq function attributes should only be applied to function definitions, not declarations or calls.
llvm-svn: 88915
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 26d810b4f1d..e5712e138b7 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -348,6 +348,11 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
if (D->hasAttr<NoInlineAttr>())
F->addFnAttr(llvm::Attribute::NoInline);
+ if (Features.getStackProtectorMode() == LangOptions::SSPOn)
+ F->addFnAttr(llvm::Attribute::StackProtect);
+ else if (Features.getStackProtectorMode() == LangOptions::SSPReq)
+ F->addFnAttr(llvm::Attribute::StackProtectReq);
+
if (const AlignedAttr *AA = D->getAttr<AlignedAttr>())
F->setAlignment(AA->getAlignment()/8);
// C++ ABI requires 2-byte alignment for member functions.
OpenPOWER on IntegriCloud