[clang] [clang-format] Treat uppercase identifiers after struct as macros (PR #124397)

2025-01-25 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/124397 ___ 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-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] 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] 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-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-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] 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] Fix a bug in annotating braces (PR #127306)

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

2025-02-11 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: Was there a change which I should look at again? I find the GitHub UI for reviews terrible. If it was just a rebase my vote stands. https://github.com/llvm/llvm-project/pull/108332 ___ cfe-commits mailing list cfe-commits@lis

[clang] [NFC] Avoid potential null dereference. (PR #126872)

2025-02-13 Thread Björn Schäpers via cfe-commits
@@ -1596,7 +1596,7 @@ static auto computeNewlines(const AnnotatedLine &Line, if (Line.startsWith(TT_NamespaceRBrace)) { if (Style.WrapNamespaceBodyWithEmptyLines == FormatStyle::WNBWELS_Never) Newlines = 1; - else if (!PreviousLine->startsWith(TT_Namespac

[clang] [clang-format] Fix a bug in annotating ObjCMethodSpecifier (PR #127159)

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

[clang] [clang-format] Allow specifying the language for `.h` files (PR #128122)

2025-02-21 Thread Björn Schäpers via cfe-commits
@@ -3353,7 +3353,12 @@ struct FormatStyle { } bool isTableGen() const { return Language == LK_TableGen; } - /// Language, this format style is targeted at. + /// The language that this format style targets. + /// \note + /// You can also specify the language (``Cpp``

[clang] [clang-format] Fix a bug in BCIS_AfterColon and `ColumnLimit: 0` (PR #127964)

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

[clang] [clang-format] Add the C language instead of treating it like C++ (PR #128287)

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

[clang] [clang-format] Allow breaking before kw___attribute (PR #128623)

2025-02-25 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/128623 ___ 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 that changes keyword `or` to an identifier (PR #128410)

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

[clang] [clang-format] Don't break before *const (PR #128817)

2025-02-26 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/128817 ___ 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 #127545)

2025-02-17 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/127545 ___ 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 C++ access specifiers in C (PR #129983)

2025-03-07 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/129983 ___ 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 wrapping function return type (PR #129374)

2025-03-06 Thread Björn Schäpers via cfe-commits
@@ -5091,8 +5091,10 @@ UnwrappedLineParser::parseMacroCall() { void UnwrappedLineParser::pushToken(FormatToken *Tok) { Line->Tokens.push_back(UnwrappedLineNode(Tok)); if (MustBreakBeforeNextToken) { HazardyKnusperkeks wrote: Good. https://github.com/llvm/

[clang] [clang-format] Change BracedInitializerIndentWidth to int (PR #128988)

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

[clang] [clang-format] Change BracedInitializerIndentWidth to int (PR #128988)

2025-02-27 Thread Björn Schäpers via cfe-commits
@@ -1441,8 +1441,9 @@ TEST(ConfigParseTest, GetStyleOfFile) { ASSERT_EQ(*Style9, SubSubStyle); // Test 9.8: use inheritance from a file without BasedOnStyle - ASSERT_TRUE(FS.addFile("/e/withoutbase/.clang-format", 0, - llvm::MemoryBuffer::getMemBuf

[clang] [clang-format] Don't remove parentheses separated from ellipsis by comma (PR #130471)

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

[clang] [clang-format] Correctly annotate user-defined conversion functions (PR #131434)

2025-03-15 Thread Björn Schäpers via cfe-commits
@@ -3856,6 +3856,59 @@ TEST_F(TokenAnnotatorTest, AfterPPDirective) { EXPECT_TOKEN(Tokens[2], tok::minusminus, TT_AfterPPDirective); } +TEST_F(TokenAnnotatorTest, UserDefinedConversionFunction) { + auto Tokens = annotate("operator int();"); + ASSERT_EQ(Tokens.size(), 6u) <

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-15 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: I still think Google should have to say what their style in clang-format is, extending to the default values of `AttributeMacros`. I also wouldn't have such a big issue with adding it to the base style, because of the prefix and I think it's nice that Boost or Qt most

[clang] [Format] Do not crash on non-null terminated strings (PR #131299)

2025-03-14 Thread Björn Schäpers via cfe-commits
@@ -2031,6 +2031,7 @@ class SourceManagerForFile { // The order of these fields are important - they should be in the same order // as they are created in `createSourceManagerForFile` so that they can be // deleted in the reverse order as they are created. + std::string

[clang] [Format] Do not crash on non-null terminated strings (PR #131299)

2025-03-14 Thread Björn Schäpers via cfe-commits
@@ -29096,6 +29096,17 @@ TEST_F(FormatTest, BreakBeforeClassName) { "ArenaSafeUniquePtr {};"); } +TEST_F(FormatTest, DoesNotCrashOnNonNullTerminatedStringRefs) { + llvm::StringRef TwoLines = "namespace foo {}\n" + "namespace bar

[clang] [Format] Do not crash on non-null terminated strings (PR #131299)

2025-03-14 Thread Björn Schäpers via cfe-commits
@@ -2382,14 +2382,20 @@ size_t SourceManager::getDataStructureSizes() const { SourceManagerForFile::SourceManagerForFile(StringRef FileName, StringRef Content) { + // We copy to `std::string` for Context instead of StringRef because

[clang] [clang-format] Correctly annotate user-defined conversion functions (PR #131434)

2025-03-15 Thread Björn Schäpers via cfe-commits
@@ -1639,6 +1639,25 @@ class AnnotatingParser { case tok::kw_operator: if (Style.isProto()) break; + // C++ user-defined conversion function. + if (IsCpp && CurrentToken && + (CurrentToken->is(tok::kw_auto) || + CurrentToken->isTyp

[clang] [Format] Do not crash on non-null terminated strings (PR #131299)

2025-03-17 Thread Björn Schäpers via cfe-commits
@@ -2382,14 +2382,20 @@ size_t SourceManager::getDataStructureSizes() const { SourceManagerForFile::SourceManagerForFile(StringRef FileName, StringRef Content) { + // We copy to `std::string` for Context instead of StringRef because

[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
@@ -148,6 +160,24 @@ class AnnotatingParser { } } + const FormatStyle::FunctionDeclarationWithKeywords * + isInsideFunctionWithKeywordedParameters(const FormatToken &Token) const { +const FormatToken *Previous = &Token; +while (auto Prev = Previous->getPrevious

[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
@@ -148,6 +160,24 @@ class AnnotatingParser { } } + const FormatStyle::FunctionDeclarationWithKeywords * + isInsideFunctionWithKeywordedParameters(const FormatToken &Token) const { HazardyKnusperkeks wrote: The name is misleading, I'd expect a `bool`e

[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
@@ -148,6 +160,24 @@ class AnnotatingParser { } } + const FormatStyle::FunctionDeclarationWithKeywords * + isInsideFunctionWithKeywordedParameters(const FormatToken &Token) const { +const FormatToken *Previous = &Token; +while (auto Prev = Previous->getPrevious

[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
@@ -5435,7 +5470,10 @@ struct FormatStyle { VerilogBreakBetweenInstancePorts == R.VerilogBreakBetweenInstancePorts && WhitespaceSensitiveMacros == R.WhitespaceSensitiveMacros && - WrapNamespaceBodyWithEmptyLines == R.WrapNamespace

[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
@@ -116,6 +116,18 @@ static bool isCppAttribute(bool IsCpp, const FormatToken &Tok) { return AttrTok && AttrTok->startsSequence(tok::r_square, tok::r_square); } +static bool isParametersKeyword( +const FormatToken &Tok, +const FormatStyle::FunctionDeclarationWithKey

[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
@@ -349,6 +349,10 @@ bool ContinuationIndenter::canBreak(const LineState &State) { } } + // Don't break between function parameter keywords and parameter names HazardyKnusperkeks wrote: ```suggestion // Don't break between function parameter keyword

[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
@@ -148,6 +160,24 @@ class AnnotatingParser { } } + const FormatStyle::FunctionDeclarationWithKeywords * + isInsideFunctionWithKeywordedParameters(const FormatToken &Token) const { +const FormatToken *Previous = &Token; +while (auto Prev = Previous->getPrevious

[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
@@ -5247,6 +5247,41 @@ struct FormatStyle { /// \version 20 WrapNamespaceBodyWithEmptyLinesStyle WrapNamespaceBodyWithEmptyLines; + struct FunctionDeclarationWithKeywords { +std::string Name; +std::vector Keywords; + +bool operator==(const FunctionDeclarationW

[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
@@ -82,6 +82,7 @@ namespace format { TYPE(FunctionAnnotationRParen) \ TYPE(FunctionDeclarationName) \ TYPE(FunctionDeclarationLParen)

[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
@@ -1192,6 +1201,8 @@ template <> struct MappingTraits { Style.WhitespaceSensitiveMacros); IO.mapOptional("WrapNamespaceBodyWithEmptyLines", Style.WrapNamespaceBodyWithEmptyLines); +IO.mapOptional("FunctionDeclarationsWithKeywords",

[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks edited https://github.com/llvm/llvm-project/pull/131605 ___ 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 bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
@@ -148,6 +160,24 @@ class AnnotatingParser { } } + const FormatStyle::FunctionDeclarationWithKeywords * + isInsideFunctionWithKeywordedParameters(const FormatToken &Token) const { +const FormatToken *Previous = &Token; +while (auto Prev = Previous->getPrevious

[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

2025-03-17 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks requested changes to this pull request. You need to add a parsing test for your option and annotation tests for the annotation. https://github.com/llvm/llvm-project/pull/131605 ___ cfe-commits mailing list cfe-com

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

2025-03-18 Thread Björn Schäpers via cfe-commits
@@ -29096,6 +29096,63 @@ TEST_F(FormatTest, BreakBeforeClassName) { "ArenaSafeUniquePtr {};"); } +TEST_F(FormatTest, FunctionDeclarationWithKeywords) { + FormatStyle::FunctionDeclarationWithKeywords QPropertyDeclaration; + QPropertyDeclaration.Name = "Q_PR

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

2025-03-18 Thread Björn Schäpers via cfe-commits
@@ -148,6 +160,24 @@ class AnnotatingParser { } } + const FormatStyle::FunctionDeclarationWithKeywords * + isInsideFunctionWithKeywordedParameters(const FormatToken &Token) const { +const FormatToken *Previous = &Token; +while (auto Prev = Previous->getPrevious

[clang] [clang-format] Correctly annotate user-defined conversion functions (PR #131434)

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

[clang] [Format] Do not crash on non-null terminated strings (PR #131299)

2025-03-18 Thread Björn Schäpers via cfe-commits
@@ -2382,14 +2382,20 @@ size_t SourceManager::getDataStructureSizes() const { SourceManagerForFile::SourceManagerForFile(StringRef FileName, StringRef Content) { + // We copy to `std::string` for Context instead of StringRef because

[clang] [clang-format] Recognize wait fork in Verilog (PR #132042)

2025-03-19 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/132042 ___ 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 control bin-packing keyworded parameters (PR #131605)

2025-03-25 Thread Björn Schäpers via cfe-commits
@@ -1,3 +1,4 @@ Strings +FunctionDeclarationWithKeywordes HazardyKnusperkeks wrote: I think you only need to fix this one? https://github.com/llvm/llvm-project/pull/131605 ___ cfe-commits mailing list cfe-commits@list

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

2025-03-25 Thread Björn Schäpers via cfe-commits
@@ -1,3 +1,4 @@ Strings +FunctionDeclarationWithKeywordes HazardyKnusperkeks wrote: Then I'd say we change that. I mean this is the fourth entry to the file and apparently it does not match. https://github.com/llvm/llvm-project/pull/131605

[clang] [clang-format]: Add `StaticInlineOnly` and `StaticInline` options to `ShortFunctionStyle` (PR #133598)

2025-03-29 Thread Björn Schäpers via cfe-commits
@@ -15120,6 +15120,85 @@ TEST_F(FormatTest, PullInlineFunctionDefinitionsIntoSingleLine) { MergeInlineOnly); } +TEST_F(FormatTest, PullStaticInlineFunctionDefinitionsIntoSingleLine) { + FormatStyle MergeStaticInlineOnly = getLLVMStyle(); + MergeStaticInlineOn

[clang] [clang-format] Add an option for editing enum trailing commas (PR #133576)

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

[clang] [clang-format] Correctly annotate pointer/reference in _Generic (PR #133673)

2025-03-31 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/133673 ___ 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 control bin-packing keyworded parameters (PR #131605)

2025-03-31 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > > IMO, a boolean option, e.g. `AllowBreakBeforeQPropertyKeyword` should > > suffice. > > I don't like to hardcode neither the macro name nor the keywords, which > depend on Qt version. Implementation would not differ save for the source we > fetch keywords from. I

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

2025-03-31 Thread Björn Schäpers via cfe-commits
@@ -3926,6 +3926,39 @@ TEST_F(TokenAnnotatorTest, UserDefinedConversionFunction) { EXPECT_TOKEN(Tokens[5], tok::l_paren, TT_FunctionDeclarationLParen); } +TEST_F(TokenAnnotatorTest, KeywordedFunctionLikeMacro) { + auto Style = getLLVMStyle(); + FormatStyle::KeywordedFunct

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

2025-03-31 Thread Björn Schäpers via cfe-commits
@@ -498,6 +498,8 @@ clang-format top of the file. - Add ``EnumTrailingComma`` option for inserting/removing commas at the end of ``enum`` enumerator lists. +- Allow to apply parameters bin-packing options to function-like macros that + use keywords to delimit parameters (e

[clang] [Format] Do not crash on non-null terminated strings (PR #131299)

2025-04-04 Thread Björn Schäpers via cfe-commits
@@ -2031,6 +2031,7 @@ class SourceManagerForFile { // The order of these fields are important - they should be in the same order // as they are created in `createSourceManagerForFile` so that they can be // deleted in the reverse order as they are created. + std::string

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

2025-04-04 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > FAIL: Clang :: Format/docs_updated.test (12079 of 22139) You forgot to redo the documentation. https://github.com/llvm/llvm-project/pull/131605 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

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

[clang] [clang-format]: Add `StaticInlineOnly` and `StaticInline` options to `ShortFunctionStyle` (PR #133598)

2025-03-29 Thread Björn Schäpers via cfe-commits
@@ -335,6 +336,32 @@ class LineJoiner { } } + if (Style.AllowShortFunctionsOnASingleLine == + FormatStyle::SFS_StaticInlineOnly || + Style.AllowShortFunctionsOnASingleLine == + FormatStyle::SFS_StaticInline) { +// C

[clang] [clang-format]: Add `StaticInlineOnly` and `StaticInline` options to `ShortFunctionStyle` (PR #133598)

2025-03-29 Thread Björn Schäpers via cfe-commits
@@ -15120,6 +15120,85 @@ TEST_F(FormatTest, PullInlineFunctionDefinitionsIntoSingleLine) { MergeInlineOnly); } +TEST_F(FormatTest, PullStaticInlineFunctionDefinitionsIntoSingleLine) { + FormatStyle MergeStaticInlineOnly = getLLVMStyle(); + MergeStaticInlineOn

[clang] [clang-format]: Add `StaticInlineOnly` and `StaticInline` options to `ShortFunctionStyle` (PR #133598)

2025-03-29 Thread Björn Schäpers via cfe-commits
@@ -863,6 +870,12 @@ struct FormatStyle { /// void f() {} /// \endcode SFS_Inline, +/// Only merge functions defined as static inline. Implies ``empty``. HazardyKnusperkeks wrote: This should have a different text. https://github.com/llvm/ll

[clang] [clang-format]: Add `StaticInlineOnly` and `StaticInline` options to `ShortFunctionStyle` (PR #133598)

2025-03-29 Thread Björn Schäpers via cfe-commits
@@ -335,6 +336,32 @@ class LineJoiner { } } + if (Style.AllowShortFunctionsOnASingleLine == + FormatStyle::SFS_StaticInlineOnly || + Style.AllowShortFunctionsOnASingleLine == + FormatStyle::SFS_StaticInline) { +// C

[clang] [clang-format]: Add `StaticInlineOnly` and `StaticInline` options to `ShortFunctionStyle` (PR #133598)

2025-03-29 Thread Björn Schäpers via cfe-commits
@@ -335,6 +336,32 @@ class LineJoiner { } } + if (Style.AllowShortFunctionsOnASingleLine == + FormatStyle::SFS_StaticInlineOnly || + Style.AllowShortFunctionsOnASingleLine == + FormatStyle::SFS_StaticInline) { +// C

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

2025-04-04 Thread Björn Schäpers via cfe-commits
@@ -1067,6 +1076,8 @@ template <> struct MappingTraits { IO.mapOptional("InsertNewlineAtEOF", Style.InsertNewlineAtEOF); IO.mapOptional("InsertTrailingCommas", Style.InsertTrailingCommas); IO.mapOptional("IntegerLiteralSeparator", Style.IntegerLiteralSeparator); +

[clang] [clang-format] Handle C++ keywords in other languages better (PR #132941)

2025-03-25 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/132941 ___ 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 on annotating template angles (PR #132885)

2025-03-25 Thread Björn Schäpers via cfe-commits
@@ -720,8 +720,9 @@ TEST_F(TokenAnnotatorTest, UnderstandsNonTemplateAngleBrackets) { Tokens = annotate("return A < B != A > B;"); ASSERT_EQ(Tokens.size(), 10u) << Tokens; - EXPECT_TOKEN(Tokens[2], tok::less, TT_BinaryOperator); - EXPECT_TOKEN(Tokens[6], tok::greater, T

[clang] [clang-format] Allow `Language: Cpp` for C files (PR #133033)

2025-03-26 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/133033 ___ 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 control bin-packing keyworded parameters (PR #131605)

2025-03-27 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: Please recheck all your added comments, if the wording is still the best one, after renaming the option. https://github.com/llvm/llvm-project/pull/131605 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

2025-03-27 Thread Björn Schäpers via cfe-commits
@@ -3146,6 +3146,45 @@ struct FormatStyle { /// \version 16 IntegerLiteralSeparatorStyle IntegerLiteralSeparator; + /// Function-like declaration with keyworded parameters. + /// Lists possible keywords for a named macro-like function + struct KeywordedFunctionLikeMacro

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

2025-03-27 Thread Björn Schäpers via cfe-commits
@@ -29102,6 +29102,65 @@ TEST_F(FormatTest, BreakBeforeClassName) { "ArenaSafeUniquePtr {};"); } +TEST_F(FormatTest, FunctionDeclarationWithKeywords) { HazardyKnusperkeks wrote: The test name should be changed, I'd refer directly to the opt

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

2025-03-27 Thread Björn Schäpers via cfe-commits
@@ -3146,6 +3146,45 @@ struct FormatStyle { /// \version 16 IntegerLiteralSeparatorStyle IntegerLiteralSeparator; + /// Function-like declaration with keyworded parameters. + /// Lists possible keywords for a named macro-like function HazardyKnusperkeks

[clang] [clang-format] Allow `Language: Cpp` for C files (PR #133033)

2025-03-27 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/133033 ___ 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 control bin-packing keyworded parameters (PR #131605)

2025-03-28 Thread Björn Schäpers via cfe-commits
@@ -3276,6 +3276,45 @@ struct FormatStyle { /// \version 20 bool KeepFormFeed; + /// Function-like declaration with keyworded parameters. + /// Lists possible keywords for a named function-like macro. + struct KeywordedFunctionLikeMacro { +std::string Name; +std

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

2025-03-28 Thread Björn Schäpers via cfe-commits
@@ -5347,6 +5386,7 @@ struct FormatStyle { InsertBraces == R.InsertBraces && InsertNewlineAtEOF == R.InsertNewlineAtEOF && IntegerLiteralSeparator == R.IntegerLiteralSeparator && + KeywordedFunctionLikeMacros == R.KeywordedFunctionLike

[clang] [clang-format] add option to control bin-packing keyworded parameters (PR #131605)

2025-03-28 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks commented: Nearly done. ;) https://github.com/llvm/llvm-project/pull/131605 ___ 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 control bin-packing keyworded parameters (PR #131605)

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

[clang] [clang-format]: Add `StaticInlineOnly` and `StaticInline` options to `ShortFunctionStyle` (PR #133598)

2025-03-29 Thread Björn Schäpers via cfe-commits
@@ -335,6 +336,32 @@ class LineJoiner { } } + if (Style.AllowShortFunctionsOnASingleLine == + FormatStyle::SFS_StaticInlineOnly || + Style.AllowShortFunctionsOnASingleLine == + FormatStyle::SFS_StaticInline) { +// C

[clang] [clang-format] Add an option for editing enum trailing commas (PR #133576)

2025-03-29 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. Should this get the same warning as the other non white space changes? https://github.com/llvm/llvm-project/pull/133576 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://li

[clang] [clang-format] Add an option for editing enum trailing commas (PR #133576)

2025-03-30 Thread Björn Schäpers via cfe-commits
@@ -2214,6 +2214,21 @@ FormatStyle::GetLanguageStyle(FormatStyle::LanguageKind Language) const { namespace { +void replaceToken(const FormatToken &Token, FormatToken *Next, + const SourceManager &SourceMgr, tooling::Replacements &Result, +

[clang] [clang-format] Add an option for editing enum trailing commas (PR #133576)

2025-03-30 Thread Björn Schäpers via cfe-commits
@@ -2214,6 +2214,21 @@ FormatStyle::GetLanguageStyle(FormatStyle::LanguageKind Language) const { namespace { +void replaceToken(const FormatToken &Token, FormatToken *Next, + const SourceManager &SourceMgr, tooling::Replacements &Result, +

[clang] [clang-format] Recognize TableGen paste operator on separate line (PR #133722)

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

[clang] [clang-format] Set C11 instead of C17 for LK_C (PR #134472)

2025-04-05 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. But why does this fix it? https://github.com/llvm/llvm-project/pull/134472 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] [clang-format] Merge inline short functions for BS_Whitesmiths (PR #134473)

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

<    4   5   6   7   8   9