aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/FormatTokenLexer.cpp
diff options
context:
space:
mode:
authorHirofumi Nakamura <k.nakamura.hirofumi@gmail.com>2024-01-12 04:07:49 +0900
committerGitHub <noreply@github.com>2024-01-11 20:07:49 +0100
commit0cc31579e0b690e974163da4077a40b49bfc1ebc (patch)
tree1b78c845e54e277b84d99ab2f430a3633c23f7f0 /clang/lib/Format/FormatTokenLexer.cpp
parent2bb511e277e501d3faa0f2da0d1c98ea0b515507 (diff)
downloadllvm-0cc31579e0b690e974163da4077a40b49bfc1ebc.zip
llvm-0cc31579e0b690e974163da4077a40b49bfc1ebc.tar.gz
llvm-0cc31579e0b690e974163da4077a40b49bfc1ebc.tar.bz2
[clang-format] TableGen keywords support. (#77477)
Add TableGen keywords to the additional keyword list of the formatter. This pull request is the splited part from https://github.com/llvm/llvm-project/pull/76059 .
Diffstat (limited to 'clang/lib/Format/FormatTokenLexer.cpp')
-rw-r--r--clang/lib/Format/FormatTokenLexer.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp
index 6143028..a1fd6dd 100644
--- a/clang/lib/Format/FormatTokenLexer.cpp
+++ b/clang/lib/Format/FormatTokenLexer.cpp
@@ -1182,6 +1182,9 @@ FormatToken *FormatTokenLexer::getNextToken() {
tok::kw_operator)) {
FormatTok->Tok.setKind(tok::identifier);
FormatTok->Tok.setIdentifierInfo(nullptr);
+ } else if (Style.isTableGen() && !Keywords.isTableGenKeyword(*FormatTok)) {
+ FormatTok->Tok.setKind(tok::identifier);
+ FormatTok->Tok.setIdentifierInfo(nullptr);
}
} else if (FormatTok->is(tok::greatergreater)) {
FormatTok->Tok.setKind(tok::greater);