[llvm] bb6564a - [TableGen] Use StringRef::consume_front (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 20 18:57:49 PST 2024


Author: Kazu Hirata
Date: 2024-01-20T18:57:36-08:00
New Revision: bb6564a1b59eaaafbce46b519a45fc9d9e4f8f8a

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

LOG: [TableGen] Use StringRef::consume_front (NFC)

Added: 
    

Modified: 
    llvm/utils/TableGen/GlobalISel/CodeExpander.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/GlobalISel/CodeExpander.cpp b/llvm/utils/TableGen/GlobalISel/CodeExpander.cpp
index 20f98bef4887c7..b0baf194bafeba 100644
--- a/llvm/utils/TableGen/GlobalISel/CodeExpander.cpp
+++ b/llvm/utils/TableGen/GlobalISel/CodeExpander.cpp
@@ -31,9 +31,8 @@ void CodeExpander::emit(raw_ostream &OS) const {
     OS << Current.substr(0, Pos);
     Current = Current.substr(Pos);
 
-    if (Current.starts_with("\n")) {
+    if (Current.consume_front("\n")) {
       OS << "\n" << Indent;
-      Current = Current.drop_front(1);
       continue;
     }
 
@@ -43,10 +42,8 @@ void CodeExpander::emit(raw_ostream &OS) const {
       continue;
     }
 
-    if (Current.starts_with("\\")) {
-      Current = Current.drop_front(1);
+    if (Current.consume_front("\\"))
       continue;
-    }
 
     if (Current.starts_with("${")) {
       StringRef StartVar = Current;


        


More information about the llvm-commits mailing list