[llvm] [FixBUG][llvm-tblgen] : The correct td file ending with #endif cannot be compiled (PR #69411)

zhao jiangtao via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 19:25:00 PDT 2023


https://github.com/whousemyname updated https://github.com/llvm/llvm-project/pull/69411

>From 27a10d3c75ec01595e005fd12e5b250fdc08952f Mon Sep 17 00:00:00 2001
From: angryZ <lazytortoisezzzz at gmail.com>
Date: Wed, 18 Oct 2023 10:39:56 +0800
Subject: [PATCH] [llvm][Tablegen][BUG] : The correct td file ending with
 #endif (there are no other characters after #endif, including newlines) still
 cannot be compiled. This PR is to solve this bug.

---
 llvm/lib/TableGen/TGLexer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/TableGen/TGLexer.cpp b/llvm/lib/TableGen/TGLexer.cpp
index d5140e91fce9e94..3bedbcd6307fd15 100644
--- a/llvm/lib/TableGen/TGLexer.cpp
+++ b/llvm/lib/TableGen/TGLexer.cpp
@@ -664,7 +664,7 @@ tgtok::TokKind TGLexer::prepIsDirective() const {
           // It looks like TableGen does not support '\r' as the actual
           // carriage return, e.g. getNextChar() treats a single '\r'
           // as '\n'.  So we do the same here.
-          NextChar == '\r')
+          NextChar == '\r' || NextChar == '\0')
         return Kind;
 
       // Allow comments after some directives, e.g.:



More information about the llvm-commits mailing list