[libcxx-commits] [PATCH] D97081: [libcxx] Rename a method in PathParser for clarity. NFC.
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Feb 19 12:49:29 PST 2021
mstorsjo created this revision.
mstorsjo added reviewers: libc++, curdeius, ldionne.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added 1 blocking reviewer(s): libc++.
This was requested in the review of D91176 <https://reviews.llvm.org/D91176>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97081
Files:
libcxx/src/filesystem/operations.cpp
Index: libcxx/src/filesystem/operations.cpp
===================================================================
--- libcxx/src/filesystem/operations.cpp
+++ libcxx/src/filesystem/operations.cpp
@@ -130,7 +130,7 @@
}
_LIBCPP_FALLTHROUGH();
case PS_InRootName: {
- PosPtr TkEnd = consumeSeparator(Start, End);
+ PosPtr TkEnd = consumeAllSeparators(Start, End);
if (TkEnd)
return makeState(PS_InRootDir, Start, TkEnd);
else
@@ -140,7 +140,7 @@
return makeState(PS_InFilenames, Start, consumeName(Start, End));
case PS_InFilenames: {
- PosPtr SepEnd = consumeSeparator(Start, End);
+ PosPtr SepEnd = consumeAllSeparators(Start, End);
if (SepEnd != End) {
PosPtr TkEnd = consumeName(SepEnd, End);
if (TkEnd)
@@ -166,7 +166,7 @@
switch (State) {
case PS_AtEnd: {
// Try to consume a trailing separator or root directory first.
- if (PosPtr SepEnd = consumeSeparator(RStart, REnd)) {
+ if (PosPtr SepEnd = consumeAllSeparators(RStart, REnd)) {
if (SepEnd == REnd)
return makeState(PS_InRootDir, Path.data(), RStart + 1);
PosPtr TkStart = consumeRootName(SepEnd, REnd);
@@ -185,7 +185,7 @@
return makeState(PS_InFilenames, consumeName(RStart, REnd) + 1,
RStart + 1);
case PS_InFilenames: {
- PosPtr SepEnd = consumeSeparator(RStart, REnd);
+ PosPtr SepEnd = consumeAllSeparators(RStart, REnd);
if (SepEnd == REnd)
return makeState(PS_InRootDir, Path.data(), RStart + 1);
PosPtr TkStart = consumeRootName(SepEnd ? SepEnd : RStart, REnd);
@@ -304,7 +304,8 @@
_LIBCPP_UNREACHABLE();
}
- PosPtr consumeSeparator(PosPtr P, PosPtr End) const noexcept {
+ // Consume all consecutive separators.
+ PosPtr consumeAllSeparators(PosPtr P, PosPtr End) const noexcept {
if (P == nullptr || P == End || !isSeparator(*P))
return nullptr;
const int Inc = P < End ? 1 : -1;
@@ -316,7 +317,7 @@
// Consume exactly N separators, or return nullptr.
PosPtr consumeNSeparators(PosPtr P, PosPtr End, int N) const noexcept {
- PosPtr Ret = consumeSeparator(P, End);
+ PosPtr Ret = consumeAllSeparators(P, End);
if (Ret == nullptr)
return nullptr;
if (P < End) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97081.325070.patch
Type: text/x-patch
Size: 2315 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210219/397c3f18/attachment.bin>
More information about the libcxx-commits
mailing list