Issue 109768
Summary clang-format - function declaration incorrect formatting
Labels clang-format
Assignees
Reporter robert-andrzejuk
    Is:

 int function_name(HWND*          parent,
                      int id,
                      const wchar_t* title,
 int            x       = 0,
                      int y = 0,
                      int w                  = 0,
 int h                  = 0,
                      long extraStyle = 0,
                      bool readOnly          = false,
 FancyClassType* module = nullptr);


Expected:

 int function_name(HWND*           parent,
                      int id,
                      const wchar_t*  title,
 int             x          = 0,
                      int y          = 0,
                      int             w          = 0,
                      int             h          = 0,
 long            extraStyle = 0,
                      bool readOnly   = false,
                      FancyClassType* module     = nullptr);


Clang-format file:
```
  # LLVM version 18
 
  Language: Cpp
  AccessModifierOffset: -4
  AlignAfterOpenBracket: Align
  AlignArrayOfStructures: Right
 AlignConsecutiveAssignments:
    Enabled: true
    AcrossEmptyLines: false
    AcrossComments: true
    AlignCompound: true
 AlignFunctionPointers: true
    PadOperators: true
 AlignConsecutiveBitFields:
    Enabled: true
    AcrossEmptyLines: false
    AcrossComments: true
    AlignCompound: true
 AlignFunctionPointers: true
    PadOperators: false
 AlignConsecutiveDeclarations:
    Enabled: true
    AcrossEmptyLines: false
    AcrossComments: true
    AlignCompound: true
 AlignFunctionPointers: true
    PadOperators: false
 AlignConsecutiveMacros:
    Enabled: true
    AcrossEmptyLines: false
    AcrossComments: true
    AlignCompound: true
 AlignFunctionPointers: true
    PadOperators: false
 AlignConsecutiveShortCaseStatements:
    Enabled:         true
 AcrossEmptyLines: false
    AcrossComments:  false
    AlignCaseColons: false
  AlignEscapedNewlines: Left
  AlignOperands: Align
 AlignTrailingComments:
    Kind:            Always
    OverEmptyLines: 0
  AllowAllArgumentsOnNextLine: false
 #AllowAllConstructorInitializersOnNextLine: false #depracated
 AllowAllParametersOfDeclarationOnNextLine: false
 AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
 AllowShortBlocksOnASingleLine: Never
  AllowShortCaseLabelsOnASingleLine: false
  AllowShortCompoundRequirementOnASingleLine: true
 AllowShortEnumsOnASingleLine: false
  AllowShortFunctionsOnASingleLine: None
  AllowShortIfStatementsOnASingleLine: Never
 AllowShortLambdasOnASingleLine: Inline
  AllowShortLoopsOnASingleLine: false
  AlwaysBreakAfterDefinitionReturnType: None
 AlwaysBreakAfterReturnType: None
  AlwaysBreakBeforeMultilineStrings: false
  AlwaysBreakTemplateDeclarations: Yes
  AttributeMacros:
 - __capability
  BinPackArguments: false
  BinPackParameters: false
 BitFieldColonSpacing: Both
  BraceWrapping:
    AfterCaseLabel: true
    AfterClass: true
    AfterControlStatement: Always
 AfterEnum: true
    AfterExternBlock: true
    AfterFunction: true
 AfterNamespace: false
    AfterObjCDeclaration: true
    AfterStruct: true
    AfterUnion: true
    BeforeCatch: true
    BeforeElse: true
    BeforeLambdaBody: true
    BeforeWhile: false
 IndentBraces: false
    SplitEmptyFunction: false
    SplitEmptyRecord: false
    SplitEmptyNamespace: false
  BreakAdjacentStringLiterals: true
  BreakAfterAttributes: Leave
  BreakAfterJavaFieldAnnotations: false
  BreakArrays:     true
  BreakBeforeBinaryOperators: NonAssignment
  BreakBeforeConceptDeclarations: Always
 BreakBeforeBraces: Custom
  BreakBeforeInlineASMColon: OnlyMultiline
 BreakBeforeTernaryOperators: true
  BreakConstructorInitializers: BeforeColon
  BreakInheritanceList: AfterComma
  BreakStringLiterals: false
  ColumnLimit: 120
  CommentPragmas: "^ IWYU pragma:"
 CompactNamespaces: true
  #ConstructorInitializerAllOnOneLineOrOnePerLine: false #depracated
  ConstructorInitializerIndentWidth: 6
 ContinuationIndentWidth: 6
  Cpp11BracedListStyle: false
 DerivePointerAlignment: false
  DisableFormat: false
 EmptyLineAfterAccessModifier: Never
  EmptyLineBeforeAccessModifier: Always
  ExperimentalAutoDetectBinPacking: false
 FixNamespaceComments: true
  ForEachMacros:
    - foreach
    - Q_FOREACH
    - BOOST_FOREACH
  IfMacros:
    - KJ_IF_MAYBE
 IncludeBlocks: Preserve
  IncludeCategories:
    - Regex: '\"stdafx.h\"|\"StdAfx.h\"'
      Priority: -1
 SortPriority: 0
      CaseSensitive: false
    - Regex: ".*"
 Priority: 2
      SortPriority: 0
      CaseSensitive: false
    - Regex: '\<cstdlib\>|\<csignal\>|\<csetjmp\>|\<cstdarg\>|\<typeinfo\>|\<typeindex\>|\<type_traits\>|\<bitset\>|\<functional\>|\<utility\>|\<ctime\>|\<chrono\>|\<cstddef\>|\<initializer_list\>|\<tuple\>|\<any\>|\<optional\>|\<new\>|\<memory\>|\<scoped_allocator\>|\<memory_resource\>|\<climits\>|\<cfloat\>|\<cstdint\>|\<cinttypes\>|\<limits\>|\<exception\>|\<exception_list\>|\<stdexcept\>|\<cassert\>|\<system_error\>|\<cerrno\>|\<cctype\>|\<cwctype\>|\<cstring\>|\<cwchar\>|\<cuchar\>|\<string\>|\<string_view\>|\<array\>|\<vector\>|\<deque\>|\<list\>|\<forward_list\>|\<set\>|\<map\>|\<unordered_set\>|\<unordered_map\>|\<stack\>|\<queue\>|\<algorithm\>|\<execution_policy\>|\<iterator\>|\<cmath\>|\<complex\>|\<valarray\>|\<random\>|\<numeric\>|\<ratio\>|\<cfenv\>|\<iosfwd\>|\<ios\>|\<istream\>|\<ostream\>|\<iostream\>|\<fstream\>|\<sstream\>|\<strstream\>|\<iomanip\>|\<streambuf\>|\<cstdio\>|\<locale\>|\<clocale\>|\<codecvt\>|\<regex\>|\<atomic\>|\<thread\>|\<mutex\>|\<shared_mutex\>|\<future\>|\<condition_variable\>|\<filesystem\>|\<ciso646\>|\<ccomplex\>|\<ctgmath\>|\<cstdalign\>|\<cstdbool\>'
 Priority: 3
      SortPriority: 0
      CaseSensitive: false
 - Regex: '\<sys\/|\<unistd.h\>|\<fcntl.h>|\<poll.h\>'
 Priority: 4
      SortPriority: 0
      CaseSensitive: false
    - Regex: '\<gmock|\<gtest|\<log'
      Priority: 5
      SortPriority: 0
      CaseSensitive: false
  IncludeIsMainRegex: "(Test)?$"
 IncludeIsMainSourceRegex: ""
  IndentAccessModifiers: false
 IndentCaseBlocks: false
  IndentCaseLabels: true
  IndentExternBlock: Indent
  IndentGotoLabels: false
  IndentPPDirectives: BeforeHash
 IndentRequiresClause: true
  IndentWidth: 4
 IndentWrappedFunctionNames: true
  InsertBraces: true
 InsertNewlineAtEOF: true
  InsertTrailingCommas: None
 #IntegerLiteralSeparator:
  #  Binary:           4
  # BinaryMinDigits:  6
  #  Decimal:          3
  #  DecimalMinDigits: 5
  #  Hex:              4
  #  HexMinDigits:     4
 _javascript_Quotes: Leave
  _javascript_WrapImports: true
 KeepEmptyLinesAtTheStartOfBlocks: false
  KeepEmptyLinesAtEOF: false
 LambdaBodyIndentation: Signature
  LineEnding:      DeriveCRLF
 MacroBlockBegin: "DEFINE_RESPONSE_TABLE1|BEGIN_COM_MAP"
  MacroBlockEnd: "END_RESPONSE_TABLE|END_COM_MAP"
  MaxEmptyLinesToKeep: 2
 NamespaceIndentation: None
  ObjCBinPackProtocolList: Auto
 ObjCBlockIndentWidth: 2
  ObjCBreakBeforeNestedBlockParam: true
 ObjCSpaceAfterProperty: false
  ObjCSpaceBeforeProtocolList: true
 PackConstructorInitializers: Never
  PenaltyBreakAssignment: 200
 PenaltyBreakBeforeFirstCallParameter: 200
  PenaltyBreakComment: 30000
 PenaltyBreakFirstLessLess: 150
  PenaltyBreakOpenParenthesis: 100
 PenaltyBreakScopeResolution: 500
  PenaltyBreakString: 1000
 PenaltyBreakTemplateDeclaration: 10
  PenaltyExcessCharacter: 100
 PenaltyIndentedWhitespace: 0
  PenaltyReturnTypeOnItsOwnLine: 500
 PointerAlignment: Left
  PPIndentWidth: 2
  QualifierAlignment: Leave
  #QualifierOrder: ['inline', 'static', 'const', 'type', 'volatile' ]
  ReferenceAlignment: Left
  ReflowComments: false
 RemoveBracesLLVM: false
  RemoveParentheses: Leave
  RemoveSemicolon: true
  RequiresClausePosition: OwnLine
  RequiresExpressionIndentation: Keyword
  SeparateDefinitionBlocks: Leave
  ShortNamespaceLines: 40
 SkipMacroDefinitionBody: false
  SortIncludes: Never
 SortJavaStaticImport: Before
  SortUsingDeclarations: LexicographicNumeric
  SpaceAfterCStyleCast: false
 SpaceAfterLogicalNot: false
  SpaceAfterTemplateKeyword: false
 SpaceAroundPointerQualifiers: Default
  SpaceBeforeAssignmentOperators: true
  SpaceBeforeCaseColon: false
  SpaceBeforeCpp11BracedList: true
  SpaceBeforeCtorInitializerColon: true
 SpaceBeforeInheritanceColon: true
  SpaceBeforeJsonColon: true
 SpaceBeforeParens: Custom
  SpaceBeforeParensOptions:
 AfterControlStatements: true
    AfterForeachMacros: true
 AfterFunctionDefinitionName: false
    AfterFunctionDeclarationName: false
    AfterIfMacros: true
    AfterOverloadedOperator: false
 AfterPlacementOperator: true
    AfterRequiresInClause: true
 AfterRequiresInExpression: true
    BeforeNonEmptyParentheses: false
 SpaceBeforeRangeBasedForLoopColon: true
  SpaceBeforeSquareBrackets: false
  SpaceInEmptyBlock: false
  SpacesBeforeTrailingComments: 1
 SpacesInAngles: Never
  SpacesInContainerLiterals: false
 SpacesInLineCommentPrefix:
    Minimum: 1
    Maximum: -1
 SpacesInParens:  Custom
  SpacesInParensOptions:
    InCStyleCasts: true
    InConditionalStatements: false
    InEmptyParentheses: false
    Other:           false
  SpacesInSquareBrackets: false
 Standard: Latest
  StatementAttributeLikeMacros:
    - Q_EMIT
 StatementMacros:
    - Q_UNUSED
    - QT_REQUIRE_VERSION
    - "EV.*,"
    - EV_WM_SIZE,
    - EV_WM_DESTROY,
    - _STD_BEGIN
    - _STD_END
    - _STDEXT_BEGIN
    - _STDEXT_END
 - _EXTERN_C
    - _END_EXTERN_C
    - _EXTERN_C_UNLESS_PURE
    - _END_EXTERN_C_UNLESS_PURE
    - COM_INTERFACE_ENTRY
  TabWidth: 4
 UseTab: Never
  VerilogBreakBetweenInstancePorts: true
 WhitespaceSensitiveMacros:
    - STRINGIZE
    - PP_STRINGIZE
    - BOOST_PP_STRINGIZE
    - NS_SWIFT_NAME
    - CF_SWIFT_NAME
 

```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to