[cfe-commits] r88915 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CodeGenModule.cpp

Anders Carlsson andersca at mac.com
Mon Nov 16 08:56:03 PST 2009


Author: andersca
Date: Mon Nov 16 10:56:03 2009
New Revision: 88915

URL: http://llvm.org/viewvc/llvm-project?rev=88915&view=rev
Log:
The ssp and sspreq function attributes should only be applied to function definitions, not declarations or calls.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=88915&r1=88914&r2=88915&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Nov 16 10:56:03 2009
@@ -448,11 +448,6 @@
   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();

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=88915&r1=88914&r2=88915&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Nov 16 10:56:03 2009
@@ -348,6 +348,11 @@
   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.





More information about the cfe-commits mailing list