[PATCH] D133658: [Support] Use find() for faster StringRef::count.
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 26 02:45:08 PDT 2022
nikic requested changes to this revision.
nikic added inline comments.
This revision now requires changes to proceed.
================
Comment at: llvm/lib/Support/StringRef.cpp:374
size_t N = Str.size();
- if (!N || N > Length)
- return 0;
----------------
The `!N` condition needs to be retained, otherwise we will go into an infinite loop for an empty `Str`. I believe this causes the ADTTest timeout.
(Returning `0` for an empty string isn't really right, this should return `Length + 1`, but this is orthogonal to your change.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133658/new/
https://reviews.llvm.org/D133658
More information about the llvm-commits
mailing list