From: Sriraman Tallam Date: Thu, 28 Apr 2016 22:34:00 +0000 (+0000) Subject: Differential Revision: http://reviews.llvm.org/D19687 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c08834f41502e06fb451fc6c1f9614657e109190;p=clang Differential Revision: http://reviews.llvm.org/D19687 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 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 8ff99a6c40..79da25c13f 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/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(PLevel)); + } - getModule().setPICLevel(PL); + if (uint32_t PLevel = Context.getLangOpts().PIELevel) { + assert(PLevel < 3 && "Invalid PIE Level"); + getModule().setPIELevel(static_cast(PLevel)); } SimplifyPersonality();