[clang-query] Use StringRef::ltrim (NFC)

This commit is contained in:
Kazu Hirata 2024-01-10 20:31:41 -08:00
parent 1e05236dbd
commit 12bba0d4f8

View File

@ -28,10 +28,8 @@ namespace query {
// is found before End, return StringRef(). Begin is adjusted to exclude the
// lexed region.
StringRef QueryParser::lexWord() {
Line = Line.drop_while([](char c) {
// Don't trim newlines.
return StringRef(" \t\v\f\r").contains(c);
});
// Don't trim newlines.
Line = Line.ltrim(" \t\v\f\r");
if (Line.empty())
// Even though the Line is empty, it contains a pointer and
@ -152,8 +150,7 @@ QueryRef QueryParser::parseSetTraversalKind(TraversalKind QuerySession::*Var) {
QueryRef QueryParser::endQuery(QueryRef Q) {
StringRef Extra = Line;
StringRef ExtraTrimmed = Extra.drop_while(
[](char c) { return StringRef(" \t\v\f\r").contains(c); });
StringRef ExtraTrimmed = Extra.ltrim(" \t\v\f\r");
if ((!ExtraTrimmed.empty() && ExtraTrimmed[0] == '\n') ||
(ExtraTrimmed.size() >= 2 && ExtraTrimmed[0] == '\r' &&