[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-21 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Thank you for your advice. I have checked the message "clang-format did not modify any files" in my local. https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-22 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/76059 >From b0080a41c1802517e4a02976058231cf37a82adb Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Fri, 3 Nov 2023 20:58:17 +0900 Subject: [PATCH] [clang-format] Support of TableGen formatting. Currently, TableGe

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-23 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/76059 >From b0080a41c1802517e4a02976058231cf37a82adb Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Fri, 3 Nov 2023 20:58:17 +0900 Subject: [PATCH 1/2] [clang-format] Support of TableGen formatting. Currently, Tab

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-23 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Thank you for the information. I added the document. https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-23 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/76059 >From b0080a41c1802517e4a02976058231cf37a82adb Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Fri, 3 Nov 2023 20:58:17 +0900 Subject: [PATCH 1/2] [clang-format] Support of TableGen formatting. Currently, Tab

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-23 Thread Hirofumi Nakamura via cfe-commits
@@ -396,6 +396,36 @@ struct FormatStyle { /// \version 17 ShortCaseStatementsAlignmentStyle AlignConsecutiveShortCaseStatements; + /// Style of aligning consecutive TableGen cond operator colons. + /// \code + /// !cond(!eq(size, 1) : 1, + /// !eq(size, 16):

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-23 Thread Hirofumi Nakamura via cfe-commits
@@ -4656,6 +4687,15 @@ struct FormatStyle { /// \version 8 std::vector StatementMacros; + /// Tablegen + bool TableGenAllowBreakBeforeInheritColon; + bool TableGenAllowBreakAfterInheritColon; hnakamura5 wrote: Thank you for the information. I removed t

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-23 Thread Hirofumi Nakamura via cfe-commits
@@ -40,6 +40,13 @@ class FormatTestTableGen : public ::testing::Test { EXPECT_EQ(Code.str(), format(Code)) << "Expected code is not stable"; EXPECT_EQ(Code.str(), format(test::messUp(Code))); } + + static void verifyFormat(llvm::StringRef Code, const FormatStyle &Sty

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-23 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: @rymiel @HazardyKnusperkeks Thank you for your review! I have fixed the points. But for refactoring of the test base class in https://github.com/llvm/llvm-project/commit/f8d10d5ac9ab4b45b388c74357fc82fb96562e66 . I'm not sure I should do here, and if I should, I should do it

[clang] [clang-format] TableGen keywords support. (PR #77477)

2024-01-09 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/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 . >From 915d1822f68f975f60e49b3cc236fe97a19e7

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2024-01-09 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Thanks to the advises, I begin to split this into several parts. Made the keywords part in https://github.com/llvm/llvm-project/pull/77477 . https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mailing list cfe-commits@lis

[clang] [clang-format] TableGen keywords support. (PR #77477)

2024-01-11 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/77477 >From 4e9f2bc86c4e48c4d412fea7804c226f041d022c Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Tue, 9 Jan 2024 22:57:53 +0900 Subject: [PATCH] [clang-format] TableGen keywords support. Add TableGen keywords t

[clang] [clang-format] TableGen keywords support. (PR #77477)

2024-01-11 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: @HazardyKnusperkeks Thank you for reviewing! I do not have write permission to the repository. Could you please commit this or tell me what I can do? https://github.com/llvm/llvm-project/pull/77477 ___ cfe-commits mailing list cf

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-03-17 Thread Hirofumi Nakamura via cfe-commits
@@ -2332,6 +2332,77 @@ TEST_F(TokenAnnotatorTest, UnderstandTableGenTokens) { EXPECT_TOKEN(Tokens[4], tok::less, TT_TemplateOpener); EXPECT_TOKEN(Tokens[6], tok::greater, TT_TemplateCloser); EXPECT_TOKEN(Tokens[7], tok::l_brace, TT_FunctionLBrace); + + // DAGArg breaking

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-03-17 Thread Hirofumi Nakamura via cfe-commits
@@ -332,6 +332,84 @@ TEST_F(FormatTestTableGen, Assert) { verifyFormat("assert !le(DefVar1, 0), \"Assert1\";\n"); } +TEST_F(FormatTestTableGen, DAGArgBreakElements) { + FormatStyle Style = getGoogleStyle(FormatStyle::LK_TableGen); + Style.ColumnLimit = 60; + // By default

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-03-17 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/83149 >From becb28f6daa1fed9cabe40375a7ed863207b6bd2 Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Wed, 28 Feb 2024 01:10:12 +0900 Subject: [PATCH 1/4] [clang-format] Add Options to break inside the TableGen DAGA

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-03-17 Thread Hirofumi Nakamura via cfe-commits
@@ -1842,6 +1846,19 @@ void ContinuationIndenter::moveStatePastScopeOpener(LineState &State, Style.ContinuationIndentWidth + std::max(CurrentState.LastSpace, CurrentState.StartOfFunctionCall); +if (Style.isTableGen()) { + if (Current.is(TT_TableGenDAG

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-03-18 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 closed https://github.com/llvm/llvm-project/pull/83149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-03-18 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Thank you very much! I really appreciate you for reviewing up to such a complicated option. https://github.com/llvm/llvm-project/pull/83149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [clang-format] Fixed the warning in building document for TableGenBreakingDAGArgOperators. (PR #85760)

2024-03-19 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/85760 Intend to fix the `Test documentation build `, degraded here https://github.com/llvm/llvm-project/pull/83149 . >From 612bc89ef805a3324520f4b7ef1ebb13e334ec0b Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: T

[clang] [clang-format] Fixed the warning in building document for TableGenBreakingDAGArgOperators. (PR #85760)

2024-03-19 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Thank you so much for quick response! https://github.com/llvm/llvm-project/pull/85760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-03-19 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: @wangpc-pp Thank you for telling, and sorry for overlooking the detailed check for CI. https://github.com/llvm/llvm-project/pull/83149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-03-19 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: @HazardyKnusperkeks Thank you for reviewing and merging the fix. https://github.com/llvm/llvm-project/pull/83149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Added AlignConsecutiveTableGenBreakingDAGArgColons option. (PR #86150)

2024-03-21 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/86150 This is the option to specify the style of alignment of the colons inside TableGen's DAGArg. >From 4a0d3cd3d20220b7f363922b49eae8cd0c740426 Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Fri, 22 Mar 2024 01

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2024-03-21 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Alignment option for DAGArg: https://github.com/llvm/llvm-project/pull/86150 https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [clang-format] Added AlignConsecutiveTableGenBreakingDAGArgColons option. (PR #86150)

2024-03-22 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 closed https://github.com/llvm/llvm-project/pull/86150 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Added AlignConsecutiveTableGenBreakingDAGArgColons option. (PR #86150)

2024-03-22 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: @HazardyKnusperkeks Thank you very much! It took about 4 month with ten or more PRs for the parts of the first concept of TableGen formatting. You reviewed every time and gave me many valuable suggestions. I appreciate you again and again! https://github.com/llvm/llvm-proje

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2024-03-22 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: All the split parts of this PR is merged. Thank you! https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2024-03-22 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 closed https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-10 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/80299 >From 36f83a124ea8ad27cfefa1d12ae5aa781f8e6e3e Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Thu, 1 Feb 2024 23:07:42 +0900 Subject: [PATCH 1/3] [clang-format] Support of TableGen value annotations. --- cl

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-10 Thread Hirofumi Nakamura via cfe-commits
@@ -833,13 +885,207 @@ class AnnotatingParser { Left->setType(TT_ArrayInitializerLSquare); } FormatToken *Tok = CurrentToken; + if (Style.isTableGen()) { +if (CurrentToken->isOneOf(tok::comma, tok::minus, tok::ellipsis)) { + // '-' and

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-12 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 closed https://github.com/llvm/llvm-project/pull/80299 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-12 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Thank you very much! Currently I think this will be the largest part. I try to make so. Thank you again for this, and of course for the other parts. https://github.com/llvm/llvm-project/pull/80299 ___ cfe-commits mailing list cfe-com

[clang] [clang-format] Support of TableGen basic format restrictions. (PR #81611)

2024-02-13 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/81611 - Allow/force to break the line or not. - Allow to insert space or not. This is separated part from https://github.com/llvm/llvm-project/pull/76059. Now we come to format in basic style ! >From 7ee4b35f0aed43

[clang] [clang-format] Support of TableGen basic format restrictions. (PR #81611)

2024-02-13 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/81611 >From 7ee4b35f0aed434053b6fd6329ef39de97bc22db Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Tue, 13 Feb 2024 23:50:15 +0900 Subject: [PATCH 1/2] [clang-format] Support of TableGen basic format restrictions

[clang] [clang-format] Support of TableGen basic format restrictions. (PR #81611)

2024-02-13 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 edited https://github.com/llvm/llvm-project/pull/81611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Support of TableGen basic format restrictions. (PR #81611)

2024-02-13 Thread Hirofumi Nakamura via cfe-commits
@@ -55,5 +55,268 @@ TEST_F(FormatTestTableGen, NoSpacesInSquareBracketLists) { verifyFormat("def flag : Flag<[\"-\", \"--\"], \"foo\">;"); } +TEST_F(FormatTestTableGen, LiteralsAndIdentifiers) { + verifyFormat("def LiteralAndIdentifiers {\n" + " let someInteg

[clang] [clang-format] Support of TableGen basic format restrictions. (PR #81611)

2024-02-13 Thread Hirofumi Nakamura via cfe-commits
@@ -5822,6 +5860,24 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, return false; if (Left.is(TT_TemplateString) && Left.opensScope()) return true; + } else if (Style.isTableGen()) { +// Avoid to break after "def", "class", "let" and so o

[clang] [clang-format] Support of TableGen basic format restrictions. (PR #81611)

2024-02-13 Thread Hirofumi Nakamura via cfe-commits
@@ -5072,7 +5072,38 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, Left.endsSequence(tok::greatergreater, tok::l_brace))) { return false; } + } else if (Style.isTableGen()) { +// Avoid to connect [ and {. [{ is start token of mul

[clang] [clang-format] Support of TableGen basic format restrictions. (PR #81611)

2024-02-13 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 edited https://github.com/llvm/llvm-project/pull/81611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Support of TableGen basic format restrictions. (PR #81611)

2024-02-13 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/81611 >From 7ee4b35f0aed434053b6fd6329ef39de97bc22db Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Tue, 13 Feb 2024 23:50:15 +0900 Subject: [PATCH 1/3] [clang-format] Support of TableGen basic format restrictions

[clang] [clang-format] Support of TableGen basic format restrictions. (PR #81611)

2024-02-13 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 edited https://github.com/llvm/llvm-project/pull/81611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-03-10 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/83149 >From becb28f6daa1fed9cabe40375a7ed863207b6bd2 Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Wed, 28 Feb 2024 01:10:12 +0900 Subject: [PATCH 1/2] [clang-format] Add Options to break inside the TableGen DAGA

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-03-10 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 edited https://github.com/llvm/llvm-project/pull/83149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-03-10 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/83149 >From becb28f6daa1fed9cabe40375a7ed863207b6bd2 Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Wed, 28 Feb 2024 01:10:12 +0900 Subject: [PATCH 1/3] [clang-format] Add Options to break inside the TableGen DAGA

[clang] [clang-format] Add AlignConsecutiveTableGenCondOperatorColons option. (PR #82878)

2024-02-24 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/82878 To align colons inside TableGen !cond operators. >From d0ceab536cc9aa06ce5de1324eee1e3a05dac804 Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Sat, 24 Feb 2024 22:21:04 +0900 Subject: [PATCH] [clang-format]

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2024-02-24 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Alignment option for cond operator: https://github.com/llvm/llvm-project/pull/82878. https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [clang-format] Add AlignConsecutiveTableGenCondOperatorColons option. (PR #82878)

2024-02-25 Thread Hirofumi Nakamura via cfe-commits
@@ -849,7 +851,12 @@ void WhitespaceManager::alignConsecutiveAssignments() { } void WhitespaceManager::alignConsecutiveBitFields() { - if (!Style.AlignConsecutiveBitFields.Enabled) + alignConsecutiveColons(Style.AlignConsecutiveBitFields, TT_BitFieldColon); +} + +void Whites

[clang] [clang-format] Add AlignConsecutiveTableGenCondOperatorColons option. (PR #82878)

2024-02-26 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 closed https://github.com/llvm/llvm-project/pull/82878 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add AlignConsecutiveTableGenCondOperatorColons option. (PR #82878)

2024-02-26 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Thank you! https://github.com/llvm/llvm-project/pull/82878 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add AlignConsecutiveTableGenDefinitions option. (PR #83008)

2024-02-26 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/83008 To align TableGen consecutive definitions. >From 4d22f709eff00b38cce6e9f4087bea14d04424fd Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Mon, 26 Feb 2024 23:17:55 +0900 Subject: [PATCH 1/2] [clang-format] Ad

[clang] [clang-format] Add AlignConsecutiveTableGenDefinitions option. (PR #83008)

2024-02-27 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 closed https://github.com/llvm/llvm-project/pull/83008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add AlignConsecutiveTableGenDefinitions option. (PR #83008)

2024-02-27 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Thank you! https://github.com/llvm/llvm-project/pull/83008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-02-27 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/83149 This adds two options to control the line break inside TableGen DAGArg. - TableGenBreakInsideDAGArgList - TableGenBreakingDAGArgOperators >From becb28f6daa1fed9cabe40375a7ed863207b6bd2 Mon Sep 17 00:00:00 20

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2024-02-27 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Alignment option for definitions: https://github.com/llvm/llvm-project/pull/83008. https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2024-02-27 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Break options for DAGArg: https://github.com/llvm/llvm-project/pull/83149. https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] [clang-format] Add Options to break inside the TableGen DAGArg. (PR #83149)

2024-02-27 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: These options have a dependency that TableGenBreakInsideDAGArgList is effective only when TableGenBreakingDAGArgOperators is specified as true. I'm not sure this is a smart way. https://github.com/llvm/llvm-project/pull/83149 ___ cfe

[clang] [clang-format] Support of TableGen tokens with unary operator like form, bang operators and numeric literals. (PR #78996)

2024-01-30 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 closed https://github.com/llvm/llvm-project/pull/78996 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Support of TableGen tokens with unary operator like form, bang operators and numeric literals. (PR #78996)

2024-01-30 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: @HazardyKnusperkeks Thank you for checking and accepting! @mydeveloperday You will be able to see the points in the consequent PRs. https://github.com/llvm/llvm-project/pull/78996 ___ cfe-commits mailing list cfe-commits@lists.llvm

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-01 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/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

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-01 Thread Hirofumi Nakamura via cfe-commits
@@ -816,7 +816,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->

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-01 Thread Hirofumi Nakamura via cfe-commits
@@ -256,6 +256,18 @@ class AnnotatingParser { } } } + if (Style.isTableGen()) { +if (CurrentToken->isOneOf(tok::comma, tok::equal)) { + // They appears as a separator. Unless it is not in class definition. + next(); +

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-01 Thread Hirofumi Nakamura via cfe-commits
@@ -388,6 +400,28 @@ class AnnotatingParser { Contexts.back().IsExpression = !IsForOrCatch; } +if (Style.isTableGen()) { + if (FormatToken *Prev = OpeningParen.Previous) { +if (Prev->is(TT_TableGenCondOperator)) { + Contexts.back().IsTableGe

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-01 Thread Hirofumi Nakamura via cfe-commits
@@ -549,6 +583,22 @@ class AnnotatingParser { if (CurrentToken->is(tok::comma)) Contexts.back().CanBeExpression = true; + if (Style.isTableGen()) { +if (CurrentToken->is(tok::comma)) { + if (Contexts.back().IsTableGenCondOpe) +Cu

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-01 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 edited https://github.com/llvm/llvm-project/pull/80299 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-01 Thread Hirofumi Nakamura via cfe-commits
@@ -833,13 +885,207 @@ class AnnotatingParser { Left->setType(TT_ArrayInitializerLSquare); } FormatToken *Tok = CurrentToken; + if (Style.isTableGen()) { +if (CurrentToken->isOneOf(tok::comma, tok::minus, tok::ellipsis)) { + // '-' and

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-01 Thread Hirofumi Nakamura via cfe-commits
@@ -1423,11 +1692,30 @@ class AnnotatingParser { if (!Tok->getPreviousNonComment()) Line.IsContinuation = true; } + if (Style.isTableGen()) { +if (Tok->is(Keywords.kw_assert)) { + if (!parseTableGenValue()) +return false

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-01 Thread Hirofumi Nakamura via cfe-commits
@@ -1423,11 +1692,30 @@ class AnnotatingParser { if (!Tok->getPreviousNonComment()) Line.IsContinuation = true; } + if (Style.isTableGen()) { +if (Tok->is(Keywords.kw_assert)) { + if (!parseTableGenValue()) +return false

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-01 Thread Hirofumi Nakamura via cfe-commits
@@ -915,10 +1163,12 @@ class AnnotatingParser { Previous->setType(TT_SelectorName); } } -if (CurrentToken->is(tok::colon) && OpeningBrace.is(TT_Unknown)) +if (CurrentToken->is(tok::colon) && OpeningBrace.is(TT_Unknown) && +

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-01 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 edited https://github.com/llvm/llvm-project/pull/80299 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-06 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/80299 >From 36f83a124ea8ad27cfefa1d12ae5aa781f8e6e3e Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Thu, 1 Feb 2024 23:07:42 +0900 Subject: [PATCH 1/2] [clang-format] Support of TableGen value annotations. --- cl

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-06 Thread Hirofumi Nakamura via cfe-commits
@@ -256,6 +256,18 @@ class AnnotatingParser { } } } + if (Style.isTableGen()) { +if (CurrentToken->isOneOf(tok::comma, tok::equal)) { + // They appears as a separator. Unless it is not in class definition. hnakamura

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-06 Thread Hirofumi Nakamura via cfe-commits
@@ -833,13 +885,207 @@ class AnnotatingParser { Left->setType(TT_ArrayInitializerLSquare); } FormatToken *Tok = CurrentToken; + if (Style.isTableGen()) { +if (CurrentToken->isOneOf(tok::comma, tok::minus, tok::ellipsis)) { + // '-' and

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-06 Thread Hirofumi Nakamura via cfe-commits
@@ -833,13 +885,207 @@ class AnnotatingParser { Left->setType(TT_ArrayInitializerLSquare); } FormatToken *Tok = CurrentToken; + if (Style.isTableGen()) { +if (CurrentToken->isOneOf(tok::comma, tok::minus, tok::ellipsis)) { + // '-' and

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-06 Thread Hirofumi Nakamura via cfe-commits
@@ -833,13 +885,207 @@ class AnnotatingParser { Left->setType(TT_ArrayInitializerLSquare); } FormatToken *Tok = CurrentToken; + if (Style.isTableGen()) { +if (CurrentToken->isOneOf(tok::comma, tok::minus, tok::ellipsis)) { + // '-' and

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-06 Thread Hirofumi Nakamura via cfe-commits
@@ -1423,11 +1692,30 @@ class AnnotatingParser { if (!Tok->getPreviousNonComment()) Line.IsContinuation = true; } + if (Style.isTableGen()) { +if (Tok->is(Keywords.kw_assert)) { + if (!parseTableGenValue()) +return false

[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

2024-02-06 Thread Hirofumi Nakamura via cfe-commits
@@ -833,13 +885,207 @@ class AnnotatingParser { Left->setType(TT_ArrayInitializerLSquare); } FormatToken *Tok = CurrentToken; + if (Style.isTableGen()) { +if (CurrentToken->isOneOf(tok::comma, tok::minus, tok::ellipsis)) { + // '-' and

[clang] [clang-format] Support of TableGen tokens with unary operator like form, bang operators and numeric literals. (PR #78996)

2024-01-29 Thread Hirofumi Nakamura via cfe-commits
@@ -276,13 +276,44 @@ void FormatTokenLexer::tryMergePreviousTokens() { return; } } - // TableGen's Multi line string starts with [{ - if (Style.isTableGen() && tryMergeTokens({tok::l_square, tok::l_brace}, - TT_TableGenMu

[clang] [clang-format] TableGen keywords support. (PR #77477)

2024-01-13 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Thank you very much! https://github.com/llvm/llvm-project/pull/77477 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-01-13 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/78032 Support the handling of TableGen's multiline string (code) literal. That has the form, [{ this is the string possibly with multi line... }] This is a separated part from https://github.com/llvm/llvm-project/pu

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2024-01-13 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Multi line string part https://github.com/llvm/llvm-project/pull/78032 https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-01-13 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/78032 >From d0767350f26215e86dee039427183630b3f02668 Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Sat, 13 Jan 2024 21:44:34 +0900 Subject: [PATCH 1/2] [clang-format] TableGen multi line string support. --- clan

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

2024-01-13 Thread Hirofumi Nakamura via cfe-commits
@@ -272,6 +274,14 @@ void FormatTokenLexer::tryMergePreviousTokens() { return; } } + if (Style.isTableGen()) { +if (tryMergeTokens({tok::l_square, tok::l_brace}, hnakamura5 wrote: Followed this suggestion. https://github.com/llvm/llvm-project

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

2024-01-13 Thread Hirofumi Nakamura via cfe-commits
@@ -2193,6 +2193,11 @@ TEST_F(TokenAnnotatorTest, UnderstandTableGenTokens) { ASSERT_TRUE(Keywords.isTableGenDefinition(*Tokens[0])); ASSERT_TRUE(Tokens[0]->is(Keywords.kw_def)); ASSERT_TRUE(Tokens[1]->is(TT_StartOfName)); + + // Code, the multiline string token. ---

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

2024-01-13 Thread Hirofumi Nakamura via cfe-commits
@@ -1710,7 +1710,7 @@ class AnnotatingParser { TT_UnionLBrace, TT_RequiresClause, TT_RequiresClauseInARequiresExpression, TT_RequiresExpression, TT_RequiresExpressionLParen, TT_RequiresExpressionLBrace, -TT_BracedListLBrace)) { +

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

2024-01-13 Thread Hirofumi Nakamura via cfe-commits
@@ -763,6 +773,53 @@ void FormatTokenLexer::handleCSharpVerbatimAndInterpolatedStrings() { resetLexer(SourceMgr.getFileOffset(Lex->getSourceLocation(Offset + 1))); } +void FormatTokenLexer::handleTableGenMultilineString() { + FormatToken *MultiLineString = Tokens.back(); +

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

2024-01-15 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/78032 >From d0767350f26215e86dee039427183630b3f02668 Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Sat, 13 Jan 2024 21:44:34 +0900 Subject: [PATCH 1/3] [clang-format] TableGen multi line string support. --- clan

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

2024-01-15 Thread Hirofumi Nakamura via cfe-commits
@@ -778,45 +778,31 @@ void FormatTokenLexer::handleTableGenMultilineString() { if (MultiLineString->isNot(TT_TableGenMultiLineString)) return; - bool PrevIsRBrace = false; - const char *FirstBreak = nullptr; - const char *LastBreak = nullptr; - const char *Begin = Mu

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

2024-01-15 Thread Hirofumi Nakamura via cfe-commits
@@ -778,45 +778,31 @@ void FormatTokenLexer::handleTableGenMultilineString() { if (MultiLineString->isNot(TT_TableGenMultiLineString)) return; - bool PrevIsRBrace = false; - const char *FirstBreak = nullptr; - const char *LastBreak = nullptr; - const char *Begin = Mu

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

2024-01-15 Thread Hirofumi Nakamura via cfe-commits
@@ -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 [{

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

2024-01-15 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 edited https://github.com/llvm/llvm-project/pull/78032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-01-16 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/78032 >From d0767350f26215e86dee039427183630b3f02668 Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Sat, 13 Jan 2024 21:44:34 +0900 Subject: [PATCH 1/4] [clang-format] TableGen multi line string support. --- clan

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

2024-01-16 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/78032 >From d0767350f26215e86dee039427183630b3f02668 Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Sat, 13 Jan 2024 21:44:34 +0900 Subject: [PATCH 1/4] [clang-format] TableGen multi line string support. --- clan

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

2024-01-16 Thread Hirofumi Nakamura via cfe-commits
@@ -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 [{

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

2024-01-17 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/78032 >From d0767350f26215e86dee039427183630b3f02668 Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Sat, 13 Jan 2024 21:44:34 +0900 Subject: [PATCH 1/4] [clang-format] TableGen multi line string support. --- clan

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

2024-01-17 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 closed https://github.com/llvm/llvm-project/pull/78032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-01-17 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Thank you very much! https://github.com/llvm/llvm-project/pull/78032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Support of TableGen identifiers beginning with a number. (PR #78571)

2024-01-18 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/78571 TableGen allows the identifiers beginning with a number. This patch add the support of the recognition of such identifiers. >From b472c08735b3ce3b6f7b81e499a2ef16c3faad4a Mon Sep 17 00:00:00 2001 From: hnakamu

[clang] [clang-format] Support of TableGen identifiers beginning with a number. (PR #78571)

2024-01-18 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: I checked simply the corner cases in unittest of this patch with the following sample. ``` // test_id.td class 01234Vector { int 2dVector = 0x1abc; int invalid_num = 0x1234x; int 0x1234x = i; } def Def: 01234Vector<1>; ``` The followings are the result of ``` llvm-tbl

[clang] [clang-format] Support of TableGen identifiers beginning with a number. (PR #78571)

2024-01-18 Thread Hirofumi Nakamura via cfe-commits
@@ -804,6 +806,46 @@ void FormatTokenLexer::handleTableGenMultilineString() { FirstLineText, MultiLineString->OriginalColumn, Style.TabWidth, Encoding); } +void FormatTokenLexer::handleTableGenNumericLikeIdentifier() { + FormatToken *Tok = Tokens.back(); + // TableGen

  1   2   >