[clang] [clang-format] Handle .h files for LK_C and LK_ObjC (PR #141714)

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

[clang] [clang-format] Stop moving lambda to new line only to indent it more. (PR #141576)

2025-05-27 Thread Björn Schäpers via cfe-commits
@@ -23814,6 +23814,20 @@ TEST_F(FormatTest, FormatsLambdas) { "}", LLVMWithBeforeLambdaBody); + // Make sure we don't put the lambda on a new line when it would be indented HazardyKnusperkeks wrote: I think you can drop the comm

[clang] [clang-format] Stop moving lambda to new line only to indent it more. (PR #141576)

2025-05-27 Thread Björn Schäpers via cfe-commits
@@ -325,13 +325,30 @@ bool ContinuationIndenter::canBreak(const LineState &State) { if (Current.isMemberAccess() && CurrentState.ContainsUnwrappedBuilder) return false; - // Don't create a 'hanging' indent if there are multiple blocks in a single - // statement and we

[clang] [clang-format] Stop moving lambda to new line only to indent it more. (PR #141576)

2025-05-27 Thread Björn Schäpers via cfe-commits
@@ -23814,6 +23814,20 @@ TEST_F(FormatTest, FormatsLambdas) { "}", LLVMWithBeforeLambdaBody); + // Make sure we don't put the lambda on a new line when it would be indented + // more than where it would be otherwise. + verifyFormat("if ([]()\n"

[clang] [clang-format] Handle Java text blocks (PR #141334)

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

[clang] [clang-format] Handle Java text blocks (PR #141334)

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

[clang] [clang-format][NFC] FormatTokenLexer.cpp cleanup (PR #141202)

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

[clang] [clang-format][NFC] Minor efficiency cleanup (PR #140835)

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

[clang] clang-format: Add IncludeSortKey option (PR #137840)

2025-05-20 Thread Björn Schäpers via cfe-commits
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave; LLVMStyle.ShortNamespaceLines = 1; LLVMStyle.SkipMacroDefinitionBody = false; - LLVMStyle.SortIncludes = {/*Enabled=*/true,

[clang] [clang-format] Add IndentPPDirectives Leave option (PR #139750)

2025-05-19 Thread Björn Schäpers via cfe-commits
@@ -1142,7 +1144,8 @@ void UnwrappedLineParser::parsePPEndIf() { // If the #endif of a potential include guard is the last thing in the file, // then we found an include guard. if (IncludeGuard == IG_Defined && PPBranchLevel == -1 && Tokens->isEOF() && - Style.Indent

[clang] [clang-format] Merge short inline function in macro definition body (PR #140366)

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

[clang] [clang-format] Fix the indent of StartOfName after AttributeMacro (PR #140361)

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

[clang] [clang-format][NFC] Upgrade SortIncludes option to a struct (PR #140497)

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

[clang] clang-format: Add IncludeSortKey option (PR #137840)

2025-05-19 Thread Björn Schäpers via cfe-commits
@@ -152,6 +152,10 @@ struct IncludeStyle { /// \version 10 std::string IncludeIsMainSourceRegex; + /// When sorting includes in each block, ignore file extensions. HazardyKnusperkeks wrote: I currently don't have a better name, but this isn't correct. Yo

[clang] clang-format: Add IncludeSortKey option (PR #137840)

2025-05-19 Thread Björn Schäpers via cfe-commits
@@ -5368,6 +5368,8 @@ struct FormatStyle { IncludeStyle.IncludeIsMainSourceRegex == R.IncludeStyle.IncludeIsMainSourceRegex && IncludeStyle.MainIncludeChar == R.IncludeStyle.MainIncludeChar && + IncludeStyle.IncludeSortIgnoreExtens

[clang] [clang-format] Handle C# where clause in SeparateDefinitionBlocks (PR #139034)

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

[clang] [clang-format] Don't annotate enum colon as InheritanceColon (PR #138440)

2025-05-06 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/138440 ___ 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 binary operator && (PR #138633)

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

[clang] [clang-format] Correctly annotate C# nullable value type `?` (PR #138631)

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

[clang] [clang-format] Don't annotate enum colon as InheritanceColon (PR #138440)

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

[clang] [clang-format] Don't annotate enum colon as InheritanceColon (PR #138440)

2025-05-04 Thread Björn Schäpers via cfe-commits
@@ -1423,7 +1423,7 @@ class AnnotatingParser { Tok->setType(TT_BitFieldColon); } else if (Contexts.size() == 1 && !Line.First->isOneOf(tok::kw_enum, tok::kw_case, - tok::kw_default)) { +

[clang] [clang-format] Correctly annotate tok::star in braced list (PR #138389)

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

[clang] [clang-format] Fix a crash on formatting missing r_paren/r_brace (PR #138230)

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

[clang] [clang-format] RemoveParentheses shouldn't remove empty parentheses (PR #138229)

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

[clang] clang-format: Add IncludeSortKey option (PR #137840)

2025-05-01 Thread Björn Schäpers via cfe-commits
@@ -166,6 +166,16 @@ struct IncludeStyle { /// directives that use the specified character are considered. /// \version 19 MainIncludeCharDiscriminator MainIncludeChar; + + enum IncludeSortKeyDiscriminator : int8_t { +/// Includes are sorted alphabetically by their f

[clang] clang-format: Add IncludeSortKey option (PR #137840)

2025-05-01 Thread Björn Schäpers via cfe-commits
@@ -4226,6 +4226,19 @@ the configuration (without a prefix: ``Auto``). ``ClassImpl.hpp`` would not have the main include file put on top before any other include. +.. _IncludeSortKey: + +**IncludeSortKey** (``IncludeSortKeyDiscriminator``) :versionbadge:`clang-format 20`

[clang] clang-format: Add IncludeSortKey option (PR #137840)

2025-05-01 Thread Björn Schäpers via cfe-commits
@@ -4226,6 +4226,19 @@ the configuration (without a prefix: ``Auto``). ``ClassImpl.hpp`` would not have the main include file put on top before any other include. +.. _IncludeSortKey: HazardyKnusperkeks wrote: Did you write this on your own? You need to d

[clang] clang-format: Add IncludeSortKey option (PR #137840)

2025-05-01 Thread Björn Schäpers via cfe-commits
@@ -166,6 +166,16 @@ struct IncludeStyle { /// directives that use the specified character are considered. /// \version 19 MainIncludeCharDiscriminator MainIncludeChar; + + enum IncludeSortKeyDiscriminator : int8_t { HazardyKnusperkeks wrote: Can you so

[clang] clang-format: Add IncludeSortKey option (PR #137840)

2025-05-01 Thread Björn Schäpers via cfe-commits
@@ -4226,6 +4226,19 @@ the configuration (without a prefix: ``Auto``). ``ClassImpl.hpp`` would not have the main include file put on top before any other include. +.. _IncludeSortKey: + +**IncludeSortKey** (``IncludeSortKeyDiscriminator``) :versionbadge:`clang-format 20`

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

2025-04-30 Thread Björn Schäpers via cfe-commits
@@ -5283,6 +5299,7 @@ struct FormatStyle { bool operator==(const FormatStyle &R) const { return AccessModifierOffset == R.AccessModifierOffset && AlignAfterOpenBracket == R.AlignAfterOpenBracket && + AlignAfterControlStatement == R.AlignAfterControlSt

[clang] clang-format: Sort includes by stem rather than full filename (PR #137840)

2025-04-30 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > > You definitely need some tests. And I'm not sure if everyone would like > > that, of if it should be an option. > > I was hoping to get some feedback on whether it should be an option or not > before adding tests. I would be in favor. https://github.com/llvm/llv

[clang] clang-format: Sort includes by stem rather than full filename (PR #137840)

2025-04-30 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks commented: How do you think should files be handled, that only differ in the caseness of the extension? https://github.com/llvm/llvm-project/pull/137840 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[clang] [clang-format] Add SpaceAfterOperatorKeyword option (PR #137610)

2025-04-30 Thread Björn Schäpers via cfe-commits
@@ -4463,6 +4463,14 @@ struct FormatStyle { /// \version 9 bool SpaceAfterLogicalNot; + /// If \c true, a space will be inserted after the ``operator`` keyword. + /// \code + ///true:false: + ///bool operator == (int a) vs.

[clang] [clang-format] Add SpaceAfterOperatorKeyword option (PR #137610)

2025-04-30 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. From the technical point of view this is fine (given the version number is corrected). Please wait for feedback from @mydeveloperday . https://github.com/llvm/llvm-project/pull/137610 _

[clang] [clang-format] Add SpaceAfterOperatorKeyword option (PR #137610)

2025-04-30 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks edited https://github.com/llvm/llvm-project/pull/137610 ___ 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 function call (PR #137914)

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

[clang] [clang-format] Add SpaceAfterOperatorKeyword option (PR #137610)

2025-04-29 Thread Björn Schäpers via cfe-commits
@@ -1153,6 +1153,8 @@ template <> struct MappingTraits { IO.mapOptional("SpaceAfterLogicalNot", Style.SpaceAfterLogicalNot); IO.mapOptional("SpaceAfterTemplateKeyword", Style.SpaceAfterTemplateKeyword); +IO.mapOptional("SpaceAfterOperatorKeyword",

[clang] [clang-format] Add SpaceAfterOperatorKeyword option (PR #137610)

2025-04-29 Thread Björn Schäpers via cfe-commits
@@ -5433,6 +5441,7 @@ struct FormatStyle { SpaceAfterCStyleCast == R.SpaceAfterCStyleCast && SpaceAfterLogicalNot == R.SpaceAfterLogicalNot && SpaceAfterTemplateKeyword == R.SpaceAfterTemplateKeyword && + SpaceAfterOperatorKeyword == R

[clang] [clang-format] Add SpaceAfterOperatorKeyword option (PR #137610)

2025-04-29 Thread Björn Schäpers via cfe-commits
@@ -1639,6 +1641,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { LLVMStyle.SpaceAfterCStyleCast = false; LLVMStyle.SpaceAfterLogicalNot = false; LLVMStyle.SpaceAfterTemplateKeyword = true; + LLVMStyle.SpaceAfterOperatorKeyword = false; --

[clang] clang-format: Sort includes by stem rather than full filename (PR #137840)

2025-04-29 Thread Björn Schäpers via cfe-commits
@@ -3219,17 +3219,19 @@ static void sortCppIncludes(const FormatStyle &Style, if (Style.SortIncludes == FormatStyle::SI_CaseInsensitive) { stable_sort(Indices, [&](unsigned LHSI, unsigned RHSI) { - const auto LHSFilenameLower = Includes[LHSI].Filename.lower(); -

[clang] clang-format: Sort includes by stem rather than full filename (PR #137840)

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

[clang] clang-format: Sort includes by stem rather than full filename (PR #137840)

2025-04-29 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks commented: You definitely need some tests. And I'm not sure if everyone would like that, of if it should be an option. https://github.com/llvm/llvm-project/pull/137840 ___ cfe-commits mailing list cfe-commits@list

[clang] [clang-format] Add OneLineFormatOffRegex option (PR #137577)

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

[clang] [clang-format] Add OneLineFormatOffRegex option (PR #137577)

2025-04-28 Thread Björn Schäpers via cfe-commits
@@ -24954,6 +24954,82 @@ TEST_F(FormatTest, DisableRegions) { "// clang-format on"); } +TEST_F(FormatTest, OneLineFormatOffRegex) { + auto Style = getLLVMStyle(); + Style.OneLineFormatOffRegex = "// format off$"; + + verifyFormat("// format off\n" +

[clang] [clang-format] Add OneLineFormatOffRegex option (PR #137577)

2025-04-28 Thread Björn Schäpers via cfe-commits
@@ -83,8 +83,42 @@ FormatTokenLexer::FormatTokenLexer( ArrayRef FormatTokenLexer::lex() { assert(Tokens.empty()); assert(FirstInLineIndex == 0); + const llvm::Regex FormatOffRegex(Style.OneLineFormatOffRegex); + enum { FO_None, FO_CurrentLine, FO_NextLine } FormatOff = FO

[clang] [clang-format] Add SpaceAfterOperatorKeyword option (PR #137610)

2025-04-28 Thread Björn Schäpers via cfe-commits
@@ -17630,6 +17630,13 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeParens) { verifyFormat("int x = int (y);", SomeSpace2); verifyFormat("auto lambda = []() { return 0; };", SomeSpace2); + FormatStyle SpaceAfterOperatorKeyword = getLLVMStyle(); + SpaceAfterOperatorKeyword

[clang] [clang-format] Add SpaceAfterOperatorKeyword option (PR #137610)

2025-04-28 Thread Björn Schäpers via cfe-commits
@@ -4471,6 +4471,14 @@ struct FormatStyle { /// \version 4 bool SpaceAfterTemplateKeyword; + /// If \c true, a space will be inserted after the ``operator`` keyword. + /// \code + ///true:false: + ///bool operator == (int a)

[clang] clang-format: Add -disable-format option (PR #137617)

2025-04-28 Thread Björn Schäpers via cfe-commits
@@ -506,8 +512,11 @@ static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) { // Get new affected ranges after sorting `#includes`. Ranges = tooling::calculateRangesAfterReplacements(Replaces, Ranges); FormattingAttemptStatus Status; - Replacements

[clang] [clang-format] Add ApplyAlwaysOnePerLineToTemplateArguments option (PR #137544)

2025-04-27 Thread Björn Schäpers via cfe-commits
@@ -2074,6 +2087,7 @@ class AnnotatingParser { if (ctx.ContextType == Context::StructArrayInitializer) return LT_ArrayOfStructInitializer; +markTokenAsTemplateArgumentInLine(); HazardyKnusperkeks wrote: I think you want this before the prece

[clang] [clang-format] Add ApplyAlwaysOnePerLineToTemplateArguments option (PR #137544)

2025-04-27 Thread Björn Schäpers via cfe-commits
@@ -186,6 +186,9 @@ class AnnotatedLine { bool MightBeFunctionDecl; bool IsMultiVariableDeclStmt; + /// \c True if this token is part o a template declaration. + bool InTemplateDecl = false; HazardyKnusperkeks wrote: A leftover? https://github.com/llvm

[clang] [clang-format] Add ApplyAlwaysOnePerLineToTemplateArguments option (PR #137544)

2025-04-27 Thread Björn Schäpers via cfe-commits
@@ -444,6 +444,66 @@ TEST_F(FormatTestComments, UnderstandsBlockComments) { " int jjj; /*b*/"); } +TEST_F(FormatTestComments, HazardyKnusperkeks wrote: What's your reason for this test? You didn't change anything comment related, right?

[clang] [clang-format] Add ApplyAlwaysOnePerLineToTemplateArguments option (PR #137544)

2025-04-27 Thread Björn Schäpers via cfe-commits
@@ -1259,6 +1259,45 @@ struct FormatStyle { /// \version 3.7 BinPackParametersStyle BinPackParameters; + /// If ``BinPackParameters`` is set to ``AlwaysOnePerLine``, specifies whether HazardyKnusperkeks wrote: Add a reference on `BinPackParameters` to t

[clang] [clang-format] Add ApplyAlwaysOnePerLineToTemplateArguments option (PR #137544)

2025-04-27 Thread Björn Schäpers via cfe-commits
@@ -5326,6 +5365,8 @@ struct FormatStyle { BinPackArguments == R.BinPackArguments && BinPackLongBracedList == R.BinPackLongBracedList && BinPackParameters == R.BinPackParameters && + ApplyAlwaysOnePerLineToTemplateArguments ==

[clang] [clang-format] Add ApplyAlwaysOnePerLineToTemplateArguments option (PR #137544)

2025-04-27 Thread Björn Schäpers via cfe-commits
@@ -9024,6 +9024,55 @@ TEST_F(FormatTest, FormatsDeclarationBreakAlways) { BreakAlways); } +TEST_F(FormatTest, ApplyAlwaysOnePerLineToTemplateArguments) { + FormatStyle Style = getGoogleStyle(); HazardyKnusperkeks wrote: Why google style? https://gith

[clang] [clang-format] Add ApplyAlwaysOnePerLineToTemplateArguments option (PR #137544)

2025-04-27 Thread Björn Schäpers via cfe-commits
@@ -1259,6 +1259,45 @@ struct FormatStyle { /// \version 3.7 BinPackParametersStyle BinPackParameters; + /// If ``BinPackParameters`` is set to ``AlwaysOnePerLine``, specifies whether + /// template argument lists should also be split across multiple lines. + /// + //

[clang] [clang-format] Annotate tok::star in a*b*c as BinaryOperator (PR #137433)

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

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

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

[clang] [clang-format] Correctly identify include guards (PR #137112)

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

[clang] [clang-format] Don't test stability if JS format test fails (PR #136662)

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

[clang] [clang-format] Correctly annotate kw_operator in using decls (PR #136545)

2025-04-22 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/136545 ___ 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 parsing C-style cast of lambdas (PR #136099)

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

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

2025-04-18 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/136073 ___ 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 parsing C-style cast lambda (PR #136099)

2025-04-18 Thread Björn Schäpers via cfe-commits
@@ -2371,7 +2371,8 @@ bool UnwrappedLineParser::tryToParseLambdaIntroducer() { if ((Previous && ((Previous->Tok.getIdentifierInfo() && !Previous->isOneOf(tok::kw_return, tok::kw_co_await, tok::kw_co_yield, tok::kw_c

[clang] [clang-format] Fix a crash in EnumTrailingComma (PR #135903)

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

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

[clang] [clang-format] Fix a crash in EnumTrailingComma (PR #135903)

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

[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

  1   2   3   4   5   6   7   8   9   10   >