[llvm] 1df4fb9 - [Support] Use StringRef::ltrim (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 18:40:05 PST 2024


Author: Kazu Hirata
Date: 2024-01-12T18:39:53-08:00
New Revision: 1df4fb98813a33d14f2112a1bb906039d112fa3f

URL: https://github.com/llvm/llvm-project/commit/1df4fb98813a33d14f2112a1bb906039d112fa3f
DIFF: https://github.com/llvm/llvm-project/commit/1df4fb98813a33d14f2112a1bb906039d112fa3f.diff

LOG: [Support] Use StringRef::ltrim (NFC)

Added: 
    

Modified: 
    llvm/lib/Support/StringRef.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp
index decd06abbeb15f..945ae378eb910b 100644
--- a/llvm/lib/Support/StringRef.cpp
+++ b/llvm/lib/Support/StringRef.cpp
@@ -517,8 +517,7 @@ bool StringRef::consumeInteger(unsigned Radix, APInt &Result) {
 
   // Skip leading zeroes.  This can be a significant improvement if
   // it means we don't need > 64 bits.
-  while (!Str.empty() && Str.front() == '0')
-    Str = Str.substr(1);
+  Str = Str.ltrim('0');
 
   // If it was nothing but zeroes....
   if (Str.empty()) {


        


More information about the llvm-commits mailing list