From f8014f82edc54e81ed7b169c0d61891a95c3f07b Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Fri, 26 Aug 2016 15:22:59 +0000 Subject: [PATCH] [lib/LTO] Add an assertion to catch invalid opt levels. llvm-svn: 279823 --- llvm/lib/LTO/LTOCodeGenerator.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index 1120ad8..7f3d30a 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -185,17 +185,18 @@ void LTOCodeGenerator::setOptLevel(unsigned Level) { switch (OptLevel) { case 0: CGOptLevel = CodeGenOpt::None; - break; + return; case 1: CGOptLevel = CodeGenOpt::Less; - break; + return; case 2: CGOptLevel = CodeGenOpt::Default; - break; + return; case 3: CGOptLevel = CodeGenOpt::Aggressive; - break; + return; } + llvm_unreachable("Unknown optimization level!"); } bool LTOCodeGenerator::writeMergedModules(const char *Path) { -- 2.7.4