r267948 - Differential Revision: http://reviews.llvm.org/D19687

Sriraman Tallam via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 15:34:01 PDT 2016


Author: tmsriram
Date: Thu Apr 28 17:34:00 2016
New Revision: 267948

URL: http://llvm.org/viewvc/llvm-project?rev=267948&view=rev
Log:
Differential Revision: http://reviews.llvm.org/D19687

Set module flag PIELevel. Simplify code that sets PICLevel flag.

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

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=267948&r1=267947&r2=267948&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Apr 28 17:34:00 2016
@@ -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();




More information about the cfe-commits mailing list