[llvm] [NFC][Support] Create helper function to parse bool. (PR #102818)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 11 16:18:22 PDT 2024
jurahul wrote:
But that would match more than what is in the code current. For example,
tRue or TrUE.
On Sun, Aug 11, 2024 at 4:16 PM Alexandre Ganea ***@***.***>
wrote:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In llvm/lib/Support/CommandLine.cpp
> <https://github.com/llvm/llvm-project/pull/102818#discussion_r1713076522>:
>
> > @@ -404,6 +404,22 @@ class CommandLineParser {
>
> static ManagedStatic<CommandLineParser> GlobalParser;
>
> +template <typename T, T TrueVal, T FalseVal>
> +static bool parseBool(Option &O, StringRef ArgName, StringRef Arg, T &Value) {
> + if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" ||
>
> We could use Arg.equals_insensitive("true") here. Same below for false
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/llvm/llvm-project/pull/102818#pullrequestreview-2231908615>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/APRMUB3HDTMB3NLLRPFPXMLZQ7WE5AVCNFSM6AAAAABMK2O2K6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDEMZRHEYDQNRRGU>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
https://github.com/llvm/llvm-project/pull/102818
More information about the llvm-commits
mailing list