[clang] [APINotes] Avoid duplicated attributes for class template instantiations (PR #122516)

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 10 11:47:45 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())
----------------
compnerd wrote:

I wonder if we should sink this into `ProcessAPINotes` instead.

https://github.com/llvm/llvm-project/pull/122516


More information about the cfe-commits mailing list