r347577 - [NFC] Replace magic numbers with CodeGenOpt enums
Sam Parker via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 26 09:26:49 PST 2018
Author: sam_parker
Date: Mon Nov 26 09:26:49 2018
New Revision: 347577
URL: http://llvm.org/viewvc/llvm-project?rev=347577&view=rev
Log:
[NFC] Replace magic numbers with CodeGenOpt enums
Use enum values from llvm/Support/CodeGen.h for the optimisation
levels in CompilerInvocation.
Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=347577&r1=347576&r2=347577&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Nov 26 09:26:49 2018
@@ -120,25 +120,25 @@ CompilerInvocationBase::~CompilerInvocat
static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
DiagnosticsEngine &Diags) {
- unsigned DefaultOpt = 0;
+ unsigned DefaultOpt = llvm::CodeGenOpt::None;
if (IK.getLanguage() == InputKind::OpenCL && !Args.hasArg(OPT_cl_opt_disable))
- DefaultOpt = 2;
+ DefaultOpt = llvm::CodeGenOpt::Default;
if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
if (A->getOption().matches(options::OPT_O0))
- return 0;
+ return llvm::CodeGenOpt::None;
if (A->getOption().matches(options::OPT_Ofast))
- return 3;
+ return llvm::CodeGenOpt::Aggressive;
assert(A->getOption().matches(options::OPT_O));
StringRef S(A->getValue());
if (S == "s" || S == "z" || S.empty())
- return 2;
+ return llvm::CodeGenOpt::Default;
if (S == "g")
- return 1;
+ return llvm::CodeGenOpt::Less;
return getLastArgIntValue(Args, OPT_O, DefaultOpt, Diags);
}
More information about the cfe-commits
mailing list