[clang] [clang-tools-extra] [clang] Heuristic resolution for explicit object parameter (PR #155143)
Mythreya Kuricheti via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 24 01:53:59 PDT 2025
================
@@ -301,9 +302,34 @@ std::vector<const NamedDecl *> HeuristicResolverImpl::resolveMemberExpr(
return {};
}
+ // check if member expr is in the context of an explicit object method
+ // If so, it's safe to assume the templated arg is of type of the record
+ const auto ExplicitMemberHeuristic =
+ [&](const Expr *Base) -> std::optional<QualType> {
+ if (auto *DeclRef = dyn_cast_if_present<DeclRefExpr>(Base)) {
+ auto *PrDecl = dyn_cast_if_present<ParmVarDecl>(DeclRef->getDecl());
+
----------------
MythreyaK wrote:
`PrDecl` is null [here](https://github.com/llvm/llvm-project/blob/93c96849c89507579a77980ff03adbeabb413573/clang/unittests/Sema/HeuristicResolverTest.cpp#L213), for example.
```
DeclRefExpr 0x2e63d268 'auto' lvalue Var 0x2e63d150 'b' 'auto'
```
https://github.com/llvm/llvm-project/pull/155143
More information about the cfe-commits
mailing list