<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64705>64705</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang-format: [Regression] Constructor init list wrongly parsed
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JVApen
</td>
</tr>
</table>
<pre>
Formatting the init list of a constructor is no longer correct. It looks like it is formatting the argument as the constructor body instead.
Formatting in LLVM16 (Correct):
````
template<AAAAAAAAAAAAAAAAAAAAAAA bbbbbbbbbbbbbbb>
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC<bbbbbbbbbbbbbbb>::CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC()
: DDDDDDDDDDDDDDDDDDDDDDDDDDDDD<bbbbbbbbbbbbbbb>{EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE::EEEEEEEEEEEEEEEEEEEEEEEEEEEEE}
{
}
````
Formatting in LLVM17-RC2:
````
template<AAAAAAAAAAAAAAAAAAAAAAA bbbbbbbbbbbbbbb>
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC<bbbbbbbbbbbbbbb>::CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC()
: DDDDDDDDDDDDDDDDDDDDDDDDDDDDD<bbbbbbbbbbbbbbb>
{
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE::EEEEEEEEEEEEEEEEEEEEEEEEEEEEE
}
{
}
````
.clang-format
````
---
Language: Cpp
AccessModifierOffset: -3
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: true
AcrossEmptyLines: true
AcrossComments: true
AlignCompound: false
PadOperators: true
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
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: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: true
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Allman
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: true
ColumnLimit: 150
CommentPragmas: '^(\\|-).+'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 3
ContinuationIndentWidth: 6
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Leave
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: false
IndentPPDirectives: None
IndentRequiresClause: false
IndentWidth: 3
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: true
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 4
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
KeepEmptyLinesAtEOF: false
LambdaBodyIndentation: Signature
LineEnding: CRLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PackConstructorInitializers: Never
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right
PPIndentWidth: -1
QualifierAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: ''
BasedOnStyle: google
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: CaseInsensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: c++17
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 3
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...
````
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl1z4jrS_jXOjYsUmBCSi1wYY85hhgADzMx73htK2I3RiZA8kpyE_fVbkvwpm8zs1FZtbdW6MpmgftRqqVv9hZEQOKEAT85o4oymNyiTJ8afPn3zU6A3BxZfnmaMn5GUmCauPIGLKZYuwUK67OgiN2JUSJ5FknEXC5cylzCaAHcjxjlE8tadS5cw9iJcgl_AxVLBjk2eiCfZGah0kdCf60yVDC6mQgKKb53-1On75ndNLkzdxeLb8-DedbyHwCzseI_OMIc69_3qR49IOKcESXCGgd_9uIfm4wxDMzX41ccZBh08hr4z_Bd4eA9qI3ph1xn67vSjp3vF8ST8tcfI9jFkPM2PdDwp_pheO-QODY17m8D7n14qqctzdP-NSrIU8wuqMr9vI4Jo0jO38xq01-uZPxaIJhlKQG0_SFMz6EcRCPHMYnzEwFfHowCpAL1hTic4of5RAl-lQCccRS8GoAl1DOfosjputR_IOAgFWjIKNUzAqIAok_gVfO3IlBMRpXm5IUUHArGaWTxHRETOwnX9iDMhwnMqLwtMzRIdgICdC8YW2QhxTllG81Ua9DWKVylwJBnXkyXProg_wXKGgcQ14bukrxh0yl4jd4jeJNuifyh4Y2lb9ilEBHEkMaP_lWf_jNRKHx98nfVvSP4T0X__7LcnxmWABGwlkvAfMX8kIGDE6L5O19RQRCiFeAlvpFhhAUdZQ-i90jjfqu0FdhxhgmlSk6FY_TM2h-eTN3QRxejqFXhzR26_4EfYm0-InycbYkWX8C4VzrYPA1wjjs4ggYvVsWbjzWmNDRP2phUyISx6ESvqbzFNCBTYJbwCt7Hq_BboAKSN7-Qd0uz8i9BZRiN9K1vwOVXqsPHzY2VFvyb8Ap0PMWqDfUJaUMbSn8it9DjhgF50fJjCUeWamNENyIzT3SUFOwY0Z_wCbgJHxuE5I1KZFWwlxzRpW26J3-X5iOXj3L8gtzhfSo4PmWx7kZ6730coRQdMsLyY0QmmaxS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