Skip to content

[clang-format] Method calling parameters end on another line #167511

@xlazom00

Description

@xlazom00

I do have C++ code that looks like this

  Test(6 +
       9, 10, 11);

  UserError("Error message name",
            "Error message text, "
            "text", true, true);

And after format it looks like this

  UserError(6 +
              9,
            10, 11);

  UserError("Error message name",
            "Error message text, "
            "text",
            true, true);

I don't understand why parameters "10, 11" and "true, true" will end on another line. It looks like bug to me as another paramer works fine.
Tested on 21.1.5

I do need to have ColumnLimit: '0'
as I want to keep original formating in files as much as possible and we use formating like this

if (crtCert->GetCertificate(qryUzivCert->FieldByName("SUBJECT")->AsString(),
                            qryUzivCert->FieldByName("ISSUER")->AsString(),
                            qryUzivCert->FieldByName("SERIAL")->AsString(),
                            fCertInfo))

my .clang-format file

BasedOnStyle: 'Microsoft'
#AlignAfterOpenBracket: 'DontAlign'
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
AlignEscapedNewlines: 'Left'
AlignTrailingComments: 'false'
AllowAllArgumentsOnNextLine: 'true'
#AllowAllConstructorInitializersOnNextLine: 'false'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'false'
#AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: Empty
#AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakAfterDefinitionReturnType: 'None'
AlwaysBreakAfterReturnType: 'None'
AlwaysBreakBeforeMultilineStrings: 'false'
AlwaysBreakTemplateDeclarations: 'Yes'
BinPackArguments: 'true'
BinPackParameters: 'true'
BreakBeforeBraces: 'Custom'
BraceWrapping:
  AfterCaseLabel: 'false'
  AfterClass: 'true'
  AfterControlStatement: 'MultiLine'
  AfterEnum: 'true'
  AfterFunction: 'true'
  AfterNamespace: 'true'
  AfterStruct: 'true'
  AfterUnion: 'true'
  AfterExternBlock: 'true'
#  BeforeCatch: 'false'
  BeforeCatch: 'true'  
#  BeforeElse: 'false'
  BeforeElse: 'true'
  BeforeLambdaBody: 'false'
  BeforeWhile: 'false'
  IndentBraces: 'false'
  SplitEmptyFunction: 'true'
  SplitEmptyRecord: 'true'
  SplitEmptyNamespace: 'true'
#BreakConstructorInitializers: 'AfterColon'
BreakInheritanceList: 'AfterColon'
#BreakStringLiterals: 'false'
#ColumnLimit: '80'
CompactNamespaces: 'false'
Cpp11BracedListStyle: 'false'
#ConstructorInitializerIndentWidth: 4
#ContinuationIndentWidth: 4
DerivePointerAlignment: 'false'
#EmptyLineBeforeAccessModifier: 'Never'
FixNamespaceComments: 'true'
IncludeBlocks: 'Merge'
IndentCaseLabels: 'true'
IndentExternBlock: 'true'
IndentGotoLabels: 'false'
IndentPPDirectives: 'BeforeHash'
#IndentWidth: '4'
IndentWrappedFunctionNames: 'true'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
Language: 'Cpp'
MacroBlockBegin: '^(BEGIN_MESSAGE_MAP|BEGIN_INTERFACE)'
MacroBlockEnd: '^(END_MESSAGE_MAP|END_INTERFACE)'
MaxEmptyLinesToKeep: '1'
NamespaceIndentation: 'All'
#PointerAlignment: 'Left'
ReferenceAlignment: 'Right'
#ReflowComments: 'false'
SortIncludes: 'false'
SortUsingDeclarations: 'false'
SpaceAfterCStyleCast: 'false'
SpaceAfterLogicalNot: 'false'
SpaceAfterTemplateKeyword: 'false'
SpaceAroundPointerQualifiers: 'Default'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCaseColon: 'false'
SpaceBeforeCpp11BracedList: 'true'
SpaceBeforeCtorInitializerColon: 'true'
SpaceBeforeInheritanceColon: 'true'
SpaceBeforeParens: 'ControlStatements'
SpaceBeforeRangeBasedForLoopColon: 'true'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpaceInEmptyParentheses: 'false'
SpacesInConditionalStatement: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: 'Cpp03'
#TabWidth: '4'
UseCRLF: 'true'
UseTab: 'Never'

# medical4 modifications
PointerAlignment: 'Right'
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
ColumnLimit: '0'
IndentWidth: '2'
TabWidth: '2'
EmptyLineBeforeAccessModifier: 'Leave'
AllowAllConstructorInitializersOnNextLine: 'true'
AlignAfterOpenBracket: 'Align'
BreakConstructorInitializers: 'BeforeColon'
PackConstructorInitializers: 'NextLine'
AllowShortCaseLabelsOnASingleLine: 'true'
BreakStringLiterals: 'true'
AlignOperands: 'DontAlign'
AllowShortIfStatementsOnASingleLine: 'AllIfsAndElse'
BreakBeforeBinaryOperators: 'None'
ExperimentalAutoDetectBinPacking: 'true'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions