[clang] [clang] fix some places where used decls were not marked as referenced (PR #191848)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 10:53:38 PDT 2026


================
@@ -3795,6 +3795,10 @@ QualType Sema::CheckTemplateIdType(ElaboratedTypeKeyword Keyword,
                                 /*UpdateArgsWithConversions=*/true))
     return QualType();
 
+  // Diagnose uses of this template.
+  (void)DiagnoseUseOfDecl(Template, TemplateLoc);
+  MarkAnyDeclReferenced(TemplateLoc, Template, /*OdrUse=*/false);
----------------
mizvekov wrote:

My take is that calling `DiagnoseUseOfDecl` for all uses is the right thing to do architecturally, because that's the extension point where we will hook any future use-diagnostics we implement.

It would just be counterproductive to go out of our way to avoid calling it for declarations we currently don't implement any diagnostics of.

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


More information about the cfe-commits mailing list