https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/80569
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks created
https://github.com/llvm/llvm-project/pull/81185
#78752 was not merged in time for clang-format 18.
From 0a6d07033cbc8218763bbee44df688b29bf7aa55 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?=
Date: Thu, 8 Feb 2024 21:08:52 +0
@@ -1010,7 +1010,8 @@ struct FormatStyle {
/// \version 3.7
DefinitionReturnTypeBreakingStyle AlwaysBreakAfterDefinitionReturnType;
- /// The function declaration return type breaking style to use.
+ /// The function declaration return type breaking style to use. This
+
@@ -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
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/80241
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/81093
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks commented:
I'd go contrary to your
[comment](https://github.com/llvm/llvm-project/pull/80827#issuecomment-1935386091)
and rename the attribute. Because otherwise you still have the contradiction
within the code.
https://github.com/llvm/llvm-project/pull/8
https://github.com/HazardyKnusperkeks closed
https://github.com/llvm/llvm-project/pull/81185
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/81390
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
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
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/81444
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/81578
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/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
https://github.com/HazardyKnusperkeks commented:
I think you need to run `clang/docs/tools/dump_format_help.py`.
https://github.com/llvm/llvm-project/pull/84346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mail
https://github.com/HazardyKnusperkeks edited
https://github.com/llvm/llvm-project/pull/84346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -535,6 +541,9 @@ static bool format(StringRef FileName) {
Rewrite.getEditBuffer(ID).write(outs());
}
}
+ if (ErrorOnIncompleteFormat && !Status.FormatComplete)
+return true;
+
return false;
HazardyKnusperkeks wrote:
```suggestion
retur
HazardyKnusperkeks wrote:
> I think you need to run `clang/docs/tools/dump_format_help.py`.
https://github.com/llvm/llvm-project/pull/84346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co
HazardyKnusperkeks wrote:
That's okay for clang-format, but you couldn't use libFormat with different
languages at once anymore.
I dislike global state in libraries.
https://github.com/llvm/llvm-project/pull/84599
___
cfe-commits mailing list
cfe-com
HazardyKnusperkeks wrote:
Then I'd go back to `Style.isCpp()`.
What happens if you use libFormat concurrently?
https://github.com/llvm/llvm-project/pull/84599
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailm
HazardyKnusperkeks wrote:
> > What happens if you use libFormat concurrently?
>
> Can you elaborate? Doesn't each process get its own copy of the globals of a
> shared library?
I mean multiple threads in the same process with different languages. maybe
unlikely, but not impossible.
https://g
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/82735
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
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
@@ -849,7 +851,12 @@ void WhitespaceManager::alignConsecutiveAssignments() {
}
void WhitespaceManager::alignConsecutiveBitFields() {
- if (!Style.AlignConsecutiveBitFields.Enabled)
+ alignConsecutiveColons(Style.AlignConsecutiveBitFields, TT_BitFieldColon);
+}
+
+void Whites
https://github.com/HazardyKnusperkeks edited
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
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/82911
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -849,7 +851,12 @@ void WhitespaceManager::alignConsecutiveAssignments() {
}
void WhitespaceManager::alignConsecutiveBitFields() {
- if (!Style.AlignConsecutiveBitFields.Enabled)
+ alignConsecutiveColons(Style.AlignConsecutiveBitFields, TT_BitFieldColon);
+}
+
+void Whites
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/82957
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
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
HazardyKnusperkeks wrote:
The question is: why? And why handle c++ different than all other languages?
https://github.com/llvm/llvm-project/pull/83533
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listin
https://github.com/HazardyKnusperkeks closed
https://github.com/llvm/llvm-project/pull/83380
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/83533
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks closed
https://github.com/llvm/llvm-project/pull/83415
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/78011
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/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
@@ -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.
HazardyKn
@@ -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
@@ -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
@@ -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
@@ -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->
@@ -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
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/79051
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -4542,18 +4542,51 @@ struct FormatStyle {
/// Other: true
/// \endcode
struct SpacesInParensCustom {
+/// Override any of the following options to prevent addition of space
+/// between the first two parentheses in situations where a pair of
+/// parent
@@ -4006,11 +3993,58 @@ bool TokenAnnotator::spaceRequiredBetween(const
AnnotatedLine &Line,
}
if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) {
-return (Right.is(TT_CastRParen) ||
-(Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen)))
-
@@ -4542,18 +4542,51 @@ struct FormatStyle {
/// Other: true
HazardyKnusperkeks wrote:
Add the options here too?
https://github.com/llvm/llvm-project/pull/77522
___
cfe-commits mailing list
cfe-commits@lists.llv
@@ -4006,11 +3993,58 @@ bool TokenAnnotator::spaceRequiredBetween(const
AnnotatedLine &Line,
}
if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) {
-return (Right.is(TT_CastRParen) ||
-(Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen)))
-
@@ -4006,11 +3993,58 @@ bool TokenAnnotator::spaceRequiredBetween(const
AnnotatedLine &Line,
}
if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) {
-return (Right.is(TT_CastRParen) ||
-(Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen)))
-
@@ -0,0 +1,159 @@
+//===--- IncludesSeparator.cpp ---*- C++ -*-===//
HazardyKnusperkeks wrote:
Maybe you could work something out with the line type?
https://github.com/llvm/llvm-project/blob/4fcd7cf22deff4a63d2bac12c909be7266f8b353/clang/
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/79549
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -922,8 +922,23 @@ struct FormatStyle {
/// };
/// int f();
/// int f() { return 1; }
+/// int f::
HazardyKnusperkeks wrote:
I'd go with short names, and just name them like `LongName` o
@@ -587,7 +590,7 @@ bool ContinuationIndenter::mustBreak(const LineState
&State) {
!State.Line->ReturnTypeWrapped &&
// Don't break before a C# function when no break after return type.
(!Style.isCSharp() ||
- Style.AlwaysBreakAfterReturnType != FormatS
@@ -922,8 +922,23 @@ struct FormatStyle {
/// };
/// int f();
/// int f() { return 1; }
+/// int f::
+/// bar();
/// \endcode
RTBS_None,
+/// Break after return t
@@ -922,8 +922,23 @@ struct FormatStyle {
/// };
/// int f();
/// int f() { return 1; }
+/// int f::
+/// bar();
/// \endcode
RTBS_None,
+/// Break after return t
@@ -474,7 +474,7 @@ class State:
opts = sorted(opts, key=lambda x: x.name)
options_text = "\n\n".join(map(str, opts))
-with open(DOC_FILE) as f:
+with open(DOC_FILE, encoding="utf-8") as f:
HazardyKnusperkeks wrote:
Unrelated.
https://github.com/llvm/llvm-pr
HazardyKnusperkeks wrote:
> @mydeveloperday @HazardyKnusperkeks @rymiel this patch fixes a very old bug
> and will cause behavior changes whether the default is changed to the new
> `AllowShortType` or left at `None`. Which way should we go?
What would change if the default was kept at `None`?
@@ -587,7 +590,7 @@ bool ContinuationIndenter::mustBreak(const LineState
&State) {
!State.Line->ReturnTypeWrapped &&
// Don't break before a C# function when no break after return type.
(!Style.isCSharp() ||
- Style.AlwaysBreakAfterReturnType != FormatS
HazardyKnusperkeks wrote:
> > @mydeveloperday @HazardyKnusperkeks @rymiel this patch fixes a very old bug
> > and will cause behavior changes whether the default is changed to the new
> > `AllowShortType` or left at `None`. Which way should we go?
>
> Now I'm leaning toward keeping the existin
https://github.com/HazardyKnusperkeks approved this pull request.
Thanks.
https://github.com/llvm/llvm-project/pull/79805
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -922,8 +922,23 @@ struct FormatStyle {
/// };
/// int f();
/// int f() { return 1; }
+/// int f::
+/// bar();
/// \endcode
RTBS_None,
+/// Break after return t
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/79796
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks edited
https://github.com/llvm/llvm-project/pull/79785
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/79785
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1694,8 +1694,11 @@ void
ContinuationIndenter::moveStatePastFakeLParens(LineState &State,
// Special case for generic selection expressions, its comma-separated
// expressions are not aligned to the opening paren like regular calls, but
// rather continuation-in
https://github.com/HazardyKnusperkeks approved this pull request.
I didn't say anything because I was also waiting on @mydeveloperday.
I see no problem with the current approach and think token annotator tests are
enough.
https://github.com/llvm/llvm-project/pull/78996
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/77833
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/77013
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -4007,26 +3992,45 @@ bool TokenAnnotator::spaceRequiredBetween(const
AnnotatedLine &Line,
return true;
}
- // TODO: check consecutive parens
if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) {
-if (Right.is(TT_CastRParen) ||
-(Left.MatchingParen &&
@@ -17016,6 +17056,158 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
verifyFormat("size_t idx = (a->foo)(a - 1);", Spaces);
verifyFormat("size_t idx = (*foo)(a - 1);", Spaces);
verifyFormat("size_t idx = (*(foo))(a - 1);", Spaces);
+
+ // Check NonConsecutive space
@@ -17001,6 +17056,158 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
verifyFormat("size_t idx = (a->foo)(a - 1);", Spaces);
verifyFormat("size_t idx = (*foo)(a - 1);", Spaces);
verifyFormat("size_t idx = (*(foo))(a - 1);", Spaces);
+
+ // Check NonConsecutive space
@@ -17016,6 +17056,158 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
verifyFormat("size_t idx = (a->foo)(a - 1);", Spaces);
verifyFormat("size_t idx = (*foo)(a - 1);", Spaces);
verifyFormat("size_t idx = (*(foo))(a - 1);", Spaces);
+
+ // Check NonConsecutive space
https://github.com/HazardyKnusperkeks requested changes to this pull request.
I think you want too much in one change.
Maybe first only handle #42112 for what I will be really grateful. And then the
stuff with the _license_, because I see discussion there. As far as I can tell
you just declare
https://github.com/HazardyKnusperkeks edited
https://github.com/llvm/llvm-project/pull/77918
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -171,6 +187,31 @@ void DefinitionBlockSeparator::separateBlocks(
return false;
};
+// Separate License text.
+const bool isComment = Lines[I]->isComment();
HazardyKnusperkeks wrote:
```suggestion
const bool IsComment = Lines[I]->isCom
@@ -586,7 +586,8 @@ template <>
struct ScalarEnumerationTraits {
static void enumeration(IO &IO, FormatStyle::SeparateDefinitionStyle &Value)
{
IO.enumCase(Value, "Leave", FormatStyle::SDS_Leave);
-IO.enumCase(Value, "Always", FormatStyle::SDS_Always);
+IO.enumCa
@@ -65,18 +81,18 @@ void DefinitionBlockSeparator::separateBlocks(
}
return false;
};
- unsigned NewlineCount =
- (Style.SeparateDefinitionBlocks == FormatStyle::SDS_Always ? 1 : 0) + 1;
+ unsigned NewlineCount = getNewlineCount(Style.SeparateDefinitionBlocks);
@@ -65,18 +81,18 @@ void DefinitionBlockSeparator::separateBlocks(
}
return false;
};
- unsigned NewlineCount =
- (Style.SeparateDefinitionBlocks == FormatStyle::SDS_Always ? 1 : 0) + 1;
+ unsigned NewlineCount = getNewlineCount(Style.SeparateDefinitionBlocks);
@@ -17,80 +17,97 @@
namespace clang {
namespace format {
namespace {
+std::string
+separateDefinitionBlocks(llvm::StringRef Code,
+ const std::vector &Ranges,
+ const FormatStyle &Style = getLLVMStyle()) {
+ LLVM_DEBUG(llvm::errs
@@ -586,7 +586,8 @@ template <>
struct ScalarEnumerationTraits {
static void enumeration(IO &IO, FormatStyle::SeparateDefinitionStyle &Value)
{
IO.enumCase(Value, "Leave", FormatStyle::SDS_Leave);
-IO.enumCase(Value, "Always", FormatStyle::SDS_Always);
+IO.enumCa
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/76804
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
HazardyKnusperkeks wrote:
> Can someone review this please? Did you see it when I opened the pull request
> 2 weeks ago or only when I added the reviewers just now? I thought reviewers
> would be added automatically.
Every member of @pr-subscribers-clang-format will be informed, and I look int
@@ -1304,6 +1304,18 @@ TEST_F(FormatTestCSharp, CSharpGenericTypeConstraints) {
"}",
Style);
+ // When the where line is not to be formatted, following lines should not
take
HazardyKnusperkeks wrote:
```suggestion
// When the
@@ -1304,6 +1304,18 @@ TEST_F(FormatTestCSharp, CSharpGenericTypeConstraints) {
"}",
Style);
+ // When the where line is not to be formatted, following lines should not
take
+ // on its indentation.
+ verifyFormat("class ItemFactory\n"
---
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/77977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/77522
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3928,6 +3928,13 @@ struct FormatStyle {
/// \version 13
unsigned ShortNamespaceLines;
+ /// When AlwaysBreakAfterReturnType is None, line breaks are prevented after
HazardyKnusperkeks wrote:
```suggestion
/// When ``AlwaysBreakAfterReturnType`` is
@@ -3928,6 +3928,13 @@ struct FormatStyle {
/// \version 13
unsigned ShortNamespaceLines;
+ /// When AlwaysBreakAfterReturnType is None, line breaks are prevented after
+ /// short return types. This configures the character limit for a type to be
+ /// regarded as shor
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/78015
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/76378
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
HazardyKnusperkeks wrote:
> > Maybe first only handle #42112 for what I will be really grateful.
>
> #42112 requests separating both license text and include directives blocks.
>
My bad, I only looked at the title, not the text.
> > And then the stuff with the _license_, because I see discuss
@@ -17,80 +17,97 @@
namespace clang {
namespace format {
namespace {
+std::string
+separateDefinitionBlocks(llvm::StringRef Code,
+ const std::vector &Ranges,
+ const FormatStyle &Style = getLLVMStyle()) {
+ LLVM_DEBUG(llvm::errs
@@ -586,7 +586,8 @@ template <>
struct ScalarEnumerationTraits {
static void enumeration(IO &IO, FormatStyle::SeparateDefinitionStyle &Value)
{
IO.enumCase(Value, "Leave", FormatStyle::SDS_Leave);
-IO.enumCase(Value, "Always", FormatStyle::SDS_Always);
+IO.enumCa
@@ -586,7 +586,8 @@ template <>
struct ScalarEnumerationTraits {
static void enumeration(IO &IO, FormatStyle::SeparateDefinitionStyle &Value)
{
IO.enumCase(Value, "Leave", FormatStyle::SDS_Leave);
-IO.enumCase(Value, "Always", FormatStyle::SDS_Always);
+IO.enumCa
@@ -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
@@ -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.
---
https://github.com/HazardyKnusperkeks closed
https://github.com/llvm/llvm-project/pull/78015
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/78011
___
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
201 - 300 of 884 matches
Mail list logo