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

2024-01-19 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/78571 >From b472c08735b3ce3b6f7b81e499a2ef16c3faad4a Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Thu, 18 Jan 2024 21:49:06 +0900 Subject: [PATCH 1/2] [clang-format] Support of TableGen identifiers beginning wit

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

2024-01-19 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

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

2024-01-19 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

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

2024-01-19 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

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

2024-01-19 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

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

2024-01-19 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: I changed the algorithm of handleTableGenNumericLikeIdentifier. Stopped to follow the original implementation in llvm::TGLexer::LexToken and clarified the conditions. https://github.com/llvm/llvm-project/pull/78571 ___ cfe-commits ma

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

2024-01-20 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 closed https://github.com/llvm/llvm-project/pull/78571 ___ 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 statements in unwrapped line parser (PR #78846)

2024-01-20 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/78846 Make TableGen's statements to be parsed considering their structure. - Removed label - Avoid class from being parsed as c++'s class - Support if statement of the form `if then { ... }` - Support defset statem

[clang] [clang-format] Support of TableGen statements in unwrapped line parser (PR #78846)

2024-01-20 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 edited https://github.com/llvm/llvm-project/pull/78846 ___ 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-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-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 statements in unwrapped line parser (PR #78846)

2024-01-21 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 updated https://github.com/llvm/llvm-project/pull/78846 >From fbf7e0f624fb7a4ef05970ee1241cf68f3f5f783 Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Sat, 20 Jan 2024 22:37:25 +0900 Subject: [PATCH 1/2] [clang-format] Support of TableGen statements in unwrapped l

[clang] [clang-format] Support of TableGen statements in unwrapped line parser (PR #78846)

2024-01-22 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 closed https://github.com/llvm/llvm-project/pull/78846 ___ 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 statements in unwrapped line parser (PR #78846)

2024-01-22 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Thank you very much! > how small the diff is Maybe it is by TableGen's simple syntax, and that here we are parsing only the structure of the statements. (e.g. ignoring the `` part of `if` now). https://github.com/llvm/llvm-project/pull/78846 _

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

2024-01-22 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/78996 Adds the support for tokens that have forms like unary operators. - bang operators: `!name` - cond operator: `!cond` - numeric literals: `+1`, `-1` cond operator are one of bang operators but is distinguished

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

2024-01-22 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 edited 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 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-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 tokens with unary operator like form, bang operators and numeric literals. (PR #78996)

2024-01-23 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] Support of TableGen basic format restrictions. (PR #81611)

2024-02-14 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/4] [clang-format] Support of TableGen basic format restrictions

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

2024-02-14 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/4] [clang-format] Support of TableGen basic format restrictions

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

2024-02-14 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/5] [clang-format] Support of TableGen basic format restrictions

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

2024-02-15 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/6] [clang-format] Support of TableGen basic format restrictions

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

2024-02-16 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 closed 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-16 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: Thank you very much! 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] BreakAfterAttributes did not take into account gnu attributes (PR #78102)

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

[clang] [clang-format] BreakAfterAttributes did not take into account gnu attributes (PR #78102)

2024-07-08 Thread Hirofumi Nakamura via cfe-commits
@@ -26827,6 +26827,31 @@ TEST_F(FormatTest, BreakAdjacentStringLiterals) { Style.BreakAdjacentStringLiterals = false; verifyFormat(Code, Style); } + +TEST_F(FormatTest, BreakAfterGNUAttributes) { + FormatStyle Style = getLLVMStyle(); + Style.BreakAfterAttributes = FormatS

[clang] [clang-format] BreakAfterAttributes did not take into account gnu attributes (PR #78102)

2024-07-08 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 commented: There are small suggestions on the format of test. https://github.com/llvm/llvm-project/pull/78102 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

[clang] [clang-format] BreakAfterAttributes did not take into account gnu attributes (PR #78102)

2024-07-08 Thread Hirofumi Nakamura via cfe-commits
@@ -26827,6 +26827,31 @@ TEST_F(FormatTest, BreakAdjacentStringLiterals) { Style.BreakAdjacentStringLiterals = false; verifyFormat(Code, Style); } + +TEST_F(FormatTest, BreakAfterGNUAttributes) { + FormatStyle Style = getLLVMStyle(); + Style.BreakAfterAttributes = FormatS

[clang] [clang-format] BreakAfterAttributes did not take into account gnu attributes (PR #78102)

2024-07-08 Thread Hirofumi Nakamura via cfe-commits
@@ -26827,6 +26827,31 @@ TEST_F(FormatTest, BreakAdjacentStringLiterals) { Style.BreakAdjacentStringLiterals = false; verifyFormat(Code, Style); } + +TEST_F(FormatTest, BreakAfterGNUAttributes) { + FormatStyle Style = getLLVMStyle(); + Style.BreakAfterAttributes = FormatS

[clang] [clang-format] Added unittest of TableGen formatting w.r.t. block type calculation. (PR #87924)

2024-04-07 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/87924 The test I mentioned here https://github.com/llvm/llvm-project/pull/87450 . This is a regression test to detect the case block type is not calculated due to the paste `#` operator misunderstood as preprocessor

[clang] [clang-format] Added unittest of TableGen formatting w.r.t. block type calculation. (PR #87924)

2024-04-08 Thread Hirofumi Nakamura via cfe-commits
@@ -290,6 +290,16 @@ TEST_F(FormatTestTableGen, MultiClass) { "}\n"); } +TEST_F(FormatTestTableGen, MultiClassesWithPasteOperator) { + // This is a sensitive example for the handling of the paste operators in + // brace type calculation. + verifyFormat("multi

[clang] [clang-format] Added unittest of TableGen formatting w.r.t. block type calculation. (PR #87924)

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

[clang] [clang-format] Added unittest of TableGen formatting w.r.t. block type calculation. (PR #87924)

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

[clang] [clang-format] Remove trailing newlines in TableGen formatting test. (PR #87983)

2024-04-08 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/87983 Refactoring suggested here https://github.com/llvm/llvm-project/pull/87924 . >From d55a0986ed175dbc18c073507691321a30952979 Mon Sep 17 00:00:00 2001 From: hnakamura5 Date: Mon, 8 Apr 2024 21:20:04 +0900 Subje

[clang] [clang-format] Remove trailing newlines in TableGen formatting test. (PR #87983)

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

[clang] [clang-format] Remove trailing newlines in TableGen formatting test. (PR #87983)

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

[clang] [clang-format] Fix the indent of the ternary operator when AlignOperands and BreakBeforeTernaryOperators is specified. (PR #100860)

2024-07-27 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 created https://github.com/llvm/llvm-project/pull/100860 Trying to fix https://github.com/llvm/llvm-project/issues/98559 . This PR modifies the ad-hoc tweaks introduced by https://reviews.llvm.org/D50078 . The change is limited to the case `AlignOperands ` and `B

[clang] [clang-format] Fix the indent of the ternary operator when AlignOperands and BreakBeforeTernaryOperators is specified. (PR #100860)

2024-07-29 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: > this is the default behavior of clang-format. And someone did intend it that > way. > If the change is desired, the BreakBeforeTernaryOperators option should be > expanded to an enum or AlignOperands extended. I agree. The current style has been default in this many years.

[clang] [clang-format] Fix a bug in annotating `*` in `#define`s (PR #99433)

2024-07-18 Thread Hirofumi Nakamura via cfe-commits
hnakamura5 wrote: This change certainly fixes the issue, but also seems specific for the reported code. For example it does not work well for the case the line contains something else as, ``` #define FN(N) void fn(void *addr) { a + f(addr, 0, N * two); } ``` This results the annotations where

[clang] [clang-format] Fix a bug in annotating `*` in `#define`s (PR #99433)

2024-07-20 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 approved this pull request. https://github.com/llvm/llvm-project/pull/99433 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-24 Thread Hirofumi Nakamura via cfe-commits
@@ -1426,12 +1428,9 @@ class AnnotatingParser { // the colon are passed as macro arguments. Tok->setType(TT_ObjCMethodExpr); } else if (Contexts.back().ContextKind == tok::l_paren && - !Line.InPragmaDirective) { -if (Style.isTableGe

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-25 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 approved this pull request. https://github.com/llvm/llvm-project/pull/92617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a TableGen crash on comment after l_paren (PR #124380)

2025-01-25 Thread Hirofumi Nakamura via cfe-commits
@@ -101,6 +101,9 @@ TEST_F(FormatTestTableGen, BangOperators) { " \"zerozero\",\n" " true: // default\n" " \"positivepositive\");\n"

[clang] [clang-format] Fix a TableGen crash on comment after l_paren (PR #124380)

2025-01-25 Thread Hirofumi Nakamura via cfe-commits
https://github.com/hnakamura5 approved this pull request. https://github.com/llvm/llvm-project/pull/124380 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    1   2