[clang-tools-extra] 12bba0d - [clang-query] Use StringRef::ltrim (NFC)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 10 20:31:47 PST 2024
Author: Kazu Hirata
Date: 2024-01-10T20:31:41-08:00
New Revision: 12bba0d4f8c2df655958decb8eb788327543b3fe
URL: https://github.com/llvm/llvm-project/commit/12bba0d4f8c2df655958decb8eb788327543b3fe
DIFF: https://github.com/llvm/llvm-project/commit/12bba0d4f8c2df655958decb8eb788327543b3fe.diff
LOG: [clang-query] Use StringRef::ltrim (NFC)
Added:
Modified:
clang-tools-extra/clang-query/QueryParser.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-query/QueryParser.cpp b/clang-tools-extra/clang-query/QueryParser.cpp
index 41933625a4fa07..162acc1a598dd5 100644
--- a/clang-tools-extra/clang-query/QueryParser.cpp
+++ b/clang-tools-extra/clang-query/QueryParser.cpp
@@ -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' &&
More information about the cfe-commits
mailing list