[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 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-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] 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] 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-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] Support of TableGen formatting. (PR #76059)

2024-01-22 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: bang operators and numeric literals part https://github.com/llvm/llvm-project/pull/78996 . https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

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

2024-01-22 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Numeric like identifiers part https://github.com/llvm/llvm-project/pull/78571 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

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

2024-01-20 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: unwrapped line parser for statements part https://github.com/llvm/llvm-project/pull/78846 . https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

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

2024-01-20 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Numeric like identifiers part https://github.com/llvm/llvm-project/pull/78571 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-

[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] 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] Support of TableGen formatting. (PR #76059)

2023-12-28 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > @rymiel @HazardyKnusperkeks Thank you for your review! I have fixed the > points. But for refactoring of the test base class in > [f8d10d5](https://github.com/llvm/llvm-project/commit/f8d10d5ac9ab4b45b388c74357fc82fb96562e66) > . I'm not sure I should do here, and i

[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] 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
@@ -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
@@ -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
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-22 Thread Björn Schäpers via cfe-commits
@@ -2165,6 +2165,56 @@ TEST_F(TokenAnnotatorTest, UnderstandsVerilogOperators) { EXPECT_TOKEN(Tokens[4], tok::string_literal, TT_Unknown); } +TEST_F(TokenAnnotatorTest, UnderstandTableGenTokens) { + auto Style = getLLVMStyle(FormatStyle::LK_TableGen); + Style.TableGenBreak

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

2023-12-22 Thread Björn Schäpers via cfe-commits
@@ -681,6 +700,10 @@ struct FormatToken { return true; if (is(TT_DictLiteral) && is(tok::greater)) return true; +if (is(TT_TableGenParamAngleCloser)) + return true; +if (is(TT_TableGenListCloser)) + return true; return isOneOf(tok::r_paren

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

2023-12-22 Thread Björn Schäpers 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-22 Thread Björn Schäpers via cfe-commits
@@ -4656,6 +4687,15 @@ struct FormatStyle { /// \version 8 std::vector StatementMacros; + /// Tablegen + bool TableGenAllowBreakBeforeInheritColon; + bool TableGenAllowBreakAfterInheritColon; HazardyKnusperkeks wrote: Do you need both options to be ena

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

2023-12-22 Thread Björn Schäpers 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-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks requested changes to this pull request. I think we all would gain a lot, if you could split this into multiple pull requests. The discussion can be more focused and you have a greater chance to get something merged. Similar to the Verilog changes. https://

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

2023-12-22 Thread Björn Schäpers via cfe-commits
@@ -4656,6 +4687,15 @@ struct FormatStyle { /// \version 8 std::vector StatementMacros; + /// Tablegen HazardyKnusperkeks wrote: We need a bit more documentation here. https://github.com/llvm/llvm-project/pull/76059 _

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

2023-12-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks edited 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)

2023-12-22 Thread Emilia Kond via cfe-commits
@@ -272,6 +276,38 @@ void FormatTokenLexer::tryMergePreviousTokens() { return; } } + if (Style.isTableGen()) { +if (tryMergeTokens({tok::l_square, tok::l_brace}, + TT_TableGenMultiLineString)) { + Tokens.back()->Tok.setKind(tok::strin

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

2023-12-22 Thread Emilia Kond via cfe-commits
@@ -1124,6 +1130,20 @@ template <> struct MappingTraits { IO.mapOptional("StatementAttributeLikeMacros", Style.StatementAttributeLikeMacros); IO.mapOptional("StatementMacros", Style.StatementMacros); +IO.mapOptional("TableGenAllowBreakAfterInherit

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

2023-12-22 Thread Emilia Kond via cfe-commits
@@ -4753,6 +4793,13 @@ struct FormatStyle { AlignConsecutiveMacros == R.AlignConsecutiveMacros && AlignConsecutiveShortCaseStatements == R.AlignConsecutiveShortCaseStatements && + AlignConsecutiveTableGenCondOperatorColons == +

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

2023-12-22 Thread Emilia Kond 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-22 Thread Emilia Kond via cfe-commits
@@ -111,6 +111,9 @@ const tooling::Replacements &WhitespaceManager::generateReplacements() { alignConsecutiveDeclarations(); alignConsecutiveBitFields(); alignConsecutiveAssignments(); + alignConsecutiveTableGenCondOperatorColons(); + AlignConsecutiveTableGenBreakingDA

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

2023-12-22 Thread Emilia Kond via cfe-commits
https://github.com/rymiel commented: Hi, this is quite a big patch. I had a very quick look and noticed a few nit-picky thingy, mostly about formatting or naming and whatnot, mostly minor things. However since I've never used tablegen, I'm not sure if I can actually review any of the logic in

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

2023-12-22 Thread Emilia Kond via cfe-commits
@@ -111,6 +111,9 @@ const tooling::Replacements &WhitespaceManager::generateReplacements() { alignConsecutiveDeclarations(); alignConsecutiveBitFields(); alignConsecutiveAssignments(); + alignConsecutiveTableGenCondOperatorColons(); + AlignConsecutiveTableGenBreakingDA

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

2023-12-22 Thread Emilia Kond via cfe-commits
rymiel wrote: Your edits in Format.h won't show up in the documentation until after you've run the script in `clang/docs/tools/dump_format_style.py` https://github.com/llvm/llvm-project/pull/76059 ___ cfe-commits mai

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

2023-12-22 Thread Emilia Kond via cfe-commits
https://github.com/rymiel edited 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)

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-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-21 Thread Owen Pan via cfe-commits
owenca wrote: > I avoid this by using clang-format binary from main branch in my local. What > should I do with this failure? You can ignore it if running the in-tree clang-format is clean, e.g.: ``` $ clang/tools/clang-format/git-clang-format --binary build/bin/clang-format HEAD~ clang-format

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

2023-12-20 Thread via cfe-commits
hnakamura5 wrote: The failure in Check code formatting seems to be caused by the commit (replacing to clang-format style) https://github.com/llvm/llvm-project/commit/5c60e2ce78e79c2d15152e08d9e28fcf3a1d4e51 I avoid this by using clang-format binary from main branch in my local. What should I do

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

2023-12-20 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-format Author: H.Nakamura (hnakamura5) Changes Currently, TableGen has its language style but the it does not works well. This patch adds total support of TableGen formatting including the support for the code (multi line string), DAG args, bang

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

2023-12-20 Thread via cfe-commits
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it i

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

2023-12-20 Thread via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/76059 Currently, TableGen has its language style but the it does not works well. This patch adds total support of TableGen formatting including the support for the code (multi line string), DAG args, bang operators