[clang] [clang-format][NFC] Make formatting Verilog faster (PR #121139)

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

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

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

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2024-12-25 Thread Björn Schäpers via cfe-commits
@@ -11077,6 +11077,221 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateClose) { HazardyKnusperkeks wrote: Sorry missed that, didn't look for the lambda case. https://github.com/llvm/llvm-

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2024-12-25 Thread Björn Schäpers via cfe-commits
@@ -11077,6 +11077,281 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateClose) { + FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp); + Style.ColumnLimit = 0; + verifyNoChange("template \n" +

[clang] [Clang] Repair the function "rParenEndsCast" to make incorrect judgments in template variable cases (PR #120904)

2024-12-24 Thread Björn Schäpers via cfe-commits
@@ -2831,8 +2842,21 @@ class AnnotatingParser { IsQualifiedPointerOrReference(BeforeRParen, LangOpts); bool ParensCouldEndDecl = AfterRParen->isOneOf(tok::equal, tok::semi, tok::l_brace, tok::greater); -if (ParensAreType && !ParensCouldEndDecl) +if

[clang] [Clang] Repair the function "rParenEndsCast" to make incorrect judgments in template variable cases (PR #120904)

2024-12-24 Thread Björn Schäpers via cfe-commits
@@ -38,6 +40,10 @@ static bool mustBreakAfterAttributes(const FormatToken &Tok, namespace { +// TODO: Add new Type modifiers HazardyKnusperkeks wrote: ```suggestion // TODO: Add new Type modifiers. ``` https://github.com/llvm/llvm-project/pull/120904 __

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2024-12-24 Thread Björn Schäpers via cfe-commits
@@ -11077,6 +11077,221 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateClose) { HazardyKnusperkeks wrote: This one is still missing. https://github.com/llvm/llvm-project/pull/118046 _

[clang] [clang-format] extend clang-format directive with options to prevent formatting for one line (PR #118566)

2024-12-23 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > > > I struggle with changes that encourage people to not be fully > > > clang-formatted, I would prefer to ask why we need this feature, can we > > > have some examples of where this would be used? > > > > > > This makes it so only one line isn't formatted instead

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

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

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-21 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > > I think it should be merges with `BinPackArguments` to get an enum > > > > * Never > > * TwentyOrAbove (name is debatable) > > * Always > > * (Leave?) > > Currently the 20 item limit is only enforced on C++ initializer lists. Making > it part of the `BinPackArgume

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-12-21 Thread Björn Schäpers via cfe-commits
@@ -1452,6 +1476,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { FormatStyle LLVMStyle; LLVMStyle.AccessModifierOffset = -2; LLVMStyle.AlignAfterOpenBracket = FormatStyle::BAS_Align; + LLVMStyle.AlignAfterOpenBracketBreak = {}; Hazar

[clang] [clang-format] Fix crashes when the macro expansion is empty (PR #119428)

2024-12-20 Thread Björn Schäpers via cfe-commits
@@ -233,6 +233,10 @@ MacroExpander::expand(FormatToken *ID, if (Result.size() > 1) { ++Result[0]->MacroCtx->StartOfExpansion; ++Result[Result.size() - 2]->MacroCtx->EndOfExpansion; + } else { +// If the macro expansion is empty, mark the start and end ---

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2024-12-19 Thread Björn Schäpers via cfe-commits
@@ -11077,6 +11077,221 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateClose) { + FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp); + Style.ColumnLimit = 0; + verifyNoChange("template \n" +

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2024-12-19 Thread Björn Schäpers via cfe-commits
@@ -11077,6 +11077,221 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateClose) { HazardyKnusperkeks wrote: One additional test: How about nested templates? `template typename T>` for exampl

[clang] [clang-format] extend clang-format directive with options to prevent formatting for one line (PR #118566)

2024-12-18 Thread Björn Schäpers via cfe-commits
@@ -144,7 +144,8 @@ void DefinitionBlockSeparator::separateBlocks( return false; if (const auto *Tok = OperateLine->First; - Tok->is(tok::comment) && !isClangFormatOn(Tok->TokenText)) { + Tok->is(tok::comment) && parseClangFormatDirective(Tok->T

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

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

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

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

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-13 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks commented: I think it should be merges with `BinPackArguments` to get an enum * Never * TwentyOrAbove (name is debatable) * Always * (Leave?) https://github.com/llvm/llvm-project/pull/112482 ___ cfe-commits mailing

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-13 Thread Björn Schäpers via cfe-commits
@@ -1208,6 +1208,21 @@ struct FormatStyle { /// \version 3.7 bool BinPackArguments; + /// If ``BinPackArguments`` is ``false`` this option can override it if + /// ``true`` when 20 or more items are in a braced initializer list. HazardyKnusperkeks wrote:

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-12-13 Thread Björn Schäpers via cfe-commits
@@ -811,10 +816,11 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, if (!Tok.Previous) return true; if (Tok.Previous->isIf()) - return Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak; -return !Tok.Previous->i

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-12-13 Thread Björn Schäpers via cfe-commits
@@ -1169,6 +1181,18 @@ template <> struct MappingTraits { IO.mapOptional("WhitespaceSensitiveMacros", Style.WhitespaceSensitiveMacros); +// If AlignAfterOpenBracket was specified but AlignAfterOpenBracketBreak +// was not, initialize the latter f

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-12-13 Thread Björn Schäpers via cfe-commits
@@ -1169,6 +1181,18 @@ template <> struct MappingTraits { IO.mapOptional("WhitespaceSensitiveMacros", Style.WhitespaceSensitiveMacros); +// If AlignAfterOpenBracket was specified but AlignAfterOpenBracketBreak +// was not, initialize the latter f

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

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

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-12-13 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks commented: I don't think this is the way to go, or at least not with this name. How about going the `Custom` way? https://github.com/llvm/llvm-project/pull/108332 ___ cfe-commits mailing list cfe-commits@lists.llv

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-12-13 Thread Björn Schäpers via cfe-commits
@@ -1452,6 +1476,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { FormatStyle LLVMStyle; LLVMStyle.AccessModifierOffset = -2; LLVMStyle.AlignAfterOpenBracket = FormatStyle::BAS_Align; + LLVMStyle.AlignAfterOpenBracketBreak = {}; Hazar

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-07 Thread Björn Schäpers via cfe-commits
@@ -3398,6 +3401,21 @@ struct FormatStyle { /// \version 3.7 unsigned MaxEmptyLinesToKeep; + /// If ``BinPackArguments`` is ``false`` this option can override it if + /// ``true`` when 20 or more items are in a braced initializer list. + /// \code + ///BinPackLongB

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2024-12-07 Thread Björn Schäpers via cfe-commits
@@ -11077,6 +11077,157 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateClose) { HazardyKnusperkeks wrote: I want to see some lambdas and template usages (not declarations). https://github

[clang] [clang-format] Fix an assertion failure in RemoveSemicolon (PR #117472)

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

[clang] [clang-format] Stop crashing on slightly off Verilog module headers (PR #116000)

2024-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/116000 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Don't re-annotate CaseLabelColon as ConditionalExpr (PR #114639)

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

[clang] [clang-format] Fix a regression in parsing `switch` in macro call (PR #114506)

2024-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/114506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix path expansion inside git-clang-format.bat (PR #114078)

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

[clang] [clang-format] Make bitwise and imply requires clause (PR #110942)

2024-10-25 Thread Björn Schäpers via cfe-commits
@@ -1296,6 +1296,15 @@ TEST_F(TokenAnnotatorTest, UnderstandsRequiresClausesAndConcepts) { Tokens = annotate("bool x = t && requires(Foo x) { x.foo(); };"); ASSERT_EQ(Tokens.size(), 25u) << Tokens; EXPECT_TOKEN(Tokens[5], tok::kw_requires, TT_RequiresExpression); + + //

[clang] [clang-format] Print the names of unfound files in error messages (PR #113640)

2024-10-25 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/113640 ___ 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 control indentation of `export { ... }` (PR #110381)

2024-10-25 Thread Björn Schäpers via cfe-commits
@@ -26588,10 +26613,7 @@ TEST_F(FormatTest, Cpp20ModulesSupport) { " int foo;\n" "};", Style); - verifyFormat("export {\n" - " int foo;\n" - "};", - Style); + verifyFormat("export { int f

[clang] [clang-format] clang-format-ignore: Add support for double asterisk patterns (PR #110560)

2024-10-25 Thread Björn Schäpers via cfe-commits
@@ -49,11 +49,29 @@ bool matchFilePath(StringRef Pattern, StringRef FilePath) { return false; break; case '*': { - while (++I < EOP && Pattern[I] == '*') { // Skip consecutive stars. + if (I + 1 < EOP && Pattern[I + 1] == '*') { +// Handle '*

[clang] [clang-format] Add an option to control indentation of `export { ... }` (PR #110381)

2024-10-24 Thread Björn Schäpers via cfe-commits
@@ -3107,29 +3131,15 @@ void UnwrappedLineParser::parseNamespace() { DeclarationScopeStack.size() > 1) ? 1u : 0u; -bool ManageWhitesmithsBraces = -AddLevels == 0u && -Style.BreakBeforeBraces == FormatStyle::BS_Whitesm

[clang] [clang-format] clang-format-ignore: Add support for double asterisk patterns (PR #110560)

2024-10-24 Thread Björn Schäpers via cfe-commits
@@ -49,11 +49,29 @@ bool matchFilePath(StringRef Pattern, StringRef FilePath) { return false; break; case '*': { - while (++I < EOP && Pattern[I] == '*') { // Skip consecutive stars. + if (I + 1 < EOP && Pattern[I + 1] == '*') { +// Handle '*

[clang] [clang-format] Add TemplateNames option to help parse C++ angles (PR #109916)

2024-10-23 Thread Björn Schäpers via cfe-commits
@@ -5230,6 +5239,7 @@ struct FormatStyle { TableGenBreakingDAGArgOperators == R.TableGenBreakingDAGArgOperators && TableGenBreakInsideDAGArg == R.TableGenBreakInsideDAGArg && + TabWidth == R.TabWidth && TemplateNames == R.TemplateN

[clang] [clang-format] Add KeepFormFeed option (PR #113268)

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

[clang] [clang-format] Fix working -assume-filename with .clang-format-ignore (PR #113100)

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

[clang] Add "clang-format-on-save-mode" minor mode to clang-format.el (PR #104533)

2024-10-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks closed https://github.com/llvm/llvm-project/pull/104533 ___ 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 CastRParen (PR #107675)

2024-09-07 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/107675 ___ 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-05 Thread Björn Schäpers via cfe-commits
@@ -28104,6 +28104,251 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

[clang] [clang-tools-extra] [llvm] [clang-format] Add support for BasedOnStyle referencing an arbitrary file (PR #107312)

2024-09-04 Thread Björn Schäpers via cfe-commits
@@ -109,6 +110,9 @@ class ChangeNamespaceTool : public ast_matchers::MatchFinder::MatchCallback { }; std::string FallbackStyle; + // Specifies the list of paths to be searched when FormatStyle or a BasedOnStyle + // in a .clang-format file specifies an arbitrary file t

[clang] [clang-tools-extra] [llvm] [clang-format] Add support for BasedOnStyle referencing an arbitrary file (PR #107312)

2024-09-04 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks commented: You are touching a lot of projects. I don't know how others feel about that, but my preference would be to tackle one project per PR. https://github.com/llvm/llvm-project/pull/107312 ___ cfe-commits mai

[clang] [clang-tools-extra] [llvm] [clang-format] Add support for BasedOnStyle referencing an arbitrary file (PR #107312)

2024-09-04 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks edited https://github.com/llvm/llvm-project/pull/107312 ___ 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 #107352)

2024-09-04 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/107352 ___ 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 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] 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] 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] 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] 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] 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] 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] 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] 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] 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
@@ -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
@@ -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 HazardyKnusperkeks wrote: ```suggestion /// Insert a newline at the begging

[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] Correctly compute SplitPenalty of TrailingReturnArrow (PR #105613)

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

[clang] clang-format: Add "AllowShortNamespacesOnASingleLine" option (PR #105597)

2024-08-23 Thread Björn Schäpers via cfe-commits
@@ -916,6 +981,23 @@ class LineJoiner { return 1 + I[1]->Last->TotalLength + 1 + I[2]->Last->TotalLength <= Limit; } + bool nextNLinesFitInto(SmallVectorImpl::const_iterator I, + SmallVectorImpl::const_iterator E, + unsign

[clang] clang-format: Add "AllowShortNamespacesOnASingleLine" option (PR #105597)

2024-08-23 Thread Björn Schäpers via cfe-commits
@@ -27981,6 +27981,118 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + FormatStyle Style = getLLVMStyle(); + Style.AllowShortNamespacesOnASingleLine = true; + Style.FixNamespaceComments = false; + + //

[clang] clang-format: Add "AllowShortNamespacesOnASingleLine" option (PR #105597)

2024-08-23 Thread Björn Schäpers via cfe-commits
@@ -616,6 +625,62 @@ class LineJoiner { return 1; } + unsigned tryMergeNamespace(SmallVectorImpl::const_iterator I, + SmallVectorImpl::const_iterator E, + unsigned Limit) { +if (Limit == 0) + return 0; +

[clang] clang-format: Add "AllowShortNamespacesOnASingleLine" option (PR #105597)

2024-08-23 Thread Björn Schäpers via cfe-commits
@@ -916,6 +981,23 @@ class LineJoiner { return 1 + I[1]->Last->TotalLength + 1 + I[2]->Last->TotalLength <= Limit; } + bool nextNLinesFitInto(SmallVectorImpl::const_iterator I, + SmallVectorImpl::const_iterator E, + unsign

[clang] [clang-format] Treat new expressions as simple functions (PR #105168)

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

[clang] [clang-format] Treat new expressions as simple functions (PR #105168)

2024-08-21 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: How does it look like without the new? https://github.com/llvm/llvm-project/pull/105168 ___ 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-08-21 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks closed 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] Change GNU style language standard to LS_Latest (PR #104669)

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

[clang] [clang-format] Correctly handle C# attribute on auto property (PR #102921)

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

[clang] Fixes and closes issues, #53390 and #58710. Added new controls to IndentNamespaceAliases, IndentUsingDeclarations and DecorateReflowedComments. (PR #102894)

2024-08-12 Thread Björn Schäpers via cfe-commits
@@ -2822,6 +2822,46 @@ struct FormatStyle { /// \version 11 IndentExternBlockStyle IndentExternBlock; + /// IndentNamespaceAliases is the type of indenting of namespace aliases + /// irrespective of NamespaceIndentation. + bool IndentNamespaceAliases; + + /// IndentUsi

[clang] Fixes and closes issues, #53390 and #58710. Added new controls to IndentNamespaceAliases, IndentUsingDeclarations and DecorateReflowedComments. (PR #102894)

2024-08-12 Thread Björn Schäpers via cfe-commits
@@ -346,6 +345,35 @@ bool UnwrappedLineParser::precededByCommentOrPPDirective() const { (Previous->IsMultiline || Previous->NewlinesBefore > 0); } +void UnwrappedLineParser::parseStmt(bool keepIndentation) { + bool levelsAreAdded = (Line->Level == DeclarationScopeSt

[clang] Fixes and closes issues, #53390 and #58710. Added new controls to IndentNamespaceAliases, IndentUsingDeclarations and DecorateReflowedComments. (PR #102894)

2024-08-12 Thread Björn Schäpers via cfe-commits
@@ -2822,6 +2822,46 @@ struct FormatStyle { /// \version 11 IndentExternBlockStyle IndentExternBlock; + /// IndentNamespaceAliases is the type of indenting of namespace aliases + /// irrespective of NamespaceIndentation. + bool IndentNamespaceAliases; H

[clang] Fixes and closes issues, #53390 and #58710. Added new controls to IndentNamespaceAliases, IndentUsingDeclarations and DecorateReflowedComments. (PR #102894)

2024-08-12 Thread Björn Schäpers via cfe-commits
@@ -465,6 +493,9 @@ bool UnwrappedLineParser::parseLevel(const FormatToken *OpeningBrace, SwitchLabelEncountered = true; parseStructuralElement(); break; +case tok::kw_using: + parseStmt(Style.IndentUsingDeclarations); HazardyKnusper

[clang] Fixes and closes issues, #53390 and #58710. Added new controls to IndentNamespaceAliases, IndentUsingDeclarations and DecorateReflowedComments. (PR #102894)

2024-08-12 Thread Björn Schäpers via cfe-commits
@@ -5104,6 +5144,9 @@ struct FormatStyle { IndentCaseBlocks == R.IndentCaseBlocks && IndentCaseLabels == R.IndentCaseLabels && IndentExternBlock == R.IndentExternBlock && + IndentNamespaceAliases == R.IndentNamespaceAliases && +

[clang] Fixes and closes issues, #53390 and #58710. Added new controls to IndentNamespaceAliases, IndentUsingDeclarations and DecorateReflowedComments. (PR #102894)

2024-08-12 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks requested changes to this pull request. First of all you need a better title for your change, beginning with "[clang-format]" Second of all, could you please split this in multiple reviews? Third of all, you need to add tests. https://github.com/llvm/llvm

[clang] Fixes and closes issues, #53390 and #58710. Added new controls to IndentNamespaceAliases, IndentUsingDeclarations and DecorateReflowedComments. (PR #102894)

2024-08-12 Thread Björn Schäpers via cfe-commits
@@ -47,8 +47,7 @@ void printLine(llvm::raw_ostream &OS, const UnwrappedLine &Line, OS << Prefix; NewLine = false; } -OS << I->Tok->Tok.getName() << "[" - << "T=" << (unsigned)I->Tok->getType() +OS << I->Tok->Tok.getName() << "[" << "T=" << (unsign

[clang] Fixes and closes issues, #53390 and #58710. Added new controls to IndentNamespaceAliases, IndentUsingDeclarations and DecorateReflowedComments. (PR #102894)

2024-08-12 Thread Björn Schäpers via cfe-commits
@@ -346,6 +345,35 @@ bool UnwrappedLineParser::precededByCommentOrPPDirective() const { (Previous->IsMultiline || Previous->NewlinesBefore > 0); } +void UnwrappedLineParser::parseStmt(bool keepIndentation) { + bool levelsAreAdded = (Line->Level == DeclarationScopeSt

[clang] Fixes and closes issues, #53390 and #58710. Added new controls to IndentNamespaceAliases, IndentUsingDeclarations and DecorateReflowedComments. (PR #102894)

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

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

2024-08-12 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/102078 ___ 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-08-10 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: Nah, I can't find a better name, which isn't a whole sentence. https://github.com/llvm/llvm-project/pull/95013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a serious bug in `git clang-format -f` (PR #102629)

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

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

2024-08-09 Thread Björn Schäpers via cfe-commits
@@ -5682,12 +5683,15 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, (Style.BreakTemplateDeclarations == FormatStyle::BTDS_Leave && Right.NewlinesBefore > 0); } - if (Left.ClosesRequiresClause && Right.isNot(tok::semi) && - Rig

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

2024-08-09 Thread Björn Schäpers via cfe-commits
@@ -25831,19 +25843,108 @@ TEST_F(FormatTest, RequiresClausesPositions) { verifyFormat("template \n" "int S::bar(T t) &&\n" - "requires F {\n" + "requires F\n" + "{\n" " return 5;\n" "}

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

2024-08-09 Thread Björn Schäpers via cfe-commits
@@ -25831,19 +25843,108 @@ TEST_F(FormatTest, RequiresClausesPositions) { verifyFormat("template \n" "int S::bar(T t) &&\n" - "requires F {\n" + "requires F\n" + "{\n" " return 5;\n" "}

[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] [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] 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] 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] 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] 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
@@ -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
@@ -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
@@ -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] 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

  1   2   3   4   5   6   7   8   >