[clang] [APINotes] Avoid duplicated attributes for class template instantiations (PR #122516)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 13 02:23:36 PST 2025
================
@@ -19493,7 +19493,11 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl,
CDecl->setIvarRBraceLoc(RBrac);
}
}
- ProcessAPINotes(Record);
+
+ // If this is a class template instantiation, its API Notes attributes were
+ // added to the class template itself. Make sure they are not added twice.
+ if (!CXXRecord || !CXXRecord->getDescribedClassTemplate())
----------------
Xazax-hun wrote:
I am a bit confused.
The PR description says:
> don't try to add attributes from API Notes to concrete instantiations
I'd expect this code to do the opposite. I'd expect `getDescribedClassTemplate` to return null for instantiations, so I'd expect us to take this branch when we process an instantiation.
https://github.com/llvm/llvm-project/pull/122516
More information about the cfe-commits
mailing list