================ @@ -305,19 +337,21 @@ class TrivialFunctionAnalysisVisitor } bool VisitDeclRefExpr(const DeclRefExpr *DRE) { - if (auto *decl = DRE->getDecl()) { - if (isa<ParmVarDecl>(decl)) - return true; - if (isa<EnumConstantDecl>(decl)) - return true; - if (auto *VD = dyn_cast<VarDecl>(decl)) { - if (VD->hasConstantInitialization() && VD->getEvaluatedValue()) + return WithCachedResult(DRE, [&]() { + if (auto *decl = DRE->getDecl()) { + if (isa<ParmVarDecl>(decl)) return true; - auto *Init = VD->getInit(); - return !Init || Visit(Init); + if (isa<EnumConstantDecl>(decl)) + return true; + if (auto *VD = dyn_cast<VarDecl>(decl)) { + if (VD->hasConstantInitialization() && VD->getEvaluatedValue()) + return true; + auto *Init = VD->getInit(); + return !Init || Visit(Init); ---------------- rniwa wrote:
Oh, that is a very good point. I guess we can just always `return true` for `DeclRefExpr`. https://github.com/llvm/llvm-project/pull/82229 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits