<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68798>68798</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Trailing macro backslashes formatted wrong at closing curly brackets
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
martin-ebner
</td>
</tr>
</table>
<pre>
```
#define STRUCT_MACRO \
struct1 s1 = {.structElement1 = {.subStructElement1 = someValue11, \
subStructElement2 = someValue12, \
subStructElement3 = someValue13, \
subStructElement4 = someValue14}, \
.structElement2 = someValue2}
#define STRUCT_MACRO2 \
struct2 s2 = {.structElement1 = {.subStructElement1 = someValue11, \
subStructElement2 = {.subSubStructElement1 = someValue121, \
.subSubStructElement2 = someValue122, \
.subSubStructElement3 = someValue123}}, \
.structElement2 = someValue2}
```
These macros are formatted wrong in the line where the sub-struct ends with a closing curly bracket and a comma.
Occurs at clang-format versions:
clang-format version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6)
clang-format version 10.0.0
Used .clang-format file is:
```
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 125
CommentPragmas: '(\|.*\|)'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(json)/)'
Priority: 3
- Regex: ".*"
Priority: 1
IncludeIsMainRegex: "(Test)?$"
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
---
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMWF-T2jgS_zTmRQVlyzCGBx7AQB23JGYHsvu4Jey2UUaWfJI8DPfprySDMcbMZK_u4agkEPWv_6i71d0SUYpmHGDqjObOaNEjpT4KOc2J1JT34cBB9g4iOU-dF_fyx1047szBfgIp5YB2-9cf4f6vb7PwNULOKKzoCCkty1h7SHnI8RfICeaDamnJIAeuG8vlYfdIUSKHPwgrwfMcHKL_8nMzqK0Fo5YabNQ8x_ttvH-P__rTljhsSxw6weJ_std7T-N7NdhoqYL4SSjxYywxUvj_OpZXA76wAX9tRNOVjwJxW2Ardbp4_DaPb8JQxftpEv29OLZOqP13fwQFKCexFAoRCSgVMidaQ4JOUvAMUY70ERAz8T8dQYL9ryoP_Uo3Ap4odKL6iAiKmVCUZyguJTujgyTxG2hEeGJoIs_JoKk7iuNSKkQ0ihnhWb9Sjd5BKiq4cvwLrouKvJeBO3hBDh4ftS4sGK8cvMqoPpaHQSxyB68Ye79-9QspfkKsURAfUo_g0cQbYTfGw4lHiD_y_UmKcRAEo3SY-CRJXxw8-Uy9O3AHd578oSBBgztwShkgettIKwL9fr_6sSE8K0kGjj9DYVHUxw7NiYIk4jt9ZpaINps_vlXkWRyDUt9EQlMKMkpTBdpA-sMLndGMz1INMiqAz6tQGIAlNDCh4AriUtN3mNlib1LJ2Iy0LKEbuICYEUn0JUyfIL_ZzOrALFVMCki-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