Author: Kazu Hirata
Date: 2024-01-28T10:47:03-08:00
New Revision: d1427fb6d0e1dbe3b7dbf46c26e43ce96b9b56d5

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

LOG: [Edit] Use StringRef::consume_back (NFC)

Added: 
    

Modified: 
    clang/lib/Edit/RewriteObjCFoundationAPI.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp 
b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
index d5bf553e241240d..2e123e89b00365a 100644
--- a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
+++ b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
@@ -697,11 +697,7 @@ static bool getLiteralInfo(SourceRange literalRange,
 
   struct Suff {
     static bool has(StringRef suff, StringRef &text) {
-      if (text.ends_with(suff)) {
-        text = text.substr(0, text.size()-suff.size());
-        return true;
-      }
-      return false;
+      return text.consume_back(suff);
     }
   };
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to