[PATCH] D76496: [clang-tidy] StringFindStartswith should ignore 3-arg find()

Niko Weh via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 30 07:33:11 PDT 2020


niko added a comment.

In D76496#1947127 <https://reviews.llvm.org/D76496#1947127>, @njames93 wrote:

> In D76496#1947059 <https://reviews.llvm.org/D76496#1947059>, @niko wrote:
>
> > In D76496#1935127 <https://reviews.llvm.org/D76496#1935127>, @njames93 wrote:
> >
> > > I'm not hugely familiar with the abseil library, but from what I can see `absl::StartsWith` takes `absl::string_view` as args. Therefore surely it makes sense to handle the 3rd arg for `str::find` by explicitly constructing the `absl::string_view` from the pointer and size.
> >
> >
> > I am mainly worried that the 3-arg find is rarely used, and using absl::string_view requires another option to be specified for the header file. If you think that's still a good tradeoff i'll change it to construct a string_view.
>
>
> The `absl/strings/match` header includes the `absl/strings/string_view` header so you wouldn't need to include another header file. Well that's as long as the user hasn't done something funky with header files, but arguably the shouldn't be using Fix-Its if they have done something like that.


Correct me if I'm wrong, but that seems to be in violation of IWYU? Maybe I'm misreading this, or is the idea that higher-lever tooling (e.g. IWYU fixer) is supposed to address that?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76496/new/

https://reviews.llvm.org/D76496





More information about the cfe-commits mailing list