[lld] r320892 - [COFF] Simplify hasArgs calls. NFC
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 15 16:11:23 PST 2017
This is not your fault, but I think I dislike multi-argument hasArg
function. It should've been named hasAnyOf or something like that, so that
it's obvious that that's not hasAllOf.
On Fri, Dec 15, 2017 at 3:51 PM, Shoaib Meenai via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: smeenai
> Date: Fri Dec 15 15:51:14 2017
> New Revision: 320892
>
> URL: http://llvm.org/viewvc/llvm-project?rev=320892&view=rev
> Log:
> [COFF] Simplify hasArgs calls. NFC
>
> We can just pass multiple options to hasArgs (which will check for any
> of those options being present) instead of calling it multiple times.
>
> Modified:
> lld/trunk/COFF/Driver.cpp
>
> Modified: lld/trunk/COFF/Driver.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.
> cpp?rev=320892&r1=320891&r2=320892&view=diff
> ============================================================
> ==================
> --- lld/trunk/COFF/Driver.cpp (original)
> +++ lld/trunk/COFF/Driver.cpp Fri Dec 15 15:51:14 2017
> @@ -805,12 +805,11 @@ void LinkerDriver::link(ArrayRef<const c
> errorHandler().Verbose = Config->Verbose;
>
> // Handle /force or /force:unresolved
> - if (Args.hasArg(OPT_force) || Args.hasArg(OPT_force_unresolved))
> + if (Args.hasArg(OPT_force, OPT_force_unresolved))
> Config->Force = true;
>
> // Handle /debug
> - if (Args.hasArg(OPT_debug) || Args.hasArg(OPT_debug_dwarf) ||
> - Args.hasArg(OPT_debug_ghash)) {
> + if (Args.hasArg(OPT_debug, OPT_debug_dwarf, OPT_debug_ghash)) {
> Config->Debug = true;
> if (auto *Arg = Args.getLastArg(OPT_debugtype))
> Config->DebugTypes = parseDebugType(Arg->getValue());
> @@ -1152,7 +1151,7 @@ void LinkerDriver::link(ArrayRef<const c
> }
>
> // Disable PDB generation if the user requested it.
> - if (Args.hasArg(OPT_nopdb) || Args.hasArg(OPT_debug_dwarf))
> + if (Args.hasArg(OPT_nopdb, OPT_debug_dwarf))
> Config->PDBPath = "";
>
> // Set default image base if /base is not given.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171215/e039efe3/attachment.html>
More information about the llvm-commits
mailing list