]> granicus.if.org Git - clang/commitdiff
Differential Revision: http://reviews.llvm.org/D19687
authorSriraman Tallam <tmsriram@google.com>
Thu, 28 Apr 2016 22:34:00 +0000 (22:34 +0000)
committerSriraman Tallam <tmsriram@google.com>
Thu, 28 Apr 2016 22:34:00 +0000 (22:34 +0000)
Set module flag PIELevel. Simplify code that sets PICLevel flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267948 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp

index 8ff99a6c404cc62518a33c3419ddd179188b3cb1..79da25c13fa3ba86e509a608df13ff0564f9f594 100644 (file)
@@ -477,15 +477,13 @@ void CodeGenModule::Release() {
   }
 
   if (uint32_t PLevel = Context.getLangOpts().PICLevel) {
-    llvm::PICLevel::Level PL = llvm::PICLevel::Default;
-    switch (PLevel) {
-    case 0: break;
-    case 1: PL = llvm::PICLevel::Small; break;
-    case 2: PL = llvm::PICLevel::Large; break;
-    default: llvm_unreachable("Invalid PIC Level");
-    }
+    assert(PLevel < 3 && "Invalid PIC Level");
+    getModule().setPICLevel(static_cast<llvm::PICLevel::Level>(PLevel));
+  }
 
-    getModule().setPICLevel(PL);
+  if (uint32_t PLevel = Context.getLangOpts().PIELevel) {
+    assert(PLevel < 3 && "Invalid PIE Level");
+    getModule().setPIELevel(static_cast<llvm::PIELevel::Level>(PLevel));
   }
 
   SimplifyPersonality();