diff --git a/lld/ELF/ScriptLexer.cpp b/lld/ELF/ScriptLexer.cpp index 14f39ed10e17..d5ffe8c4dfd8 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; }