[lld] r320892 - [COFF] Simplify hasArgs calls. NFC
Shoaib Meenai via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 15 16:22:25 PST 2017
I agree on that being slightly confusing. I think it's used commonly enough that developers would be familiar with the semantics though.
From: Rui Ueyama <ruiu at google.com>
Date: Friday, December 15, 2017 at 4:12 PM
To: Shoaib Meenai <smeenai at fb.com>
Cc: llvm-commits <llvm-commits at lists.llvm.org>
Subject: Re: [lld] r320892 - [COFF] Simplify hasArgs calls. NFC
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<mailto: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<https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D320892-26view-3Drev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=AzVwzgmXhdIf4n9m_zQGkFvOvz1CgkmblNsyw-rMEs4&s=_DjCNpTMW1IeqXtyjlTtuA2XT0NKtDTKra5LIPrB1HA&e=>
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<https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_lld_trunk_COFF_Driver.cpp-3Frev-3D320892-26r1-3D320891-26r2-3D320892-26view-3Ddiff&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=AzVwzgmXhdIf4n9m_zQGkFvOvz1CgkmblNsyw-rMEs4&s=6Mtn1v4xVpLBnLEj9V_6611JCShdOVfweeLVb_nCz34&e=>
==============================================================================
--- 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<mailto:llvm-commits at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Dcommits&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=AzVwzgmXhdIf4n9m_zQGkFvOvz1CgkmblNsyw-rMEs4&s=6pJlwUhvceEitagkTdH9YAV-fdw15PdX5tad12MLo84&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171216/13870601/attachment.html>
More information about the llvm-commits
mailing list