================
@@ -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
----------------
Lane0218 wrote:
Thanks for the suggestions!
I followed @owenca’s requested direction and switched to a smaller parser-side
fix (in `parseParens`) rather than the loop/heuristic in `calculateBraceTypes`.
I also added a `TokenAnnotatorTest` regression that checks the brace kind for
`&(type){v}` is `BK_BracedInit`.
Thanks again — I agree a more general TokenAnnotator/MatchingParen-based
approach could be a good follow-up refactor, but I’m trying to keep this PR
minimal.
Tests: FormatTests
https://github.com/llvm/llvm-project/pull/173771
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits