[clang] 5c37e71 - [Frontend] Use StringRef::drop_while (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 28 10:06:31 PST 2023


Author: Kazu Hirata
Date: 2023-12-28T10:06:20-08:00
New Revision: 5c37e711df6b81c2b669fb8a0d8b15f7a79e6e4a

URL: https://github.com/llvm/llvm-project/commit/5c37e711df6b81c2b669fb8a0d8b15f7a79e6e4a
DIFF: https://github.com/llvm/llvm-project/commit/5c37e711df6b81c2b669fb8a0d8b15f7a79e6e4a.diff

LOG: [Frontend] Use StringRef::drop_while (NFC)

Added: 
    

Modified: 
    clang/lib/Frontend/LayoutOverrideSource.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/LayoutOverrideSource.cpp b/clang/lib/Frontend/LayoutOverrideSource.cpp
index f474d4fe8fdcb8..a1866ec09c9d3d 100644
--- a/clang/lib/Frontend/LayoutOverrideSource.cpp
+++ b/clang/lib/Frontend/LayoutOverrideSource.cpp
@@ -147,8 +147,7 @@ LayoutOverrideSource::LayoutOverrideSource(StringRef Filename) {
 
         // Skip over this offset, the following comma, and any spaces.
         LineStr = LineStr.substr(1);
-        while (!LineStr.empty() && isWhitespace(LineStr[0]))
-          LineStr = LineStr.substr(1);
+        LineStr = LineStr.drop_while(isWhitespace);
       }
     }
 
@@ -163,8 +162,7 @@ LayoutOverrideSource::LayoutOverrideSource(StringRef Filename) {
 
         // Skip over this offset, the following comma, and any spaces.
         LineStr = LineStr.substr(1);
-        while (!LineStr.empty() && isWhitespace(LineStr[0]))
-          LineStr = LineStr.substr(1);
+        LineStr = LineStr.drop_while(isWhitespace);
       }
       continue;
     }
@@ -180,8 +178,7 @@ LayoutOverrideSource::LayoutOverrideSource(StringRef Filename) {
 
         // Skip over this offset, the following comma, and any spaces.
         LineStr = LineStr.substr(1);
-        while (!LineStr.empty() && isWhitespace(LineStr[0]))
-          LineStr = LineStr.substr(1);
+        LineStr = LineStr.drop_while(isWhitespace);
       }
     }
   }


        


More information about the cfe-commits mailing list