[libcxx-commits] [libcxx] 8c305a5 - [libcxx] Rename a method in PathParser for clarity. NFC.

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Sat Feb 20 00:20:25 PST 2021


Author: Martin Storsjö
Date: 2021-02-20T10:20:11+02:00
New Revision: 8c305a5d82e22c38e0c5061ee221ef0ce82f7d7c

URL: https://github.com/llvm/llvm-project/commit/8c305a5d82e22c38e0c5061ee221ef0ce82f7d7c
DIFF: https://github.com/llvm/llvm-project/commit/8c305a5d82e22c38e0c5061ee221ef0ce82f7d7c.diff

LOG: [libcxx] Rename a method in PathParser for clarity. NFC.

Differential Revision: https://reviews.llvm.org/D97081

Added: 
    

Modified: 
    libcxx/src/filesystem/operations.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp
index 6f69ca926c52..d0f0d5b99159 100644
--- a/libcxx/src/filesystem/operations.cpp
+++ b/libcxx/src/filesystem/operations.cpp
@@ -130,7 +130,7 @@ struct PathParser {
     }
       _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 @@ struct PathParser {
       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 @@ struct PathParser {
     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 @@ struct PathParser {
       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 @@ struct PathParser {
     _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 @@ struct PathParser {
 
   // 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) {


        


More information about the libcxx-commits mailing list