Skip to content

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

Closed
@liarokapisv

Description

@liarokapisv

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
...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions