[llvm] [TableGen] Remove explicit recursion in LexToken (PR #143697)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 11 07:59:00 PDT 2025


================
@@ -188,12 +189,12 @@ tgtok::TokKind TGLexer::LexToken(bool FileOrLineStart) {
     return ReturnError(TokStart, "unexpected character");
   case EOF:
     // Lex next token, if we just left an include file.
-    // Note that leaving an include file means that the next
-    // symbol is located at the end of the 'include "..."'
-    // construct, so LexToken() is called with default
-    // false parameter.
-    if (processEOF())
-      return LexToken();
+    if (processEOF()) {
+      // Leaving an include file means that the next symbol is located at the
+      // end of the 'include "..."'  construct.
+      FileOrLineStart = false;
+      goto restart;
+    }
----------------
jayfoad wrote:

Sure, here's what it looks like. I'm happy to go with whichever version reviewers prefer.

https://github.com/llvm/llvm-project/pull/143697


More information about the llvm-commits mailing list