@@ -75,7 +75,7 @@ class HeuristicResolverImpl {
75
75
// Helper function for HeuristicResolver::resolveDependentMember()
76
76
// which takes a possibly-dependent type `T` and heuristically
77
77
// resolves it to a TagDecl in which we can try name lookup.
78
- TagDecl *resolveTypeToTagDecl (const Type * T);
78
+ TagDecl *resolveTypeToTagDecl (QualType T);
79
79
80
80
// Helper function for simplifying a type.
81
81
// `Type` is the type to simplify.
@@ -132,8 +132,10 @@ TemplateName getReferencedTemplateName(const Type *T) {
132
132
// Helper function for HeuristicResolver::resolveDependentMember()
133
133
// which takes a possibly-dependent type `T` and heuristically
134
134
// 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 ;
137
139
138
140
// Unwrap type sugar such as type aliases.
139
141
T = T->getCanonicalTypeInternal ().getTypePtr ();
@@ -315,8 +317,7 @@ HeuristicResolverImpl::resolveTypeOfCallExpr(const CallExpr *CE) {
315
317
if (const auto *FnTypePtr = CalleeType->getAs <PointerType>())
316
318
CalleeType = FnTypePtr->getPointeeType ();
317
319
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 ())) {
320
321
return {D};
321
322
}
322
323
}
@@ -427,7 +428,7 @@ bool findOrdinaryMember(const CXXRecordDecl *RD, CXXBasePath &Path,
427
428
bool HeuristicResolverImpl::findOrdinaryMemberInDependentClasses (
428
429
const CXXBaseSpecifier *Specifier, CXXBasePath &Path,
429
430
DeclarationName Name) {
430
- TagDecl *TD = resolveTypeToTagDecl (Specifier->getType (). getTypePtr () );
431
+ TagDecl *TD = resolveTypeToTagDecl (Specifier->getType ());
431
432
if (const auto *RD = dyn_cast_if_present<CXXRecordDecl>(TD)) {
432
433
return findOrdinaryMember (RD, Path, Name);
433
434
}
@@ -470,10 +471,7 @@ std::vector<const NamedDecl *> HeuristicResolverImpl::lookupDependentName(
470
471
std::vector<const NamedDecl *> HeuristicResolverImpl::resolveDependentMember (
471
472
QualType QT, DeclarationName Name,
472
473
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);
477
475
if (!TD)
478
476
return {};
479
477
if (auto *ED = dyn_cast<EnumDecl>(TD)) {
0 commit comments