[PATCH] D146394: [NFC] Replace strlen with StringRef::size
Hans Wennborg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 21 03:12:07 PDT 2023
hans added inline comments.
================
Comment at: llvm/lib/Option/Option.cpp:208
// Matches iff this is an exact match.
- // FIXME: Avoid strlen.
- if (ArgSize != strlen(Args.getArgString(Index)))
----------------
vitalybuka wrote:
> @hans do you know what this TODO is about, https://reviews.llvm.org/D1387
> If this is about performance, we still have strlen in StringRef
>
I just copied it from the other flag classes. The FIXMEs were added in https://github.com/llvm/llvm-project/commit/458b6982d471992337639382cdac1bb30311b4c0
I'm guessing the author figured the sizes should already be known (I think the ArgList is storing StringRefs maybe?) and the strlen shouldn't really be needed.
I think that's a minor detail, but one day it would be nice to modernize the whole options framework and use less char pointers.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146394/new/
https://reviews.llvm.org/D146394
More information about the llvm-commits
mailing list