[clang] [clang-format] Fix annotating attrs in class/struct (PR #124634)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 28 21:11:18 PST 2025
================
@@ -2633,12 +2633,20 @@ class AnnotatingParser {
PreviousNotConst->MatchingParen->Previous->isNot(tok::kw_template);
}
- if ((PreviousNotConst->is(tok::r_paren) &&
- PreviousNotConst->is(TT_TypeDeclarationParen)) ||
- PreviousNotConst->is(TT_AttributeRParen)) {
+ if (PreviousNotConst->is(tok::r_paren) &&
+ PreviousNotConst->is(TT_TypeDeclarationParen)) {
return true;
}
+ auto InTypeDecl = [&]() {
+ for (auto Next = Tok.Next; Next; Next = Next->Next)
----------------
owenca wrote:
A more robust and efficient way would be to annotate the class name in `UnwrappedLineParser` as most of the work has already been done there. I'll submit a patch soon.
https://github.com/llvm/llvm-project/pull/124634
More information about the cfe-commits
mailing list