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

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 13 12:22:00 PST 2024


================
@@ -763,6 +773,53 @@ void FormatTokenLexer::handleCSharpVerbatimAndInterpolatedStrings() {
   resetLexer(SourceMgr.getFileOffset(Lex->getSourceLocation(Offset + 1)));
 }
 
+void FormatTokenLexer::handleTableGenMultilineString() {
+  FormatToken *MultiLineString = Tokens.back();
+  if (MultiLineString->isNot(TT_TableGenMultiLineString))
+    return;
+
+  bool PrevIsRBrace = false;
+  const char *FirstBreak = nullptr;
+  const char *LastBreak = nullptr;
+  const char *Begin = MultiLineString->TokenText.begin();
+  // Skip until }], the closer of multi line string found.
+  for (const char *Current = Begin, *End = Lex->getBuffer().end();
----------------
HazardyKnusperkeks wrote:

So you have a `const char` range? How about just using `find("}]")`?

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


More information about the cfe-commits mailing list