Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang-format: Trailing return type formatting regression starting from v18 #105480

Closed
liarokapisv opened this issue Aug 21, 2024 · 1 comment · Fixed by #105923
Closed

Clang-format: Trailing return type formatting regression starting from v18 #105480

liarokapisv opened this issue Aug 21, 2024 · 1 comment · Fixed by #105923

Comments

@liarokapisv
Copy link

I get a formatting "regression" starting from clang-format v18

-    auto on_deactivate(rclcpp_lifecycle::State const & previous_state)
-        -> hardware_interface::CallbackReturn override;
+    auto on_deactivate(rclcpp_lifecycle::State const & previous_state
+    ) -> hardware_interface::CallbackReturn override;

-    auto register_group_bulk_write(Motor & m, std::vector<Motor *> & motor_write_list) const
-        -> bool;
+    auto
+    register_group_bulk_write(Motor & m, std::vector<Motor *> & motor_write_list) const -> +bool;

This is with IndentBlock on AlignAfterOpenBracket and I can't seem to be able to reproduce the previous formatting.

Config:

---
Language: Cpp
BasedOnStyle: LLVM

AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
AlignConsecutiveMacros: Consecutive
AlignEscapedNewlines: Left
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: None
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
  AfterCaseLabel: true
  AfterClass: true
  AfterControlStatement: Always
  AfterEnum: true
  AfterExternBlock: false
  AfterFunction: true
  AfterNamespace: false
  AfterStruct: true
  AfterUnion: true
  BeforeCatch: true
  BeforeElse: true
  BeforeLambdaBody: false
  BeforeWhile: true
  IndentBraces: false
  SplitEmptyFunction: true
  SplitEmptyRecord: true
  SplitEmptyNamespace: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: false
ColumnLimit: 100
CompactNamespaces: true
IncludeBlocks: Regroup
IndentCaseLabels: true
IndentPPDirectives: BeforeHash
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
PackConstructorInitializers: CurrentLine
PenaltyBreakAssignment: 10
PenaltyBreakComment: 10
PointerAlignment: Middle
QualifierAlignment: Right
ReferenceAlignment: Middle
SeparateDefinitionBlocks: Always
SpacesInContainerLiterals: false
Standard: c++17
TabWidth: 4
...
@rymiel
Copy link
Member

rymiel commented Aug 21, 2024

I think this is related #91771, as this issue is also bisected to e00d32a

After ccae7b4, the formatting is now this:

    auto on_deactivate(rclcpp_lifecycle::State const & previous_state)
        -> hardware_interface::CallbackReturn override;

    auto
    register_group_bulk_write(Motor & m, std::vector<Motor *> & motor_write_list) const -> bool;

It's better, but still different, though. Probably has to do with changes to SplitPenalty as mentioned in #91771

@owenca owenca self-assigned this Aug 22, 2024
owenca added a commit to owenca/llvm-project that referenced this issue Aug 22, 2024
owenca added a commit to owenca/llvm-project that referenced this issue Aug 24, 2024
…m#70519)"

This reverts commit e00d32a and adds a test
for lambda arrow SplitPenalty.

Fixes llvm#105480.
owenca added a commit that referenced this issue Aug 29, 2024
#105923)

…519)"

This reverts commit e00d32a and adds a
test for lambda arrow SplitPenalty.

Fixes #105480.
owenca added a commit to owenca/llvm-project that referenced this issue Aug 29, 2024
llvm#105923)

…519)"

This reverts commit e00d32a and adds a
test for lambda arrow SplitPenalty.

Fixes llvm#105480.
5c4lar pushed a commit to 5c4lar/llvm-project that referenced this issue Aug 29, 2024
llvm#105923)

…519)"

This reverts commit e00d32a and adds a
test for lambda arrow SplitPenalty.

Fixes llvm#105480.
tru pushed a commit that referenced this issue Sep 1, 2024
#105923)

…519)"

This reverts commit e00d32a and adds a
test for lambda arrow SplitPenalty.

Fixes #105480.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment