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
https://github.com/HazardyKnusperkeks approved this pull request.
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
@@ -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 [{
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
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
@@ -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 [{
https://github.com/HazardyKnusperkeks commented:
You can just mark conversations as resolved. You still can comment on them. But
if it's clear no need to keep it open.
https://github.com/llvm/llvm-project/pull/78032
___
cfe-commits mailing list
cfe-co
https://github.com/HazardyKnusperkeks 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
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
@@ -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 [{
@@ -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
@@ -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
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
@@ -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
@@ -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
@@ -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 [{
@@ -763,6 +773,53 @@ void
FormatTokenLexer::handleCSharpVerbatimAndInterpolatedStrings() {
resetLexer(SourceMgr.getFileOffset(Lex->getSourceLocation(Offset + 1)));
}
+void FormatTokenLexer::handleTableGenMultilineString() {
+ FormatToken *MultiLineString = Tokens.back();
+
@@ -1710,7 +1710,7 @@ class AnnotatingParser {
TT_UnionLBrace, TT_RequiresClause,
TT_RequiresClauseInARequiresExpression, TT_RequiresExpression,
TT_RequiresExpressionLParen, TT_RequiresExpressionLBrace,
-TT_BracedListLBrace)) {
+
@@ -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.
---
@@ -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
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
@@ -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.
---
@@ -1710,7 +1710,7 @@ class AnnotatingParser {
TT_UnionLBrace, TT_RequiresClause,
TT_RequiresClauseInARequiresExpression, TT_RequiresExpression,
TT_RequiresExpressionLParen, TT_RequiresExpressionLBrace,
-TT_BracedListLBrace)) {
+
@@ -763,6 +773,53 @@ void
FormatTokenLexer::handleCSharpVerbatimAndInterpolatedStrings() {
resetLexer(SourceMgr.getFileOffset(Lex->getSourceLocation(Offset + 1)));
}
+void FormatTokenLexer::handleTableGenMultilineString() {
+ FormatToken *MultiLineString = Tokens.back();
+
@@ -272,6 +274,14 @@ void FormatTokenLexer::tryMergePreviousTokens() {
return;
}
}
+ if (Style.isTableGen()) {
+if (tryMergeTokens({tok::l_square, tok::l_brace},
HazardyKnusperkeks wrote:
```suggestion
if (Style.isTableGen() && tryMergeToken
llvmbot wrote:
@llvm/pr-subscribers-clang-format
Author: Hirofumi Nakamura (hnakamura5)
Changes
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
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
27 matches
Mail list logo