]> granicus.if.org Git - clang/commitdiff
The ssp and sspreq function attributes should only be applied to function definitions...
authorAnders Carlsson <andersca@mac.com>
Mon, 16 Nov 2009 16:56:03 +0000 (16:56 +0000)
committerAnders Carlsson <andersca@mac.com>
Mon, 16 Nov 2009 16:56:03 +0000 (16:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88915 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCall.cpp
lib/CodeGen/CodeGenModule.cpp

index 5d8e5c2c4f650f1c45bcc9eb1f44d0792c55153e..d0c7d03f20efecbf01cb2b62d67de17cac37f871 100644 (file)
@@ -448,11 +448,6 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
   if (CodeGenOpts.NoImplicitFloat)
     FuncAttrs |= llvm::Attribute::NoImplicitFloat;
 
-  if (Features.getStackProtectorMode() == LangOptions::SSPOn)
-    FuncAttrs |= llvm::Attribute::StackProtect;
-  else if (Features.getStackProtectorMode() == LangOptions::SSPReq)
-    FuncAttrs |= llvm::Attribute::StackProtectReq;
-
   QualType RetTy = FI.getReturnType();
   unsigned Index = 1;
   const ABIArgInfo &RetAI = FI.getReturnInfo();
index 26d810b4f1decb7ec9d4b9284cb7fe18666017bc..e5712e138b742a423049cf2d12402e19ebbe48c5 100644 (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.