Make the StackProtector bitfield use enums instead of obscure numbers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74414 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index a1efe01..641d119 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -819,9 +819,14 @@
Options.Static = StaticDefine;
- assert(StackProtector <= 2 && "Invalid value for -stack-protector");
- if (StackProtector != -1)
- Options.StackProtector = StackProtector;
+ switch (StackProtector) {
+ default:
+ assert(StackProtector <= 2 && "Invalid value for -stack-protector");
+ case -1: break;
+ case 0: Options.setStackProtectorMode(LangOptions::SSPOff); break;
+ case 1: Options.setStackProtectorMode(LangOptions::SSPOn); break;
+ case 2: Options.setStackProtectorMode(LangOptions::SSPReq); break;
+ }
if (MainFileName.getPosition())
Options.setMainFileName(MainFileName.c_str());