The ssp and sspreq function attributes should only be applied to function definitions, not declarations or calls.

llvm-svn: 88915
This commit is contained in:
Anders Carlsson
2009-11-16 16:56:03 +00:00
parent 2dc8d5fa3e
commit 0d82fa66a5
2 changed files with 5 additions and 5 deletions

View File

@@ -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.