summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 8ff99a6c404..79da25c13fa 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -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();
OpenPOWER on IntegriCloud