[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

2024-06-11 Thread Björn Schäpers via cfe-commits
@@ -1269,10 +1269,17 @@ class AnnotatingParser { if (CurrentToken && CurrentToken->is(tok::less)) { CurrentToken->setType(TT_TemplateOpener); next(); - if (!parseAngle()) + TemplateDeclarationDepth++; + if (!parseAngle()) { +TemplateDeclar

[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

2024-06-11 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/95025 ___ 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 lambda l_square (PR #95084)

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

[clang] [clang-format] Add BinPackBinaryOperations configuration (PR #95013)

2024-06-11 Thread Björn Schäpers via cfe-commits
@@ -27492,6 +27492,86 @@ TEST_F(FormatTest, SpaceBetweenKeywordAndLiteral) { verifyFormat("return sizeof \"5\";"); } +TEST_F(FormatTest, BinPackBinaryOperations) { + auto Style = getLLVMStyle(); + Style.BinPackBinaryOperations = false; + + // Logical operations + verifyF

[clang] [clang-format] Don't over-indent comment below unbraced body (PR #95354)

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

[clang] [clang-format] Handle AttributeMacro before access modifiers (PR #95503)

2024-06-14 Thread Björn Schäpers via cfe-commits
@@ -57,7 +57,10 @@ class LevelIndentTracker { /// Update the indent state given that \p Line is going to be formatted /// next. void nextLine(const AnnotatedLine &Line) { -Offset = getIndentOffset(*Line.First); +const auto *Tok = Line.First; +if (Tok->is(TT_At

[clang] [clang-format] Handle AttributeMacro before access modifiers (PR #95634)

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

[clang] [Clang] Fix logical error in 'if else' condition that lead to an unreachable code (PR #95666)

2024-06-15 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks commented: I'd say if it's dead code, remove it. No tests are failing. Or you have to provide a test case which fails without this change and passes with it. Except the code is only recently dead, then we may have to wait for the bug reports. https://git

[clang] [Clang] Remove unreachable code in verilogGroupDecl (NFC) (PR #95666)

2024-06-16 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: I think @sstwcw fixes this in #95703 https://github.com/llvm/llvm-project/pull/95666 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Handle Verilog delay control (PR #95703)

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

[clang] [clang-format] Handle function try block with ctor-initializer (PR #95878)

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

[clang] [clang-format] Add BinPackBinaryOperations configuration (PR #95013)

2024-06-18 Thread Björn Schäpers via cfe-commits
@@ -27492,6 +27492,86 @@ TEST_F(FormatTest, SpaceBetweenKeywordAndLiteral) { verifyFormat("return sizeof \"5\";"); } +TEST_F(FormatTest, BinPackBinaryOperations) { + auto Style = getLLVMStyle(); + Style.BinPackBinaryOperations = false; + + // Logical operations + verifyF

[clang] [clang-format][NFC] Add CMake target clang-format-check-format (PR #95873)

2024-06-19 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: I have no idea about cmake files and hopefully never will. So I can't say anything on how you did it, I'm fine with what you want to do. https://github.com/llvm/llvm-project/pull/95873 ___ cfe-commits mailing list cfe-commits

[clang] [clang-format] Correctly annotate l_brace after TypenameMacro (PR #96026)

2024-06-19 Thread Björn Schäpers via cfe-commits
@@ -3180,6 +3180,18 @@ TEST_F(TokenAnnotatorTest, FunctionTryBlock) { EXPECT_TOKEN(Tokens[36], tok::l_brace, TT_FunctionLBrace); } +TEST_F(TokenAnnotatorTest, TypenameMacro) { + auto Style = getLLVMStyle(); + Style.TypenameMacros.push_back("STRUCT"); + + auto Tokens = ann

[clang] [clang-format] Correctly annotate l_brace after TypenameMacro (PR #96026)

2024-06-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/96026 ___ 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)

2024-06-19 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > Where is the documentation for the value? CLion reports `clang-format` option > as an error by the reason. No doc, no schema rule. There: > I don't want to "advertise" this new style in the documentation but am > willing to be overruled by the majority. There is no

[clang] [clang-format[NFC] Clean up AnnotatingParser::rParenEndsCast() (PR #96128)

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

[clang] [clang-format] add an option to insert a space only for non-code block empty braces, not for empty parentheses (PR #93634)

2024-05-29 Thread Björn Schäpers via cfe-commits
@@ -14027,6 +14027,11 @@ TEST_F(FormatTest, LayoutCxx11BraceInitializers) { SpaceBetweenBraces.SpacesInParens = FormatStyle::SIPO_Custom; SpaceBetweenBraces.SpacesInParensOptions.InEmptyParentheses = true; verifyFormat("vector< int > x{ };", SpaceBetweenBraces); + SpaceB

[clang] [clang-format] add an option to insert a space only for non-code block empty braces, not for empty parentheses (PR #93634)

2024-05-29 Thread Björn Schäpers via cfe-commits
@@ -4682,18 +4693,20 @@ struct FormatStyle { SpacesInParensCustom() HazardyKnusperkeks wrote: Maybe set the default of the webkit style, according to the webkit style guide? https://github.com/llvm/llvm-project/pull/93634 _

[clang] [clang-format] add an option to insert a space only for non-code block empty braces, not for empty parentheses (PR #93634)

2024-05-29 Thread Björn Schäpers via cfe-commits
@@ -14027,6 +14027,11 @@ TEST_F(FormatTest, LayoutCxx11BraceInitializers) { SpaceBetweenBraces.SpacesInParens = FormatStyle::SIPO_Custom; SpaceBetweenBraces.SpacesInParensOptions.InEmptyParentheses = true; verifyFormat("vector< int > x{ };", SpaceBetweenBraces); + SpaceB

[clang] [clang-format] Insert a space between a keyword and a literal (PR #93632)

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

[clang] [clang-format] add an option to insert a space only for non-code block empty braces, not for empty parentheses (PR #93634)

2024-05-30 Thread Björn Schäpers via cfe-commits
@@ -6237,18 +6237,30 @@ the configuration (without a prefix: ``Auto``). true: false: x = ( int32 )y vs. x = (int32)y - * ``bool InEmptyParentheses`` Put a space in parentheses only if the parentheses are empt

[clang] [clang-format] Allow open brace with trailing comment (no line break) (PR #89956)

2024-05-31 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > Ping Your PR is a draft, otherwise it would have been auto tagged and reviewers would be informed. https://github.com/llvm/llvm-project/pull/89956 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [clang-format] Allow open brace with trailing comment (no line break) (PR #89956)

2024-05-31 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks requested changes to this pull request. The comments are not aligned in your example, that does not seem to be the right option to hook on. https://github.com/llvm/llvm-project/pull/89956 ___ cfe-commits mailing l

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-06-01 Thread Björn Schäpers via cfe-commits
@@ -803,6 +803,60 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-06-01 Thread Björn Schäpers via cfe-commits
@@ -803,6 +803,60 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

[clang] [clang-format] Handle attributes before lambda return arrow (PR #94119)

2024-06-01 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. Do we want a token annotator test? https://github.com/llvm/llvm-project/pull/94119 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-03 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. Now that I see you want to incorporate it into QtCreator I'm even more in favor of adding it. ;) https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits

[clang] [clang-format] Annotate ampamp after new/delete as BinaryOperator (PR #89033)

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

[clang] [clang-format] Remove YAML hack to emit a BasedOnStyle comment (PR #89228)

2024-04-22 Thread Björn Schäpers via cfe-commits
@@ -807,12 +807,18 @@ template <> struct MappingTraits { FormatStyle PredefinedStyle; if (getPredefinedStyle(StyleName, Style.Language, &PredefinedStyle) && Style == PredefinedStyle) { - IO.mapOptional("# BasedOnStyle", StyleName); +

[clang] [clang-format] Remove YAML hack to emit a BasedOnStyle comment (PR #89228)

2024-04-22 Thread Björn Schäpers via cfe-commits
@@ -807,12 +807,18 @@ template <> struct MappingTraits { FormatStyle PredefinedStyle; if (getPredefinedStyle(StyleName, Style.Language, &PredefinedStyle) && Style == PredefinedStyle) { - IO.mapOptional("# BasedOnStyle", StyleName); -

[clang] [clang-format] Remove YAML hack to emit a BasedOnStyle comment (PR #89228)

2024-04-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks commented: The question is, is there any real benefit of putting the commented style in the output? https://github.com/llvm/llvm-project/pull/89228 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[clang] [clang-format] Remove YAML hack to emit a BasedOnStyle comment (PR #89228)

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

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-07-24 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: Fine by me, let's wait for @mydeveloperday . https://github.com/llvm/llvm-project/pull/96804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Handle parenthesized list in RemoveParentheses (PR #100852)

2024-07-28 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/100852 ___ 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-28 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks requested changes to this pull request. You are changing a lot of test cases, that means you will break a lot of formattings out there, especially since this is the default behavior of clang-format. And someone did intend it that way. If the change is desi

[clang] [clang-format] Use double hyphen for multiple-letter flags (PR #100978)

2024-07-29 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks requested changes to this pull request. You certainly can add the double hyphen flags, but you can't remove the single ones. https://github.com/llvm/llvm-project/pull/100978 ___ cfe-commits mailing list cfe-commit

[clang] [clang-format] Use double hyphen for multiple-letter flags (PR #100978)

2024-07-29 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: My bad, I thought you changed the options to those scripts. https://github.com/llvm/llvm-project/pull/100978 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Use double hyphen for multiple-letter flags (PR #100978)

2024-07-29 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: Okay, I can't revoke my vote and remove me as reviewer. As demonstrated I'm not qualified to review python changes. https://github.com/llvm/llvm-project/pull/100978 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[clang] [clang-format] Add BinPackBinaryOperations configuration (PR #95013)

2024-07-16 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > It seems that this patch implements the new option without regard to the > relative precedence of the binary operators: > > ``` > $ cat bar.cc > f1 = f2 * f3 + > f4 / f5 - f6; >

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

2024-07-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks 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] Add BreakBinaryOperations configuration (PR #95013)

2024-07-19 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: Fine by me. The build states: Failed Tests (1): Clang-Unit :: Format/./FormatTests/ConfigParseTest/ParsesConfiguration Is this from this change? https://github.com/llvm/llvm-project/pull/95013 ___ cfe-commits mailing list cf

[clang] [clang-format] Fix a bug in annotating FunctionAnnotationRParen (PR #99802)

2024-07-21 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/99802 ___ 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 StartOfName (PR #99791)

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

[clang] [clang-format] Correctly annotate list init braces of class types (PR #89706)

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

[clang] [clang-format] Remove YAML hack to emit a BasedOnStyle comment (PR #89228)

2024-04-23 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. I don't see a use case for that comment, and thus I see no problem in removing it. https://github.com/llvm/llvm-project/pull/89228 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[clang] [clang-format] Annotate enum braces as BK_Block (PR #89871)

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

[clang] [clang-format] Add a space after a word token only if required (PR #90161)

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

[clang] [clang-format][NFC] Return early in isWordLike() for non-Verilog (PR #90363)

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

[clang] [clang-format] Set Change.TokenLength to ColumnWidth (PR #90378)

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

[clang] [clang-format] Fix misalignments of pointers in angle brackets (PR #106013)

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

[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)

2024-08-27 Thread Björn Schäpers via cfe-commits
@@ -5057,6 +5057,21 @@ struct FormatStyle { /// \version 11 std::vector WhitespaceSensitiveMacros; + /// Insert a newline at the begging and at the end of namespace definition HazardyKnusperkeks wrote: ```suggestion /// Insert a newline at the begging

[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)

2024-08-27 Thread Björn Schäpers via cfe-commits
@@ -32,6 +32,24 @@ bool isRecordLBrace(const FormatToken &Tok) { TT_StructLBrace, TT_UnionLBrace); } +bool LineStartsNamespaceScope(const AnnotatedLine* Line, + const AnnotatedLine* PreviousLine, +

[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)

2024-08-27 Thread Björn Schäpers via cfe-commits
@@ -5057,6 +5057,21 @@ struct FormatStyle { /// \version 11 std::vector WhitespaceSensitiveMacros; + /// Insert a newline at the begging and at the end of namespace definition + /// \code + /// false: vs. true: + /// + /// namespace

[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)

2024-08-27 Thread Björn Schäpers via cfe-commits
@@ -1493,6 +1511,18 @@ static auto computeNewlines(const AnnotatedLine &Line, Newlines = 1; } + // Insert empty line after "{" that opens namespace scope HazardyKnusperkeks wrote: ```suggestion // Insert empty line after "{" that opens namespace scop

[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)

2024-08-27 Thread Björn Schäpers via cfe-commits
@@ -1493,6 +1511,18 @@ static auto computeNewlines(const AnnotatedLine &Line, Newlines = 1; } + // Insert empty line after "{" that opens namespace scope + if (Style.WrapNamespaceBodyWithNewlines && + LineStartsNamespaceScope(&Line, PreviousLine, PrevPrevLine)) {

[clang] [clang-format] Insert a space between new/delete and a C-style cast (PR #106175)

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

[clang] [clang-format] Revert "[clang-format][NFC] Delete TT_LambdaArrow (#70… (PR #105923)

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

[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)

2024-08-28 Thread Björn Schäpers via cfe-commits
@@ -5057,6 +5057,21 @@ struct FormatStyle { /// \version 11 std::vector WhitespaceSensitiveMacros; + /// Insert a newline at the begging and at the end of namespace definition + /// \code + /// false: vs. true: + /// + /// namespace

[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)

2024-08-28 Thread Björn Schäpers via cfe-commits
@@ -1493,6 +1511,18 @@ static auto computeNewlines(const AnnotatedLine &Line, Newlines = 1; } + // Insert empty line after "{" that opens namespace scope + if (Style.WrapNamespaceBodyWithNewlines && + LineStartsNamespaceScope(&Line, PreviousLine, PrevPrevLine)) {

[clang] [clang-format] Correctly annotate braces in ObjC square brackets (PR #106654)

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

[clang] [clang-format] Correctly annotate braces in macro definition (PR #106662)

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

[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)

2024-09-02 Thread Björn Schäpers via cfe-commits
@@ -28104,6 +28104,211 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

[clang] [clang-format] Fix a regression in annotating ObjCBlockLParen (PR #107021)

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

[clang] [clang-format] Handle spaces in file paths in git-clang-format.bat (PR #107041)

2024-09-03 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/107041 ___ 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 SpaceBeforeParensOptions (PR #98849)

2024-07-15 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/98849 ___ 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 struct braces (PR #90555)

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

[clang] [clang-format] Add option to remove leading blank lines (PR #91221)

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

[clang] [clang-format] Fix FormatToken::isSimpleTypeSpecifier() (PR #91712)

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

[clang] [clang-format][NFC] Move LeftRightQualifierAlignmentFixer::is...() (PR #91930)

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

[clang] [clang-format] Don't always break before << between string literals (PR #92214)

2024-05-15 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. I think this is a reasonable compromise. https://github.com/llvm/llvm-project/pull/92214 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[clang] [clang-format] Fix a regression in annotating struct braces (PR #92352)

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

[clang] [clang-format] Add SpacesInParensOption for filtering repeated parens (PR #77522)

2024-05-21 Thread Björn Schäpers via cfe-commits
@@ -4644,22 +4644,36 @@ struct FormatStyle { /// # Should be declared this way: /// SpacesInParens: Custom /// SpacesInParensOptions: + /// ExceptDoubleParentheses: false /// InConditionalStatements: true /// Other: true /// \endcode struct

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

2024-05-21 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks 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] Add space after a word token (PR #92741)

2024-05-21 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > > Since I am by no means an expert on Clang, a few questions arose > > > > * As Clang formats the code correctly (no code changes necessary) when > > instead of `xor` a different function name e.g. `xooor` is used, I wonder > > why `xor` is tokenized as Unary operat

[clang] [ClangFormat] Add DiagHandler for getStyle function (PR #91317)

2024-05-21 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: For the record, I see no harm in this PR and would also merge it without an issue. Just giving @mydeveloperday a bit more time to answer. :) https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-com

[clang] [clang-format] Correctly annotate C++ alternative operators in C (PR #92880)

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

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-05-27 Thread Björn Schäpers via cfe-commits
@@ -6157,6 +6157,12 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, return !(Previous && (Previous->is(tok::kw_for) || Previous->isIf())); } + if (Left.isOneOf(tok::r_paren, TT_TrailingAnnotation) && HazardyKnusperkeks wrote: Is this

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-05-27 Thread Björn Schäpers via cfe-commits
@@ -803,6 +803,46 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-05-27 Thread Björn Schäpers via cfe-commits
@@ -803,6 +803,46 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

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

2024-05-27 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks 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] Add LeftWithLastLine to AlignEscapedNewlines option (PR #93402)

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

[clang] [clang-format] Add PackParameters enum option to replace BinPackParameters. (PR #101882)

2024-08-04 Thread Björn Schäpers via cfe-commits
@@ -1918,11 +1901,12 @@ void ContinuationIndenter::moveStatePastScopeOpener(LineState &State, // for backwards compatibility. bool ObjCBinPackProtocolList = (Style.ObjCBinPackProtocolList == FormatStyle::BPS_Auto && - Style.BinPackParameters) || +

[clang] [clang-format] Add PackParameters enum option to replace BinPackParameters. (PR #101882)

2024-08-04 Thread Björn Schäpers via cfe-commits
@@ -1918,11 +1901,12 @@ void ContinuationIndenter::moveStatePastScopeOpener(LineState &State, // for backwards compatibility. bool ObjCBinPackProtocolList = (Style.ObjCBinPackProtocolList == FormatStyle::BPS_Auto && - Style.BinPackParameters) || +

[clang] [clang-format] Add PackParameters enum option to replace BinPackParameters. (PR #101882)

2024-08-04 Thread Björn Schäpers via cfe-commits
@@ -1174,6 +1192,18 @@ template <> struct MappingTraits { Style.PackConstructorInitializers = FormatStyle::PCIS_CurrentLine; } +// If BinPackParameters was specified but PackParameters was not, initialize +// the latter from the former for backwards compat

[clang] [clang-format] Add PackParameters enum option to replace BinPackParameters. (PR #101882)

2024-08-04 Thread Björn Schäpers via cfe-commits
@@ -5458,6 +5458,14 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, return true; } + // Ignores the first parameter as this will be handled separately by + // BreakFunctionDefinitionParameters or AlignAfterOpenBracket. + if ((FormatStyle::PPS_Break

[clang] [clang-format] Add PackParameters enum option to replace BinPackParameters. (PR #101882)

2024-08-04 Thread Björn Schäpers via cfe-commits
@@ -456,6 +455,21 @@ TEST(ConfigParseTest, ParsesConfiguration) { "AllowAllConstructorInitializersOnNextLine: false", PackConstructorInitializers, FormatStyle::PCIS_CurrentLine); + Style.PackParameters = FormatStyle::PPS_BinPack; + CHECK_PARSE("Pa

[clang] [clang-format] Add PackParameters enum option to replace BinPackParameters. (PR #101882)

2024-08-04 Thread Björn Schäpers via cfe-commits
@@ -1174,6 +1192,18 @@ template <> struct MappingTraits { Style.PackConstructorInitializers = FormatStyle::PCIS_CurrentLine; } +// If BinPackParameters was specified but PackParameters was not, initialize +// the latter from the former for backwards compat

[clang] [clang-format] Add PackParameters enum option to replace BinPackParameters. (PR #101882)

2024-08-04 Thread Björn Schäpers via cfe-commits
@@ -411,7 +393,8 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { // sets BreakBeforeParameter to avoid bin packing and this creates a // completely unnecessary line break after a template type that isn't // line-wrapped. -(Prev

[clang] [clang-format] Adjust requires clause wrapping (#101550) (PR #102078)

2024-08-06 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: I see where you are coming from, and am annoyed by trailing requires clauses in my code as well, because it wraps the brace. Nevertheless I made this on purpose, `OwnLine` says the clause has its own line(s), the brace does not belong there. What I refrained from, whe

[clang] [clang-format] Adjust requires clause wrapping (#101550) (PR #102078)

2024-08-06 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks requested changes to this pull request. Github says I have to comment something... https://github.com/llvm/llvm-project/pull/102078 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang] [clang-format] Fix a bug in annotating CastRParen (PR #102261)

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

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

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

[clang] be9a7fd - [clang-format] Fixed handling of requires clauses followed by attributes

2022-02-20 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2022-02-20T22:33:26+01:00 New Revision: be9a7fdd6a8aec669bcb1f6a68087ab4a70ddb2e URL: https://github.com/llvm/llvm-project/commit/be9a7fdd6a8aec669bcb1f6a68087ab4a70ddb2e DIFF: https://github.com/llvm/llvm-project/commit/be9a7fdd6a8aec669bcb1f6a68087ab4a70ddb2e.diff

[clang] 9b13992 - [clang-format][NFC] Return early in ContinuationIndenter::mustBreak

2022-02-20 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2022-02-20T22:33:27+01:00 New Revision: 9b139923bc6634c2d1667c54000debe00e7858f4 URL: https://github.com/llvm/llvm-project/commit/9b139923bc6634c2d1667c54000debe00e7858f4 DIFF: https://github.com/llvm/llvm-project/commit/9b139923bc6634c2d1667c54000debe00e7858f4.diff

[clang] 8f310d1 - [clang-format][docs] Fix incorrect 'clang-format 13' configuration ...

2022-02-20 Thread Björn Schäpers via cfe-commits
Author: Krystian Kuzniarek Date: 2022-02-20T22:33:27+01:00 New Revision: 8f310d1967c20d348c617af3a30999031c71fee0 URL: https://github.com/llvm/llvm-project/commit/8f310d1967c20d348c617af3a30999031c71fee0 DIFF: https://github.com/llvm/llvm-project/commit/8f310d1967c20d348c617af3a30999031c71fee0.

[clang] 7ebb00a - [clang-format][NFC] Simplify if in ContinuationIndenter::addTokenOCL

2022-02-22 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2022-02-22T22:08:02+01:00 New Revision: 7ebb00a22e7ec78a3090ecc15f59d247e0f390db URL: https://github.com/llvm/llvm-project/commit/7ebb00a22e7ec78a3090ecc15f59d247e0f390db DIFF: https://github.com/llvm/llvm-project/commit/7ebb00a22e7ec78a3090ecc15f59d247e0f390db.diff

[clang] 923c375 - [clang-format] Don't break semi after requires clause ...

2022-02-22 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2022-02-22T22:08:03+01:00 New Revision: 923c3755ea809275d6c06caf547525452568eb5f URL: https://github.com/llvm/llvm-project/commit/923c3755ea809275d6c06caf547525452568eb5f DIFF: https://github.com/llvm/llvm-project/commit/923c3755ea809275d6c06caf547525452568eb5f.diff

[clang] 1d03548 - [clang-format][NFC] Remove redundant semi

2022-02-26 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2022-02-26T21:22:36+01:00 New Revision: 1d03548f63add672b4adf03360e396eba852bce5 URL: https://github.com/llvm/llvm-project/commit/1d03548f63add672b4adf03360e396eba852bce5 DIFF: https://github.com/llvm/llvm-project/commit/1d03548f63add672b4adf03360e396eba852bce5.diff

[clang] a74ff3a - [clang-format][NFC] Rename test and remove comments

2022-02-26 Thread Björn Schäpers via cfe-commits
Author: Björn Schäpers Date: 2022-02-26T21:22:37+01:00 New Revision: a74ff3ac2edcb631ef78d41c12da7c2641ff2e15 URL: https://github.com/llvm/llvm-project/commit/a74ff3ac2edcb631ef78d41c12da7c2641ff2e15 DIFF: https://github.com/llvm/llvm-project/commit/a74ff3ac2edcb631ef78d41c12da7c2641ff2e15.diff

<    2   3   4   5   6   7   8   9   >