[clang] [clang-format] Treat lambda in braced init as inline (PR #135520)

2025-04-13 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/135520 ___ 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 AlignConsecutiveDeclarations (PR #135516)

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

[clang] [clang-format] Wrap and indent lambda braces in GNU style (PR #135479)

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

[clang] [clang-format][NFC] Add isJava() and isTextProto() in FormatStyle (PR #135466)

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

[clang] Treat ipynb as json (PR #135137)

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

[clang] Treat ipynb as json (PR #135137)

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

[clang] Treat ipynb as json (PR #135137)

2025-04-10 Thread Björn Schäpers via cfe-commits
@@ -33,7 +33,7 @@ to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code. Clang-format options: --Werror - If set, changes formatting warnings to errors ---Wno-error=- If set, don't error out on the specified warning ty

[clang] Treat ipynb as json (PR #135137)

2025-04-10 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks commented: I think you should also update: * `git-clang-format` * The help text in `ClangFormat.cpp` * Run `clang/docs/tools/dump_format_help.py` * `clang-format-diff.py` https://github.com/llvm/llvm-project/pull/135137 __

[clang] [clang-format] Keep the space between `not` and a unary operator (PR #135035)

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

[clang] [clang-format][NFC] Add FormatToken::is(tok::ObjCKeywordKind) (PR #134973)

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

[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] 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] 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] [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-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] [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
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] 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 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] 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]: 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-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 `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
@@ -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
@@ -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
@@ -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-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 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 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
@@ -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-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 HazardyKnusperkeks

[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] 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] 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] 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] 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 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] 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-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] 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] [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] 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 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 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
@@ -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
@@ -5247,6 +5247,41 @@ struct FormatStyle { /// \version 20 WrapNamespaceBodyWithEmptyLinesStyle WrapNamespaceBodyWithEmptyLines; + struct FunctionDeclarationWithKeywords { +std::string Name; +std::vector Keywords; + +bool operator==(const FunctionDeclarationW

[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
@@ -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
@@ -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
@@ -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
@@ -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 { +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] 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] [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] [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] 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-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
@@ -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] [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] [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] 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 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 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] 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] 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 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] 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] 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] 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] [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] 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] [clang-format] Handle C-style cast of member function pointer type (PR #126340)

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

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-02 Thread Björn Schäpers via cfe-commits
@@ -260,15 +265,13 @@ def main(): "Ignoring the following files (wrong extension, symlink, or " "ignored by clang-format):" ) -for filename in ignored_files: -print("%s" % filename) +print_f

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-02-02 Thread Björn Schäpers via cfe-commits
@@ -412,6 +414,15 @@ const FormatToken *LeftRightQualifierAlignmentFixer::analyzeLeft( // The case `const long long volatile int` -> `const volatile long long int` // The case `long volatile long int const` -> `const volatile long long int` if (TypeToken->isTypeName(Lang

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

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

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-02-01 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > > Seems to also work for top-level types (`::int_64_t constexpr x{123};` > > works correctly) but breaks for fully qualified types (`::std::int64_t > > constexpr x{123};` becomes `::constexpr std::int64_t x{123};`) > > Yeah, I intentionally didn't want to use a loop

[clang] [clang-format] Fix a bug in annotating ClassHeadName (PR #125326)

2025-02-01 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/125326 ___ 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-01-29 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 ClassHeadName to help annotating StartOfName (PR #124891)

2025-01-29 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/124891 ___ 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-01-29 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. 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] Fix annotating attrs in class/struct (PR #124634)

2025-01-28 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > (Why drop the formatting test? Seems good to have an integration test for > this, no?) Because the bug was a misannotation. The formatting, based on the annotations, should already be covered. Of course one can always add more tests, and I'm not demanding to remove

[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] Fix a TableGen crash on comment after l_paren (PR #124380)

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

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-24 Thread Björn Schäpers via cfe-commits
@@ -205,6 +205,12 @@ def main(): "commits" ), ) +p.add_argument( +"-0", +"--null", +action="store_true", +help="print the affected paths with null-terminated characters", HazardyKnusperkeks wrote: I t

  1   2   3   4   5   6   7   8   9   >