@@ -75,7 +75,7 @@ class HeuristicResolverImpl {
7575 // Helper function for HeuristicResolver::resolveDependentMember()
7676 // which takes a possibly-dependent type `T` and heuristically
7777 // resolves it to a TagDecl in which we can try name lookup.
78- TagDecl *resolveTypeToTagDecl (const Type * T);
78+ TagDecl *resolveTypeToTagDecl (QualType T);
7979
8080 // Helper function for simplifying a type.
8181 // `Type` is the type to simplify.
@@ -132,8 +132,10 @@ TemplateName getReferencedTemplateName(const Type *T) {
132132// Helper function for HeuristicResolver::resolveDependentMember()
133133// which takes a possibly-dependent type `T` and heuristically
134134// resolves it to a CXXRecordDecl in which we can try name lookup.
135- TagDecl *HeuristicResolverImpl::resolveTypeToTagDecl (const Type *T) {
136- assert (T);
135+ TagDecl *HeuristicResolverImpl::resolveTypeToTagDecl (QualType QT) {
136+ const Type *T = QT.getTypePtrOrNull ();
137+ if (!T)
138+ return nullptr ;
137139
138140 // Unwrap type sugar such as type aliases.
139141 T = T->getCanonicalTypeInternal ().getTypePtr ();
@@ -315,8 +317,7 @@ HeuristicResolverImpl::resolveTypeOfCallExpr(const CallExpr *CE) {
315317 if (const auto *FnTypePtr = CalleeType->getAs <PointerType>())
316318 CalleeType = FnTypePtr->getPointeeType ();
317319 if (const FunctionType *FnType = CalleeType->getAs <FunctionType>()) {
318- if (const auto *D =
319- resolveTypeToTagDecl (FnType->getReturnType ().getTypePtr ())) {
320+ if (const auto *D = resolveTypeToTagDecl (FnType->getReturnType ())) {
320321 return {D};
321322 }
322323 }
@@ -427,7 +428,7 @@ bool findOrdinaryMember(const CXXRecordDecl *RD, CXXBasePath &Path,
427428bool HeuristicResolverImpl::findOrdinaryMemberInDependentClasses (
428429 const CXXBaseSpecifier *Specifier, CXXBasePath &Path,
429430 DeclarationName Name) {
430- TagDecl *TD = resolveTypeToTagDecl (Specifier->getType (). getTypePtr () );
431+ TagDecl *TD = resolveTypeToTagDecl (Specifier->getType ());
431432 if (const auto *RD = dyn_cast_if_present<CXXRecordDecl>(TD)) {
432433 return findOrdinaryMember (RD, Path, Name);
433434 }
@@ -470,10 +471,7 @@ std::vector<const NamedDecl *> HeuristicResolverImpl::lookupDependentName(
470471std::vector<const NamedDecl *> HeuristicResolverImpl::resolveDependentMember (
471472 QualType QT, DeclarationName Name,
472473 llvm::function_ref<bool (const NamedDecl *ND)> Filter) {
473- const Type *T = QT.getTypePtrOrNull ();
474- if (!T)
475- return {};
476- TagDecl *TD = resolveTypeToTagDecl (T);
474+ TagDecl *TD = resolveTypeToTagDecl (QT);
477475 if (!TD)
478476 return {};
479477 if (auto *ED = dyn_cast<EnumDecl>(TD)) {
0 commit comments