Add stack protector support to clang. This generates the 'ssp' and 'sspreq'
function attributes. There are predefined macros that are defined when stack
protectors are used: __SSP__=1 with -fstack-protector and __SSP_ALL__=2 with
-fstack-protector-all.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74405 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
index 730414e..554868f 100644
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -423,7 +423,12 @@
   sprintf(MacroBuf, "__DECIMAL_DIG__=%d",
           PickFP(&TI.getLongDoubleFormat(), -1/*FIXME*/, 17, 21, 33, 36));
   DefineBuiltinMacro(Buf, MacroBuf);
-  
+
+  if (LangOpts.StackProtector == 1)
+    DefineBuiltinMacro(Buf, "__SSP__=1");
+  else if (LangOpts.StackProtector == 2)
+    DefineBuiltinMacro(Buf, "__SSP_ALL__=2");
+
   // Get other target #defines.
   TI.getTargetDefines(LangOpts, Buf);
 }