[clang] [clang-format] TableGen multi line string support. (PR #78032)
Hirofumi Nakamura via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 13 21:37:10 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();
----------------
hnakamura5 wrote:
Changed the algorithm to use find and rfind as suggestion. The new one looks better.
https://github.com/llvm/llvm-project/pull/78032
More information about the cfe-commits
mailing list