[clang] [clang] Check specialization for annotation (PR #117315)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 28 01:14:57 PST 2024


================
@@ -253,9 +253,12 @@ static void visitLocalsRetainedByReferenceBinding(IndirectLocalPath &Path,
                                                   LocalVisitor Visit);
 
 template <typename T> static bool isRecordWithAttr(QualType Type) {
-  if (auto *RD = Type->getAsCXXRecordDecl())
-    return RD->hasAttr<T>();
-  return false;
+  auto *RD = Type->getAsCXXRecordDecl();
+  if (!RD)
+    return false;
+  if (auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
+    RD = CTSD->getSpecializedTemplate()->getTemplatedDecl();
----------------
usx95 wrote:

Moved to Sema.h.

It seems hard to find a test for it though.

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


More information about the cfe-commits mailing list