[clang] 961fd77 - [clang-format][docs] Fix incorrect 'clang-format 4' option markers

2022-09-05 Thread Björn Schäpers via cfe-commits
Author: Krystian Kuzniarek Date: 2022-09-05T09:38:22+02:00 New Revision: 961fd77687d27089acf0a09ea29a87fb8ccd7522 URL: https://github.com/llvm/llvm-project/commit/961fd77687d27089acf0a09ea29a87fb8ccd7522 DIFF: https://github.com/llvm/llvm-project/commit/961fd77687d27089acf0a09ea29a87fb8ccd7522.

[clang] c6e7752 - [clang-format] Allow `throw` to be a keyword in front of casts

2022-09-05 Thread Björn Schäpers via cfe-commits
Author: Emilia Dreamer Date: 2022-09-05T12:35:39+02:00 New Revision: c6e7752f8e144ad78aee2e56a7c901c56be360de URL: https://github.com/llvm/llvm-project/commit/c6e7752f8e144ad78aee2e56a7c901c56be360de DIFF: https://github.com/llvm/llvm-project/commit/c6e7752f8e144ad78aee2e56a7c901c56be360de.diff

[clang] f54d42a - [clang-format] Don't put `noexcept` on empty line following constructor

2022-09-05 Thread Björn Schäpers via cfe-commits
Author: Emilia Dreamer Date: 2022-09-05T12:35:39+02:00 New Revision: f54d42abcf82e122ed0ac4688f01c1f4da5599f2 URL: https://github.com/llvm/llvm-project/commit/f54d42abcf82e122ed0ac4688f01c1f4da5599f2 DIFF: https://github.com/llvm/llvm-project/commit/f54d42abcf82e122ed0ac4688f01c1f4da5599f2.diff

[clang] bd3dd10 - [clang-format] Concepts: allow identifiers after negation

2022-09-05 Thread Björn Schäpers via cfe-commits
Author: Emilia Dreamer Date: 2022-09-05T12:35:40+02:00 New Revision: bd3dd10a8b489ce50823b4cc0049f16610adeee2 URL: https://github.com/llvm/llvm-project/commit/bd3dd10a8b489ce50823b4cc0049f16610adeee2 DIFF: https://github.com/llvm/llvm-project/commit/bd3dd10a8b489ce50823b4cc0049f16610adeee2.diff

[clang] 2adf241 - [clang-format] [doc] Fix example of wrapping class definitions

2022-09-06 Thread Björn Schäpers via cfe-commits
Author: Passw Date: 2022-09-06T12:24:18+02:00 New Revision: 2adf241592b38189994c6c9d2dfbfa391ecbe9fa URL: https://github.com/llvm/llvm-project/commit/2adf241592b38189994c6c9d2dfbfa391ecbe9fa DIFF: https://github.com/llvm/llvm-project/commit/2adf241592b38189994c6c9d2dfbfa391ecbe9fa.diff LOG: [c

[clang] 2476135 - [clang-format] Change heuristic for locating lambda template arguments

2022-09-06 Thread Björn Schäpers via cfe-commits
Author: Emilia Dreamer Date: 2022-09-06T12:24:19+02:00 New Revision: 247613548bac55b47eed88e83d5c8640fd4b200a URL: https://github.com/llvm/llvm-project/commit/247613548bac55b47eed88e83d5c8640fd4b200a DIFF: https://github.com/llvm/llvm-project/commit/247613548bac55b47eed88e83d5c8640fd4b200a.diff

[clang] [clang-format] Add spaces around the Verilog implication operator (PR #71352)

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

[clang] [clang-format] Add spaces around the Verilog implication operator (PR #71352)

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

[clang] [clang-format] Add spaces around the Verilog implication operator (PR #71352)

2023-11-07 Thread Björn Schäpers via cfe-commits
@@ -1980,17 +1980,18 @@ TEST_F(TokenAnnotatorTest, UnderstandsVerilogOperators) { // joined operators, we don't have a separate type, so we only test for their // precedence. std::pair JoinedBinary[] = { - {prec::Comma, "<->"}, {prec::Assignment, "+="}, -

[clang] [clang-format] Indent Verilog case statements with comments (PR #71353)

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

[clang] [clang-format] Add space in Verilog tagged unions (PR #71354)

2023-11-07 Thread Björn Schäpers via cfe-commits
@@ -4694,8 +4694,15 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, Left.isOneOf(TT_VerilogDimensionedTypeName, Keywords.kw_function)) { return true; } +// In a tagged union expression, there should be a space after the tag. +if

[clang] [clang-format] Add space in Verilog tagged unions (PR #71354)

2023-11-07 Thread Björn Schäpers via cfe-commits
@@ -4694,8 +4694,15 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, Left.isOneOf(TT_VerilogDimensionedTypeName, Keywords.kw_function)) { return true; } +// In a tagged union expression, there should be a space after the tag. +if

[clang] [clang-format] Remove special handling of comments after brace/paren (PR #71672)

2023-11-08 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks created https://github.com/llvm/llvm-project/pull/71672 Fixes http://llvm.org/PR55487 The code did not match the documentation about Cpp11BracedListStyle. Changed handling of comments after opening braces, which are supposedly function call like to behave

[clang] [clang-format] Handle variable declarations in BreakAfterAttributes (PR #71755)

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

[clang] [clang-format] Remove special handling of comments after brace/paren (PR #71672)

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

[clang] [clang-format] Remove special handling of comments after brace/paren (PR #71672)

2023-11-10 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks updated https://github.com/llvm/llvm-project/pull/71672 From aeec6f1e767bc2bb11823cb694bf6ccc267b060d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Wed, 8 Nov 2023 13:31:32 +0100 Subject: [PATCH] [clang-format] Remove special h

[clang] [clang-format] Remove special handling of comments after brace/paren (PR #71672)

2023-11-10 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: Updated implementation and tests for `Cpp1BracedListSyle` set to `false`. https://github.com/llvm/llvm-project/pull/71672 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

[clang] [clang-tools-extra] [llvm] [clang-format] Handle variable declarations in BreakAfterAttributes (PR #71935)

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

[clang] [clang-format] Handle control statements in BreakAfterAttributes (PR #71995)

2023-11-11 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/71995 ___ 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-11-12 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: Can you also add some nested `#if` and

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

2023-11-12 Thread Björn Schäpers via cfe-commits
@@ -24153,6 +24153,53 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + + ve

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

2023-11-12 Thread Björn Schäpers via cfe-commits
@@ -1134,6 +1134,14 @@ void UnwrappedLineParser::parsePPDefine() { return; } + if (Style.IgnorePPDefinitions) { +do { + nextToken(); +} while (!eof()); HazardyKnusperkeks wrote: I assume you have tested this on real code. Can you explain w

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

2023-11-12 Thread Björn Schäpers via cfe-commits
@@ -24153,6 +24153,53 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + + ve

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

2023-11-12 Thread Björn Schäpers via cfe-commits
@@ -4719,6 +4723,7 @@ struct FormatStyle { R.IncludeStyle.IncludeIsMainRegex && IncludeStyle.IncludeIsMainSourceRegex == R.IncludeStyle.IncludeIsMainSourceRegex && + IgnorePPDefinitions == R.IgnorePPDefinitions && -

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

2023-11-12 Thread Björn Schäpers via cfe-commits
@@ -1355,6 +1355,8 @@ unsigned UnwrappedLineFormatter::format( bool FixIndentation = (FixBadIndentation || ContinueFormatting) && Indent != TheLine.First->OriginalColumn; bool ShouldFormat = TheLine.Affected || FixIndentation; +if (Style.Ig

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

2023-11-12 Thread Björn Schäpers via cfe-commits
@@ -4648,6 +4648,10 @@ struct FormatStyle { /// \version 11 std::vector WhitespaceSensitiveMacros; + /// Ignore formatting in preprocessor definitions. HazardyKnusperkeks wrote: Run `clang/docs/tools/dump_format_style.py`. https://github.com/llvm/llvm-p

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

2023-11-12 Thread Björn Schäpers via cfe-commits
@@ -24153,6 +24153,53 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + + ve

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

2023-11-12 Thread Björn Schäpers via cfe-commits
@@ -24153,6 +24153,53 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + + ve

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

2023-11-12 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) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + + ve

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

2023-11-12 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) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + + ve

[clang] [clang-format][NFC] Simplify parseBracedList() (PR #72010)

2023-11-12 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/72010 ___ 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 aligning comments in vector of structs (PR #72099)

2023-11-13 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/72099 ___ 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 `git-clang-format --binary` (PR #74293)

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

[clang] [clang-format][NFC] Refactor getting first/last non-comment of line (PR #74570)

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

[clang] [clang-format] Handle merging functions containing only a block comment (PR #74651)

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

[clang] [clang-format] Handle merging functions containing only a block comment (PR #74651)

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

[clang] [clang-format] Handle merging functions containing only a block comment (PR #74651)

2023-12-06 Thread Björn Schäpers via cfe-commits
@@ -411,9 +411,16 @@ class LineJoiner { } } +const auto *LastNonComment = TheLine->getLastNonComment(); +assert(LastNonComment); +// FIXME: There are probably cases where we should use LastNonComment HazardyKnusperkeks wrote: Is this a l

[clang] [clang-format][NFC] Clean up the driver and getStyle() in Format.cpp (PR #74794)

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

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

2023-12-09 Thread Björn Schäpers via cfe-commits
@@ -26417,6 +26417,20 @@ TEST_F(FormatTest, BreakAfterAttributes) { "void g() {}", CtorDtorCode, Style); + Style.ReferenceAlignment = FormatStyle::ReferenceAlignmentStyle::RAS_Left; HazardyKnusperkeks wrote: You are changing the

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

2023-12-09 Thread Björn Schäpers via cfe-commits
@@ -593,7 +593,8 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { // name. !Style.isJavaScript()) || (Current.is(tok::kw_operator) && Previous.isNot(tok::coloncolon))) && - Previous.isNot(tok::kw_template) && CurrentState.BreakBefor

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

2023-12-09 Thread Björn Schäpers via cfe-commits
@@ -26417,6 +26417,20 @@ TEST_F(FormatTest, BreakAfterAttributes) { "void g() {}", CtorDtorCode, Style); + Style.ReferenceAlignment = FormatStyle::ReferenceAlignmentStyle::RAS_Left; + constexpr StringRef OperatorOverloadCode( Ha

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

2023-12-09 Thread Björn Schäpers via cfe-commits
@@ -593,7 +593,8 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { // name. !Style.isJavaScript()) || (Current.is(tok::kw_operator) && Previous.isNot(tok::coloncolon))) && - Previous.isNot(tok::kw_template) && CurrentState.BreakBefor

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

2023-12-10 Thread Björn Schäpers via cfe-commits
@@ -583,20 +583,31 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { return true; } - // If the return type spans multiple lines, wrap before the function name. - if (((Current.is(TT_FunctionDeclarationName) && -!State.Line->ReturnTypeWrapped

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

2023-12-10 Thread Björn Schäpers via cfe-commits
@@ -26465,6 +26451,21 @@ TEST_F(FormatTest, BreakAfterAttributes) { "{\n" "}", CtorDtorCode, Style); + + Style.BreakBeforeBraces = FormatStyle::BS_Attach; + Style.ReferenceAlignment = FormatStyle::ReferenceAlignmentStyle::RAS_Left;

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

2023-12-10 Thread Björn Schäpers via cfe-commits
@@ -583,20 +583,31 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { return true; } - // If the return type spans multiple lines, wrap before the function name. - if (((Current.is(TT_FunctionDeclarationName) && -!State.Line->ReturnTypeWrapped

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

2023-12-10 Thread Björn Schäpers via cfe-commits
@@ -583,21 +583,31 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { return true; } - // If the return type spans multiple lines, wrap before the function name. - if (((Current.is(TT_FunctionDeclarationName) && -!State.Line->ReturnTypeWrapped

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

2023-12-11 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: I got a mail, but it seems you have deleted the comment? Is it a regression? Could you bisect it? And you don't need (for me) to comment, when you addressed a comment, just click on resolved. Would reduce the amount of mails in my inbox. ;) https://github.com/llvm/ll

[clang] [clang-format] Handle constrained auto in QualifierAlignment (PR #72251)

2023-11-14 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/72251 ___ 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-11-14 Thread Björn Schäpers via cfe-commits
@@ -1355,8 +1355,11 @@ unsigned UnwrappedLineFormatter::format( bool FixIndentation = (FixBadIndentation || ContinueFormatting) && Indent != TheLine.First->OriginalColumn; bool ShouldFormat = TheLine.Affected || FixIndentation; -if (Style.I

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

2023-11-14 Thread Björn Schäpers via cfe-commits
@@ -24206,10 +24206,11 @@ TEST_F(FormatTest, IgnorePPDefinitions) { Style.IndentPPDirectives = FormatStyle::PPDIS_None; verifyNoChange("#if A\n" "#define A a\n" - "#endif", + "#endif\n", HazardyKnusperkeks w

[clang] [clang-format] Skip alignArrayInitializers() for 1-row matrices (PR #72166)

2023-11-14 Thread Björn Schäpers via cfe-commits
@@ -20875,13 +20875,15 @@ TEST_F(FormatTest, CatchAlignArrayOfStructuresRightAlignment) { "};", Style); // TODO: Fix the indentations below when this option is fully functional. +#if 0 HazardyKnusperkeks wrote: Why did you remo

[clang] [clang-format] Fix more bugs in isStartOfName() (PR #72336)

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

[clang] [clang-format] Handle lambdas in QualifierAlignment (PR #72456)

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

[clang] [clang-format] Fix crashes in AlignArrayOfStructures (PR #72520)

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

[clang] [clang-format] Fix crashes in AlignArrayOfStructures (PR #72520)

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

[clang] [clang-format] Fix crashes in AlignArrayOfStructures (PR #72520)

2023-11-16 Thread Björn Schäpers via cfe-commits
@@ -1316,6 +1316,8 @@ void WhitespaceManager::alignArrayInitializersRightJustified( auto Offset = std::distance(Cells.begin(), CellIter); for (const auto *Next = CellIter->NextColumnElement; Next; Next = Next->NextColumnElement) { + if (Ro

[clang] [clang-format] Fix crashes in AlignArrayOfStructures (PR #72520)

2023-11-17 Thread Björn Schäpers via cfe-commits
@@ -1316,6 +1316,8 @@ void WhitespaceManager::alignArrayInitializersRightJustified( auto Offset = std::distance(Cells.begin(), CellIter); for (const auto *Next = CellIter->NextColumnElement; Next; Next = Next->NextColumnElement) { + if (Ro

[clang] [clang-format] Correctly annotate braces of empty functions (PR #72733)

2023-11-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/72733 ___ 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 isStartOfName() on macro definitions (PR #72768)

2023-11-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/72768 ___ 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 aligning comments above PPDirective (PR #72791)

2023-11-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/72791 ___ 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 macro definitions (PR #70338)

2023-11-19 Thread Björn Schäpers via cfe-commits
@@ -1355,6 +1362,10 @@ unsigned UnwrappedLineFormatter::format( bool FixIndentation = (FixBadIndentation || ContinueFormatting) && Indent != TheLine.First->OriginalColumn; bool ShouldFormat = TheLine.Affected || FixIndentation; + +if (Style

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-19 Thread Björn Schäpers via cfe-commits
@@ -24153,6 +24153,113 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + + v

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-19 Thread Björn Schäpers via cfe-commits
@@ -1308,6 +1308,13 @@ class OptimizingLineFormatter : public LineFormatter { } // anonymous namespace +static bool lineContainsPPDefinition(const AnnotatedLine &Line) { HazardyKnusperkeks wrote: ```suggestion static bool LineContainsPPDefinition(const Annot

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Björn Schäpers via cfe-commits
@@ -1355,6 +1362,10 @@ unsigned UnwrappedLineFormatter::format( bool FixIndentation = (FixBadIndentation || ContinueFormatting) && Indent != TheLine.First->OriginalColumn; bool ShouldFormat = TheLine.Affected || FixIndentation; + +if (Style

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. LGTM, but wait for either of @owenca or @mydeveloperday . https://github.com/llvm/llvm-project/pull/70338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] [clang-format][NFC] Delete TT_LambdaArrow (PR #70519)

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

[clang] [clang-format][NFC] Reduce indent (PR #70583)

2023-10-28 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks created https://github.com/llvm/llvm-project/pull/70583 By using if init statement. From b1af9c060cc5dca1f3bbc551d6a77e73451ffa06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Sun, 29 Oct 2023 07:18:06 +0100 Subject: [PATCH] [

[clang] [clang-format][NFC] Reduce indent (PR #70583)

2023-10-28 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks updated https://github.com/llvm/llvm-project/pull/70583 From ad595c32b08bb4d9ddbe2361da86491dbe3c09e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Sun, 29 Oct 2023 07:18:06 +0100 Subject: [PATCH] [clang-format][NFC] Reduce ind

[clang] [clang-format][NFC] Reduce indent (PR #70583)

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

[clang] [clang-format] Fix annotating annotations after requires clause (PR #70602)

2023-10-29 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks created https://github.com/llvm/llvm-project/pull/70602 Fixes #69325. From 9d3169cbd756f6c3ba9ac2a7e334677c330da3d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Sun, 29 Oct 2023 20:55:31 +0100 Subject: [PATCH] [clang-format]

[clang] [clang-format] Fix annotating annotations after requires clause (PR #70602)

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

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

2023-10-31 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks commented: The code is okay, but I do not share the intention. https://github.com/llvm/llvm-project/pull/70768 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

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

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

2023-10-31 Thread Björn Schäpers via cfe-commits
@@ -3117,9 +3117,16 @@ void UnwrappedLineParser::parseForOrWhileLoop(bool HasParens) { FormatTok->setFinalizedType(TT_ConditionLParen); parseParens(); } - // Event control. - if (Style.isVerilog()) + + if (Style.isVerilog()) { +// Event control. parseVe

[clang] Add ability for clang-format-diff to exit with non-0 status (PR #70883)

2023-11-01 Thread Björn Schäpers via cfe-commits
@@ -185,6 +191,8 @@ def main(): diff_string = "".join(diff) if len(diff_string) > 0: sys.stdout.write(diff_string) +if args.non_zero_exit_code: +sys.exit(1) HazardyKnusperkeks wrote: B

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

2023-11-01 Thread Björn Schäpers via cfe-commits
@@ -3117,9 +3117,16 @@ void UnwrappedLineParser::parseForOrWhileLoop(bool HasParens) { FormatTok->setFinalizedType(TT_ConditionLParen); parseParens(); } - // Event control. - if (Style.isVerilog()) + + if (Style.isVerilog()) { +// Event control. parseVe

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

2023-11-01 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/70768 ___ 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 git-clang-format.bat (PR #75268)

2023-12-13 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/75268 ___ 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 `IndentExternBlock: NoIndent` (PR #75731)

2023-12-17 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/75731 ___ 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 formating `#define A x:` (PR #73220)

2023-11-23 Thread Björn Schäpers via cfe-commits
@@ -1171,6 +1171,13 @@ void UnwrappedLineParser::parsePPDefine() { assert((int)Line->PPLevel >= 0); Line->InMacroBody = true; + if (FormatTok->is(tok::identifier) && + Tokens->peekNextToken()->is(tok::colon)) { +nextToken(); +nextToken(); +addUnwrappedLin

[clang] [clang-format] Fix a bug in formating `#define A x:` (PR #73220)

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

[clang] [clang-format] Add BreakConcatenatedStrings option (PR #73432)

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

[clang] [clang-format] Add BreakConcatenatedStrings option (PR #73432)

2023-11-26 Thread Björn Schäpers via cfe-commits
@@ -2088,6 +2088,19 @@ struct FormatStyle { /// \version 3.7 bool BreakBeforeTernaryOperators; + /// Break between concatenated string literals in C, C++, and Objective-C. HazardyKnusperkeks wrote: Why limited to that languages? https://github.com/llvm/

[clang] [clang-format] Add BreakConcatenatedStrings option (PR #73432)

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

[clang] [clang-format] Add BreakAdjacentStringLiterals option (PR #73432)

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

[clang] [clang-format][NFC] Extend isProto() to also cover LK_TextProto (PR #73582)

2023-11-28 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks commented: I can not say if TextProto should be handled equally to Proto. https://github.com/llvm/llvm-project/pull/73582 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailm

[clang] [clang-format] Add space in Verilog tagged unions (PR #71354)

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

[clang] [clang-format] Finalize children after formatting them (PR #73753)

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

[clang] [clang-format][NFC] Extend isProto() to also cover LK_TextProto (PR #73582)

2023-11-29 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. I must've read some of the diff backwards. I thought you replaced `Language == LK_Proto` with `isProto()`. https://github.com/llvm/llvm-project/pull/73582 ___ cfe-commits mailing list c

[clang] [clang-format] Don't skip stringizing when determining brace kind (PR #73886)

2023-11-30 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/73886 ___ 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 `git-clang-format --binary` (PR #74176)

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

[clang] [clang-format] Add an fnmatch-like function for .clang-format-ignore (PR #76021)

2023-12-22 Thread Björn Schäpers via cfe-commits
@@ -0,0 +1,169 @@ +//===- unittest/Format/MatchFilePathTest.cpp --===// +// +// 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: Ap

[clang] [clang-format] Fix a bug in annotating function declaration names (PR #76206)

2023-12-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/76206 ___ 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 function declaration names (PR #76206)

2023-12-22 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > Thanks for doing this. Does it mean we would have to add every type we use to > our config? It would be much more convenient if clang-format treated the > argument list the same way that it treats in definitions. For example > > ```shell > printf "int\niso_time(time

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

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

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-22 Thread Björn Schäpers via cfe-commits
@@ -4656,6 +4687,15 @@ struct FormatStyle { /// \version 8 std::vector StatementMacros; + /// Tablegen HazardyKnusperkeks wrote: We need a bit more documentation here. https://github.com/llvm/llvm-project/pull/76059 _

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks requested changes to this pull request. I think we all would gain a lot, if you could split this into multiple pull requests. The discussion can be more focused and you have a greater chance to get something merged. Similar to the Verilog changes. https://

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-22 Thread Björn Schäpers via cfe-commits
@@ -4656,6 +4687,15 @@ struct FormatStyle { /// \version 8 std::vector StatementMacros; + /// Tablegen + bool TableGenAllowBreakBeforeInheritColon; + bool TableGenAllowBreakAfterInheritColon; HazardyKnusperkeks wrote: Do you need both options to be ena

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-22 Thread Björn Schäpers via cfe-commits
@@ -396,6 +396,36 @@ struct FormatStyle { /// \version 17 ShortCaseStatementsAlignmentStyle AlignConsecutiveShortCaseStatements; + /// Style of aligning consecutive TableGen cond operator colons. + /// \code + /// !cond(!eq(size, 1) : 1, + /// !eq(size, 16):

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-22 Thread Björn Schäpers via cfe-commits
@@ -396,6 +396,36 @@ struct FormatStyle { /// \version 17 ShortCaseStatementsAlignmentStyle AlignConsecutiveShortCaseStatements; + /// Style of aligning consecutive TableGen cond operator colons. + /// \code + /// !cond(!eq(size, 1) : 1, + /// !eq(size, 16):

  1   2   3   4   5   6   7   8   9   >