diff options
author | Hirofumi Nakamura <k.nakamura.hirofumi@gmail.com> | 2024-02-12 23:27:09 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-12 23:27:09 +0900 |
commit | 6a471611a4b98396abb0680229aa0694ffe88a43 (patch) | |
tree | 69551bc97c5416782635c4ec4b9fdcdc63f1bb12 /clang/lib/Format/FormatTokenLexer.cpp | |
parent | 50ed98f1cf2516c59de0351fa683639c937782ea (diff) | |
download | llvm-6a471611a4b98396abb0680229aa0694ffe88a43.zip llvm-6a471611a4b98396abb0680229aa0694ffe88a43.tar.gz llvm-6a471611a4b98396abb0680229aa0694ffe88a43.tar.bz2 |
[clang-format] Support of TableGen value annotations. (#80299)
This implements the annotation of the values in TableGen.
The main changes are,
- parseTableGenValue(), the simplified parser method for the syntax of
values.
- modified consumeToken() to parseTableGenValue in 'if', 'assert' and
after '='.
- modified parseParens() to call parseTableGenValue inside.
- modified parseSquare() to to call parseTableGenValue inside, with
skipping separator tokens.
- modified parseAngle() to call parseTableGenValue inside, with skipping
separator tokens.
Diffstat (limited to 'clang/lib/Format/FormatTokenLexer.cpp')
-rw-r--r-- | clang/lib/Format/FormatTokenLexer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp index a57659f..492e7e9 100644 --- a/clang/lib/Format/FormatTokenLexer.cpp +++ b/clang/lib/Format/FormatTokenLexer.cpp @@ -812,7 +812,7 @@ void FormatTokenLexer::handleTableGenMultilineString() { auto CloseOffset = Lex->getBuffer().find("}]", OpenOffset); if (CloseOffset == StringRef::npos) return; - auto Text = Lex->getBuffer().substr(OpenOffset, CloseOffset + 2); + auto Text = Lex->getBuffer().substr(OpenOffset, CloseOffset - OpenOffset + 2); MultiLineString->TokenText = Text; resetLexer(SourceMgr.getFileOffset( Lex->getSourceLocation(Lex->getBufferLocation() - 2 + Text.size()))); |