[clang] [clang-format] TableGen multi line string support. (PR #78032)

Hirofumi Nakamura via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 16 04:16:20 PST 2024


================
@@ -274,13 +274,13 @@ void FormatTokenLexer::tryMergePreviousTokens() {
       return;
     }
   }
-  if (Style.isTableGen()) {
-    if (tryMergeTokens({tok::l_square, tok::l_brace},
-                       TT_TableGenMultiLineString)) {
-      // Multi line string starts with [{
-      Tokens.back()->Tok.setKind(tok::string_literal);
-      return;
-    }
+  // TableGen's Multi line string starts with [{
+  if (Style.isTableGen() && tryMergeTokens({tok::l_square, tok::l_brace},
+                                           TT_TableGenMultiLineString)) {
+    // This must never be annotated as other types.
+    Tokens.back()->setTypeIsFinalized();
----------------
hnakamura5 wrote:

Changed to use `setFinalizedType`.
I failed to get the idea of other usage of `setTypeIsFinalized`. It may be so specific.

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


More information about the cfe-commits mailing list