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

2024-01-14 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: You either have to use a new option, or adapt the documentation. Latter clearly only refers to `C++11 attributes`, which `__attribute__(())` isn't. I don't think a new option is needed. When you are already at it, you may also consider handling `__declspec()`. https:

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

2024-01-15 Thread Björn Schäpers via cfe-commits
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

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

2024-01-15 Thread Björn Schäpers via cfe-commits
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

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

2024-01-15 Thread Björn Schäpers 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] adds a space after not inside macros (PR #78176)

2024-01-15 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: I think this is kind of too specific. Whoever uses `not` will most likely not combine it with `!`. Also I agree with https://github.com/llvm/llvm-project/issues/78166#issuecomment-1892311219 that `WhitespaceSensitiveMacros` should be used. https://github.com/llvm/llv

[clang] [clang-format] Add parse tests for SeparateDefinitionBlocks option (PR #78256)

2024-01-16 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/78256 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add parse tests for SeparateDefinitionBlocks option (PR #78256)

2024-01-16 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks closed https://github.com/llvm/llvm-project/pull/78256 ___ 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 Björn Schäpers via cfe-commits
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

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

2024-01-18 Thread Björn Schäpers 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-18 Thread Björn Schäpers 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-18 Thread Björn Schäpers 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-18 Thread Björn Schäpers 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] Add SkipMacroDefinitionBody option (PR #78682)

2024-01-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/78682 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks requested changes to this pull request. I think splitting the two features would be better. Also please add a note to the changelog. https://github.com/llvm/llvm-project/pull/77918 ___ cfe-commits mailing list cfe

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-19 Thread Björn Schäpers via cfe-commits
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

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -2459,6 +2459,52 @@ struct FormatStyle { /// \version 12 EmptyLineBeforeAccessModifierStyle EmptyLineBeforeAccessModifier; + /// \brief Number of lines after includes. + /// If set, determines the number of lines to insert after includes. + /// Limited by MaxEmptyLin

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -2459,6 +2459,52 @@ struct FormatStyle { /// \version 12 EmptyLineBeforeAccessModifierStyle EmptyLineBeforeAccessModifier; + /// \brief Number of lines after includes. + /// If set, determines the number of lines to insert after includes. + /// Limited by MaxEmptyLin

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -0,0 +1,70 @@ +//===--- TopLevelCommentSeparator.cpp ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -1035,6 +1039,8 @@ template <> struct MappingTraits { IO.mapOptional("MaxEmptyLinesToKeep", Style.MaxEmptyLinesToKeep); IO.mapOptional("NamespaceIndentation", Style.NamespaceIndentation); IO.mapOptional("NamespaceMacros", Style.NamespaceMacros); +IO.mapOption

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -2459,6 +2459,52 @@ struct FormatStyle { /// \version 12 EmptyLineBeforeAccessModifierStyle EmptyLineBeforeAccessModifier; + /// \brief Number of lines after includes. + /// If set, determines the number of lines to insert after includes. + /// Limited by MaxEmptyLin

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -26846,6 +26846,26 @@ TEST_F(FormatTest, BreakAdjacentStringLiterals) { Style.BreakAdjacentStringLiterals = false; verifyFormat(Code, Style); } + +TEST_F(FormatTest, EmptyLinesAfterInclude) { + auto Style = getLLVMStyle(); + Style.EmptyLinesAfterIncludes = 2; + Style.

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -0,0 +1,70 @@ +//===--- TopLevelCommentSeparator.cpp ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -0,0 +1,112 @@ +//===- unittest/Format/TopLevelCommentSeparatorTest.cpp - Formatting unit tests +//-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Id

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -4827,6 +4873,8 @@ struct FormatStyle { DerivePointerAlignment == R.DerivePointerAlignment && DisableFormat == R.DisableFormat && EmptyLineAfterAccessModifier == R.EmptyLineAfterAccessModifier && + EmptyLinesAfterIncludes == R.Empty

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -26846,6 +26846,26 @@ TEST_F(FormatTest, BreakAdjacentStringLiterals) { Style.BreakAdjacentStringLiterals = false; verifyFormat(Code, Style); } + +TEST_F(FormatTest, EmptyLinesAfterInclude) { + auto Style = getLLVMStyle(); + Style.EmptyLinesAfterIncludes = 2; + Style.

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

2024-01-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. 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]: Fix formatting of if statements with BlockIndent (PR #77699)

2024-01-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/77699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add MainIncludeChar option. (PR #78752)

2024-01-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks requested changes to this pull request. https://github.com/llvm/llvm-project/pull/78752 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add MainIncludeChar option. (PR #78752)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -3392,6 +3392,24 @@ the configuration (without a prefix: ``Auto``). Priority:1 SortPriority:0 +.. _MainIncludeChar: HazardyKnusperkeks wrote: Did you add this by hand? I'm wondering why it has a different order than in the head

[clang] [clang-format] Add MainIncludeChar option. (PR #78752)

2024-01-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks edited https://github.com/llvm/llvm-project/pull/78752 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add MainIncludeChar option. (PR #78752)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -151,6 +151,21 @@ struct IncludeStyle { /// before any other include. /// \version 10 std::string IncludeIsMainSourceRegex; + + /// Character to consider in the include directives for the main header. + enum MainIncludeCharDiscriminator { +/// Main include uses q

[clang] [clang-format] Add MainIncludeChar option. (PR #78752)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -151,6 +151,21 @@ struct IncludeStyle { /// before any other include. /// \version 10 std::string IncludeIsMainSourceRegex; + + /// Character to consider in the include directives for the main header. + enum MainIncludeCharDiscriminator { HazardyKnus

[clang] [clang-format] Add MainIncludeChar option. (PR #78752)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -0,0 +1,27 @@ +// Test the combination of regrouped include directives, via regexes and HazardyKnusperkeks wrote: Our tests reside in `clang/unittests/Format/SortIncludesTest.cpp`. https://github.com/llvm/llvm-project/pull/78752 __

[clang] [clang-format] Add MainIncludeChar option. (PR #78752)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -151,6 +151,21 @@ struct IncludeStyle { /// before any other include. /// \version 10 std::string IncludeIsMainSourceRegex; + + /// Character to consider in the include directives for the main header. HazardyKnusperkeks wrote: It should also be added

[clang] [clang-format] Do not update cursor pos if no includes replacement (PR #77456)

2024-01-19 Thread Björn Schäpers via cfe-commits
@@ -3132,20 +3133,24 @@ static void sortCppIncludes(const FormatStyle &Style, } result += Includes[Index].Text; if (Cursor && CursorIndex == Index) - *Cursor = IncludesBeginOffset + result.size() - CursorToEOLOffset; + NewCursor = IncludesBeginOffset + res

[clang] [clang-format] Add MainIncludeChar option. (PR #78752)

2024-01-20 Thread Björn Schäpers via cfe-commits
@@ -3392,6 +3392,24 @@ the configuration (without a prefix: ``Auto``). Priority:1 SortPriority:0 +.. _MainIncludeChar: HazardyKnusperkeks wrote: There's a script: `clang/doc/tools/dump_format_style.py`. https://github.com/llvm/llv

[clang] [clang-format] Add MainIncludeChar option. (PR #78752)

2024-01-20 Thread Björn Schäpers via cfe-commits
@@ -0,0 +1,27 @@ +// Test the combination of regrouped include directives, via regexes and HazardyKnusperkeks wrote: I've never run anything but the unit tests. I'd remove these, but I have no strong opinion on that matter. https://github.com/llvm/llvm-project/

[clang] [clang-format] Separate License text and include blocks (PR #77918)

2024-01-20 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > > I think splitting the two features would be better. > > I'm going to close this MR and create two new ones. > > > Also please add a note to the changelog. > > Where can I find the changelog? `clang/docs/ReleaseNotes.rst` https://github.com/llvm/llvm-project/pull

[clang] [clang-format] Do not update cursor pos if no includes replacement (PR #77456)

2024-01-20 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > Oh, sorry @HazardyKnusperkeks I missed this in your previous comment. > > I've updated the PR. > > As a side note, I tried adding these two tests but they fail, meaning the > cursor is still incorrectly computed with CRLF when replacing lines. > > This is due to ad

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

2024-01-20 Thread Björn Schäpers via cfe-commits
@@ -2743,6 +2760,14 @@ FormatToken *UnwrappedLineParser::parseIfThenElse(IfStmtKind *IfKind, } } + // TableGen's if statement has the form of `if then { ... }`. + if (Style.isTableGen()) { +while (!eof() && !(FormatTok->is(Keywords.kw_then))) { H

[clang] [clang-format] Allow decltype in requires clause (PR #78847)

2024-01-20 Thread Björn Schäpers via cfe-commits
@@ -1071,6 +1071,16 @@ TEST_F(TokenAnnotatorTest, UnderstandsRequiresClausesAndConcepts) { "concept C = (!Foo) && Bar;"); HazardyKnusperkeks wrote: I'm in favor. Just for the correctness. https://github.com/llvm/llvm-project/pull/78847

[clang] [clang-format] Allow decltype in requires clause (PR #78847)

2024-01-20 Thread Björn Schäpers via cfe-commits
@@ -1071,6 +1071,16 @@ TEST_F(TokenAnnotatorTest, UnderstandsRequiresClausesAndConcepts) { "concept C = (!Foo) && Bar;"); ASSERT_EQ(Tokens.size(), 19u) << Tokens; EXPECT_TOKEN(Tokens[15], tok::ampamp, TT_BinaryOperator); + + Tokens = annotate("void f()

[clang] [clang-format] NEVER allow && to be an unary operator. (PR #78852)

2024-01-20 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: Never knew that, and I'm sad I do now... But based on the documentation one could just check the previous token to be one of `={,-+(`. https://github.com/llvm/llvm-project/pull/78852 ___ cfe-commits mailing list cfe-commits@l

[clang] [clang-format] Fix poor spacing in `AlignArrayOfStructures: Left` (PR #77868)

2024-01-20 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. Sorry, seems I've missed this change. https://github.com/llvm/llvm-project/pull/77868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [clang-format] NEVER allow && to be an unary operator. (PR #78852)

2024-01-21 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > #61233 > > The ambiguities this syntax extension can bring are pretty much impossible or > at least very hard to handle correctly with how we're currently parsing > things, but I'll try to avoid breaking things which weren't already broken. But that is misformatted

[llvm] [clang-tools-extra] [mlir] [lldb] [compiler-rt] [lld] [clang] [flang] [libcxx] [clang-format] Add ShortReturnTypeColumn option. (PR #78011)

2024-01-21 Thread Björn Schäpers via 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

[llvm] [clang-tools-extra] [mlir] [lldb] [compiler-rt] [lld] [clang] [flang] [libcxx] [clang-format] Add ShortReturnTypeColumn option. (PR #78011)

2024-01-21 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: Just ping me in a few days, if there is no other reaction and we merge it. 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

[clang] [clang-format] Allow decltype in requires clause (PR #78847)

2024-01-21 Thread Björn Schäpers via cfe-commits
@@ -1071,6 +1071,16 @@ TEST_F(TokenAnnotatorTest, UnderstandsRequiresClausesAndConcepts) { "concept C = (!Foo) && Bar;"); ASSERT_EQ(Tokens.size(), 19u) << Tokens; EXPECT_TOKEN(Tokens[15], tok::ampamp, TT_BinaryOperator); + + Tokens = annotate("void f()

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

2024-01-21 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. I'm actually fascinated how small the diff is, the description led me to thinking that we'd have a +/-200 lines change. https://github.com/llvm/llvm-project/pull/78846 ___ cfe-commits m

[clang] [clang-format] Allow decltype in requires clause (PR #78847)

2024-01-21 Thread Björn Schäpers via cfe-commits
@@ -1071,6 +1071,16 @@ TEST_F(TokenAnnotatorTest, UnderstandsRequiresClausesAndConcepts) { "concept C = (!Foo) && Bar;"); ASSERT_EQ(Tokens.size(), 19u) << Tokens; EXPECT_TOKEN(Tokens[15], tok::ampamp, TT_BinaryOperator); + + Tokens = annotate("void f()

[clang] [clang-format] Add MainIncludeChar option. (PR #78752)

2024-01-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/78752 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Allow decltype in requires clause (PR #78847)

2024-01-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/78847 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a bug in ContinuationIndenter (PR #78921)

2024-01-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/78921 ___ 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 set number of empty lines after includes (PR #78957)

2024-01-22 Thread Björn Schäpers via cfe-commits
@@ -3220,6 +3220,25 @@ the configuration (without a prefix: ``Auto``). +.. _EmptyLinesAfterIncludes: + +**EmptyLinesAfterIncludes** (``Unsigned``) :versionbadge:`clang-format 18` :ref:`¶ ` HazardyKnusperkeks wrote: Where do I have to sign up for that knowl

[clang] [clang-format] Add options to set number of empty lines after includes (PR #78957)

2024-01-22 Thread Björn Schäpers via cfe-commits
@@ -4831,6 +4848,7 @@ struct FormatStyle { DerivePointerAlignment == R.DerivePointerAlignment && DisableFormat == R.DisableFormat && EmptyLineAfterAccessModifier == R.EmptyLineAfterAccessModifier && + EmptyLinesAfterIncludes == R.Empty

[clang] [clang-format] Add options to set number of empty lines after includes (PR #78957)

2024-01-22 Thread Björn Schäpers via cfe-commits
@@ -0,0 +1,159 @@ +//===--- IncludesSeparator.cpp ---*- C++ -*-===// HazardyKnusperkeks wrote: Does this have to be done in a separate pass? Couldn't it be done in the normal formatting? https://github.com/llvm/llvm-project/pull/78957 __

[clang] [Format] Fix detection of languages when reading from stdin (PR #79051)

2024-01-22 Thread Björn Schäpers via cfe-commits
@@ -547,18 +547,20 @@ static void PrintVersion(raw_ostream &OS) { // Dump the configuration. static int dumpConfig(bool IsSTDIN) { std::unique_ptr Code; - // We can't read the code to detect the language if there's no file name. - if (!IsSTDIN) { -// Read in the code in

[clang] [Format] Fix detection of languages when reading from stdin (PR #79051)

2024-01-22 Thread Björn Schäpers via cfe-commits
@@ -0,0 +1,5 @@ +// RUN: clang-format -dump-config - < %s | FileCheck %s HazardyKnusperkeks wrote: I don't think you need this, right? The unit tests does the same, or not? https://github.com/llvm/llvm-project/pull/79051 _

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2023-10-18 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/69340 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a bug in annotating TrailingReturnArrow (PR #69249)

2023-10-18 Thread Björn Schäpers via cfe-commits
@@ -3497,6 +3497,15 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const { Tok->setType(TT_TrailingReturnArrow); break; } +if (Tok->isNot(TT_TrailingAnnotation)) HazardyKnusperkeks wrote: Unders

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-18 Thread Björn Schäpers via cfe-commits
@@ -3191,20 +3191,146 @@ TEST_F(FormatTestComments, DontAlignNamespaceComments) { "}\n" "// Comment"; -#if 0 - // FIXME: The following comment is aligned with the namespace comment. verifyFormat("namespace A {\n" " int Foo;\n"

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-18 Thread Björn Schäpers via cfe-commits
@@ -1118,16 +1121,35 @@ void WhitespaceManager::alignTrailingComments() { } } -// We don't want to align namespace end comments. -const bool DontAlignThisComment = -I > 0 && C.NewlinesBefore == 0 && -Changes[I - 1].Tok->is(TT_NamespaceRBrace);

[clang] [clang-format] Annotate do while while (PR #69707)

2023-10-20 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks created https://github.com/llvm/llvm-project/pull/69707 So we can differentiate on the while keyword between a do-while-loop and a normal while-loop. From be24095877e6ddd25e0884ad8aaf3eca4846f38d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-20 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks updated https://github.com/llvm/llvm-project/pull/68743 From be24095877e6ddd25e0884ad8aaf3eca4846f38d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Fri, 20 Oct 2023 13:00:39 +0200 Subject: [PATCH 1/2] [clang-format] Annotate do

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-20 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: Some pathological test cases added and handling do-while (relying on #69707). Only a reply from @mydeveloperday open regarding the change of the existing test with function braces. https://github.com/llvm/llvm-project/pull/68743

[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-20 Thread Björn Schäpers via cfe-commits
@@ -0,0 +1 @@ +py -3 git-clang-format %* HazardyKnusperkeks wrote: What is `py`? I have no program called `py` on my machine (Windows with msys2), so you would possibly break that? Why not write `python` or `python3`? https://github.com/llvm/llvm-project/pull/6

[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-20 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: I have no real opinion on this matter, as I don't use that program/script. But when it helps the windows users, why not? I also see no harm. https://github.com/llvm/llvm-project/pull/69228 ___ cfe-commits mailing list cfe-com

[clang] [clang-format] Annotate do while while (PR #69707)

2023-10-20 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks closed https://github.com/llvm/llvm-project/pull/69707 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add a new style for the clang-format source code (PR #69814)

2023-10-21 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. What is your goal with that style? https://github.com/llvm/llvm-project/pull/69814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [clang-format] Add a new style for the clang-format source code (PR #69814)

2023-10-21 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > > What is your goal with that style? > > It was actually your [idea](https://reviews.llvm.org/D153208#4431239). 😉 I know, but I thought the thought was dropped. :) So the intent is to use it on our `.clang-format` files? https://github.com/llvm/llvm-project/pull/69

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-21 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks updated https://github.com/llvm/llvm-project/pull/68743 From 8df1b77e223cd5ab5d759ae2d57f4c79306f9149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Tue, 10 Oct 2023 22:50:43 +0200 Subject: [PATCH] [clang-format] Don't align com

[clang] [clang-format] Don't break between string literal operands of << (PR #69871)

2023-10-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks edited https://github.com/llvm/llvm-project/pull/69871 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Don't break between string literal operands of << (PR #69871)

2023-10-22 Thread Björn Schäpers via cfe-commits
@@ -5118,10 +5118,6 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, return true; if (Left.IsUnterminatedLiteral) return true; - if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) && HazardyKnusperkeks wrote:

[clang] [clang-format] Don't break between string literal operands of << (PR #69871)

2023-10-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/69871 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Don't break between string literal operands of << (PR #69871)

2023-10-22 Thread Björn Schäpers via cfe-commits
@@ -5118,10 +5118,6 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, return true; if (Left.IsUnterminatedLiteral) return true; - if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) && HazardyKnusperkeks wrote:

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks updated https://github.com/llvm/llvm-project/pull/68743 From 2efda4c7d5e99b3506a874d514adcb16fe46adce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Tue, 10 Oct 2023 22:50:43 +0200 Subject: [PATCH] [clang-format] Don't align com

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-22 Thread Björn Schäpers via cfe-commits
@@ -1118,16 +1121,48 @@ void WhitespaceManager::alignTrailingComments() { } } -// We don't want to align namespace end comments. -const bool DontAlignThisComment = -I > 0 && C.NewlinesBefore == 0 && -Changes[I - 1].Tok->is(TT_NamespaceRBrace);

[clang] [clang-format] Don't alter SpacesRequiredBefore of finalized tokens (PR #69897)

2023-10-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/69897 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-24 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks updated https://github.com/llvm/llvm-project/pull/68743 From 465003388953a52b70702d45cef7c4031581310d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Tue, 10 Oct 2023 22:50:43 +0200 Subject: [PATCH] [clang-format] Don't align com

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-24 Thread Björn Schäpers via cfe-commits
@@ -3191,20 +3198,150 @@ TEST_F(FormatTestComments, DontAlignNamespaceComments) { "}\n" "// Comment"; -#if 0 - // FIXME: The following comment is aligned with the namespace comment. verifyFormat("namespace A {\n" " int Foo;\n"

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-24 Thread Björn Schäpers via cfe-commits
@@ -3191,20 +3198,167 @@ TEST_F(FormatTestComments, DontAlignNamespaceComments) { "}\n" "// Comment"; -#if 0 - // FIXME: The following comment is aligned with the namespace comment. verifyFormat("namespace A {\n" " int Foo;\n"

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-24 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks updated https://github.com/llvm/llvm-project/pull/68743 From 3e76e5a0724af4d6f24175796856c919f30547a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Tue, 10 Oct 2023 22:50:43 +0200 Subject: [PATCH] [clang-format] Don't align com

[clang] [clang-format] unexpected break after binOp '<<' (PR #69859)

2023-10-24 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: What Owen says. And given that the modified lines were removed, maybe the issue(s) are also gone? To the review unrelated, why didn't it get the @llvm/pr-subscribers-clang-format thing? https://github.com/llvm/llvm-project/pull/69859 _

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-24 Thread Björn Schäpers via cfe-commits
@@ -3191,20 +3198,167 @@ TEST_F(FormatTestComments, DontAlignNamespaceComments) { "}\n" "// Comment"; -#if 0 - // FIXME: The following comment is aligned with the namespace comment. verifyFormat("namespace A {\n" " int Foo;\n"

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-24 Thread Björn Schäpers via cfe-commits
@@ -182,7 +182,7 @@ TEST_F(FormatTestComments, UnderstandsSingleLineComments) { "int a; // This is unrelated")); EXPECT_EQ("class C {\n" " void f() { // This does something ..\n" -" } // awesome..\n" +"

[clang] [clang-format] Don't align comments over scopes (PR #68743)

2023-10-25 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks closed https://github.com/llvm/llvm-project/pull/68743 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] unexpected break after binOp '<<' (PR #69859)

2023-10-25 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > yes, issue with breaking after << is gone. I want to get your point about > functionality clang-format and implementing new option such as > "BreakAfterStreamOperator". As i can see, @HazardyKnusperkeks you agree with > "owenca" point? > > May be i can do something

[clang] [clang-format] Option to ignore PP directives (PR #70338)

2023-10-27 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks edited https://github.com/llvm/llvm-project/pull/70338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Option to ignore PP directives (PR #70338)

2023-10-27 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks requested changes to this pull request. https://github.com/llvm/llvm-project/pull/70338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Option to ignore PP directives (PR #70338)

2023-10-27 Thread Björn Schäpers via cfe-commits
@@ -24153,6 +24153,23 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { HazardyKnusperkeks wrote: Add some tests: * With formatted code a

[clang] [clang-format] Option to ignore PP directives (PR #70338)

2023-10-27 Thread Björn Schäpers via cfe-commits
@@ -4648,6 +4648,10 @@ struct FormatStyle { /// \version 11 std::vector WhitespaceSensitiveMacros; + /// Ignore formatting in preprocessor definitions. + /// \version 18 + bool IgnorePPDefinitions; HazardyKnusperkeks wrote: Please sort alphabetically.

[clang] [clang-format] Option to ignore PP directives (PR #70338)

2023-10-27 Thread Björn Schäpers via cfe-commits
@@ -1354,7 +1354,9 @@ unsigned UnwrappedLineFormatter::format( bool FixIndentation = (FixBadIndentation || ContinueFormatting) && Indent != TheLine.First->OriginalColumn; -bool ShouldFormat = TheLine.Affected || FixIndentation; +bool Shoul

[clang] 3630640 - [clang-format] Remove double trim

2020-12-13 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2020-12-13T14:16:54+01:00 New Revision: 36306403d492d4a4b54c72c6c4c511021584243b URL: https://github.com/llvm/llvm-project/commit/36306403d492d4a4b54c72c6c4c511021584243b DIFF: https://github.com/llvm/llvm-project/commit/36306403d492d4a4b54c72c6c4c511021584243b.diff

[clang] 5e5ef53 - [clang-format][NFC] Expand BreakBeforeBraces examples

2020-12-18 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2020-12-18T19:08:03+01:00 New Revision: 5e5ef5359742c3feb6f41058a356a28c7ab3ea6d URL: https://github.com/llvm/llvm-project/commit/5e5ef5359742c3feb6f41058a356a28c7ab3ea6d DIFF: https://github.com/llvm/llvm-project/commit/5e5ef5359742c3feb6f41058a356a28c7ab3ea6d.diff

[clang] 374f1d8 - [clang-format] Fix handling of TextProto comments

2020-12-23 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2020-12-23T22:07:13+01:00 New Revision: 374f1d81febf8143e8e633296a42c2311699c5b3 URL: https://github.com/llvm/llvm-project/commit/374f1d81febf8143e8e633296a42c2311699c5b3 DIFF: https://github.com/llvm/llvm-project/commit/374f1d81febf8143e8e633296a42c2311699c5b3.diff

[clang] 47877c9 - [clang-format] Add SpaceBeforeCaseColon option

2020-12-23 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2020-12-23T22:07:14+01:00 New Revision: 47877c9079c27f19a954b660201ea47717c82fec URL: https://github.com/llvm/llvm-project/commit/47877c9079c27f19a954b660201ea47717c82fec DIFF: https://github.com/llvm/llvm-project/commit/47877c9079c27f19a954b660201ea47717c82fec.diff

[clang] 9ef66ed - [clang-format][NFC] correctly sort StatementAttributeLike-macros' IO.map

2021-05-25 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2021-05-26T07:59:08+02:00 New Revision: 9ef66ed43758a575e1f53a09f07ecb7e3025aafa URL: https://github.com/llvm/llvm-project/commit/9ef66ed43758a575e1f53a09f07ecb7e3025aafa DIFF: https://github.com/llvm/llvm-project/commit/9ef66ed43758a575e1f53a09f07ecb7e3025aafa.diff

[clang] 7faffde - [clang-format] [NFC] realign documentation in Format.h...

2021-05-27 Thread Björn Schäpers via cfe-commits
Author: Max Sagebaum Date: 2021-05-27T13:12:55+02:00 New Revision: 7faffdeb48d3d81ba8fc1353f1a9a563a25adf6d URL: https://github.com/llvm/llvm-project/commit/7faffdeb48d3d81ba8fc1353f1a9a563a25adf6d DIFF: https://github.com/llvm/llvm-project/commit/7faffdeb48d3d81ba8fc1353f1a9a563a25adf6d.diff

[clang] 6cb2887 - [clang-format] [NFC] Use some constexpr StringRef

2021-01-25 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2021-01-25T21:02:40+01:00 New Revision: 6cb288797122ad931aba91e05030c24984e1031c URL: https://github.com/llvm/llvm-project/commit/6cb288797122ad931aba91e05030c24984e1031c DIFF: https://github.com/llvm/llvm-project/commit/6cb288797122ad931aba91e05030c24984e1031c.diff

[clang] 7c8b9c1 - [clang-format] [NFC] Restructure getLineCommentIndentPrefix

2021-01-25 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2021-01-25T21:02:40+01:00 New Revision: 7c8b9c102f38a4d29ac56ef7bd1da003f03900d0 URL: https://github.com/llvm/llvm-project/commit/7c8b9c102f38a4d29ac56ef7bd1da003f03900d0 DIFF: https://github.com/llvm/llvm-project/commit/7c8b9c102f38a4d29ac56ef7bd1da003f03900d0.diff

<    1   2   3   4   5   6   7   8   9   >