From: Jessica Paquette Date: Mon, 25 Jun 2018 23:20:18 +0000 (+0000) Subject: [MachineOutliner] NFC - simplify -moutline/-mno-outline logic X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c877647f1b60d295bfea9d984c1c9844aadc4e61;p=clang [MachineOutliner] NFC - simplify -moutline/-mno-outline logic It's a bit cleaner to use `hasFlag` instead of nested ifs. This just refactors the -moutline/-mno-outline logic to use that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335549 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp index 5cb3796723..327fa6b57b 100644 --- a/lib/Driver/ToolChains/Clang.cpp +++ b/lib/Driver/ToolChains/Clang.cpp @@ -1477,19 +1477,16 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args, CmdArgs.push_back("-aarch64-enable-global-merge=true"); } - if (Arg *A = Args.getLastArg(options::OPT_moutline, - options::OPT_mno_outline)) { - if (A->getOption().matches(options::OPT_moutline)) { - CmdArgs.push_back("-mllvm"); - CmdArgs.push_back("-enable-machine-outliner"); + if (Args.hasFlag(options::OPT_moutline, options::OPT_mno_outline, false)) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back("-enable-machine-outliner"); - // The outliner shouldn't compete with linkers that dedupe linkonceodr - // functions in LTO. Enable that behaviour by default when compiling with - // LTO. - if (getToolChain().getDriver().isUsingLTO()) { - CmdArgs.push_back("-mllvm"); - CmdArgs.push_back("-enable-linkonceodr-outlining"); - } + // The outliner shouldn't compete with linkers that dedupe linkonceodr + // functions in LTO. Enable that behaviour by default when compiling with + // LTO. + if (getToolChain().getDriver().isUsingLTO()) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back("-enable-linkonceodr-outlining"); } } }