@@ -76,7 +76,7 @@ class HeuristicResolverImpl {
7676 // Helper function for HeuristicResolver::resolveDependentMember()
7777 // which takes a possibly-dependent type `T` and heuristically
7878 // resolves it to a TagDecl in which we can try name lookup.
79- TagDecl *resolveTypeToTagDecl (const Type * T);
79+ TagDecl *resolveTypeToTagDecl (QualType T);
8080
8181 // Helper function for simplifying a type.
8282 // `Type` is the type to simplify.
@@ -133,8 +133,10 @@ TemplateName getReferencedTemplateName(const Type *T) {
133133// Helper function for HeuristicResolver::resolveDependentMember()
134134// which takes a possibly-dependent type `T` and heuristically
135135// resolves it to a CXXRecordDecl in which we can try name lookup.
136- TagDecl *HeuristicResolverImpl::resolveTypeToTagDecl (const Type *T) {
137- assert (T);
136+ TagDecl *HeuristicResolverImpl::resolveTypeToTagDecl (QualType QT) {
137+ const Type *T = QT.getTypePtrOrNull ();
138+ if (!T)
139+ return nullptr ;
138140
139141 // Unwrap type sugar such as type aliases.
140142 T = T->getCanonicalTypeInternal ().getTypePtr ();
@@ -330,8 +332,7 @@ HeuristicResolverImpl::resolveTypeOfCallExpr(const CallExpr *CE) {
330332 if (const auto *FnTypePtr = CalleeType->getAs <PointerType>())
331333 CalleeType = FnTypePtr->getPointeeType ();
332334 if (const FunctionType *FnType = CalleeType->getAs <FunctionType>()) {
333- if (const auto *D =
334- resolveTypeToTagDecl (FnType->getReturnType ().getTypePtr ())) {
335+ if (const auto *D = resolveTypeToTagDecl (FnType->getReturnType ())) {
335336 return {D};
336337 }
337338 }
@@ -442,7 +443,7 @@ bool findOrdinaryMember(const CXXRecordDecl *RD, CXXBasePath &Path,
442443bool HeuristicResolverImpl::findOrdinaryMemberInDependentClasses (
443444 const CXXBaseSpecifier *Specifier, CXXBasePath &Path,
444445 DeclarationName Name) {
445- TagDecl *TD = resolveTypeToTagDecl (Specifier->getType (). getTypePtr () );
446+ TagDecl *TD = resolveTypeToTagDecl (Specifier->getType ());
446447 if (const auto *RD = dyn_cast_if_present<CXXRecordDecl>(TD)) {
447448 return findOrdinaryMember (RD, Path, Name);
448449 }
@@ -485,10 +486,7 @@ std::vector<const NamedDecl *> HeuristicResolverImpl::lookupDependentName(
485486std::vector<const NamedDecl *> HeuristicResolverImpl::resolveDependentMember (
486487 QualType QT, DeclarationName Name,
487488 llvm::function_ref<bool (const NamedDecl *ND)> Filter) {
488- const Type *T = QT.getTypePtrOrNull ();
489- if (!T)
490- return {};
491- TagDecl *TD = resolveTypeToTagDecl (T);
489+ TagDecl *TD = resolveTypeToTagDecl (QT);
492490 if (!TD)
493491 return {};
494492 if (auto *ED = dyn_cast<EnumDecl>(TD)) {
0 commit comments