[clang] [clang-format] Keep compound literals stable in macro bodies (PR #173771)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 28 10:42:17 PST 2025
================
@@ -528,7 +553,16 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
Tok->setBlockKind(BK_Block);
}
} else {
- Tok->setBlockKind(BK_Unknown);
+ // In macro bodies we try to keep compound literal expressions like
----------------
HazardyKnusperkeks wrote:
Yeah I know, but can we chime in, where the type is set to `TT_FunctionLBrace` in `TokenAnnotator` and perform the magic there? It would collapse to some `if`s, and two hops through `MatchingParen`, and two `getPreviousNonComment()` vs. this loop.
https://github.com/llvm/llvm-project/pull/173771
More information about the cfe-commits
mailing list