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

Egor Zhdan via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 15 07:25:33 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())
----------------
egorzhdan wrote:

The description was indeed confusing. I clarified it, and also made the change even simpler.

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


More information about the cfe-commits mailing list