[lld] c93554b - [ELF] Simplify ScriptLexer::consume. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 20 14:23:58 PDT 2024


Author: Fangrui Song
Date: 2024-07-20T14:23:54-07:00
New Revision: c93554b82aa77cf5fc43fb01a87498e0302f7b36

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

LOG: [ELF] Simplify ScriptLexer::consume. NFC

Added: 
    

Modified: 
    lld/ELF/ScriptLexer.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/ScriptLexer.cpp b/lld/ELF/ScriptLexer.cpp
index 14f39ed10e17c..d5ffe8c4dfd8c 100644
--- a/lld/ELF/ScriptLexer.cpp
+++ b/lld/ELF/ScriptLexer.cpp
@@ -282,10 +282,9 @@ StringRef ScriptLexer::peek2() {
 }
 
 bool ScriptLexer::consume(StringRef tok) {
-  if (peek() == tok) {
-    skip();
+  if (next() == tok)
     return true;
-  }
+  --pos;
   return false;
 }
 


        


More information about the llvm-commits mailing list