[llvm-dev] StringRef hasAnyOf/hasAllOf

Davide Italiano via llvm-dev llvm-dev at lists.llvm.org
Fri Feb 23 11:16:35 PST 2018


On Fri, Feb 23, 2018 at 10:54 AM, Davide Italiano <davide at freebsd.org> wrote:
> Hi,
> a downstream consumer of llvm I'm currently working provides the
> following two functions:
>
> static bool StringHasAllOf(const llvm::StringRef &s, const char *which);
> static bool StringHasAnyOf(const llvm::StringRef &s,
> std::initializer_list<const char *> which, size_t &where);
>
> https://github.com/apple/swift-lldb/blob/stable/source/Target/SwiftLanguageRuntime.cpp#L691
> https://github.com/apple/swift-lldb/blob/stable/source/Target/SwiftLanguageRuntime.cpp#L699
>
> I'm under the impression these could be member functions of StringRef
> (maybe with a different signature).
>
> My only concern is that while I think these may be useful for the
> general public, I haven't found any immediate use for them in llvm.
> So I would like to hear what folks think before proposing the change/patch.
>
> Thanks,
>

Joerg correctly pointed out on IRC we already have them in LLVM (thanks Joerg).
StringRef::find_{first,last}_{not_}of

I'll just convert the uses. Sorry for the noise!

--
Davide


More information about the llvm-dev mailing list