[clang] Reapply "[Clang] Profile singly-resolved UnresolvedLookupExpr with the declaration" (PR #140680)

via cfe-commits cfe-commits at lists.llvm.org
Tue May 20 05:28:24 PDT 2025


================
@@ -2189,8 +2189,14 @@ StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) {
 
 void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
   VisitExpr(S);
-  VisitNestedNameSpecifier(S->getQualifier());
-  VisitName(S->getName(), /*TreatAsDecl*/ true);
+  bool DescribingDependentVarTemplate =
+      S->getNumDecls() == 1 && isa<VarTemplateDecl>(*S->decls_begin());
----------------
cor3ntin wrote:

Except `ConceptSpecializationExpr` cannot be specialized, so there is that. Maybe a subclass?

I think this scenario can only happen for `UnresolvedLookupExpr` though, could you check?

We could add a `getAsTemplatedDecl` function in UnresolvedLookupExpr to help with that.

At the same time, I've used UnresolvedLookupExpr to model concept template template parameters too, and maybe having a dedicated class would be cleaner


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


More information about the cfe-commits mailing list