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

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 14 12:02:42 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();
----------------
HazardyKnusperkeks wrote:

I'd just call `setFinalizedType(...)` instead of adding `setTypeIsFinalized`.

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


More information about the cfe-commits mailing list