@@ -76,7 +76,7 @@ class HeuristicResolverImpl {
76
76
// Helper function for HeuristicResolver::resolveDependentMember()
77
77
// which takes a possibly-dependent type `T` and heuristically
78
78
// resolves it to a TagDecl in which we can try name lookup.
79
- TagDecl *resolveTypeToTagDecl (const Type * T);
79
+ TagDecl *resolveTypeToTagDecl (QualType T);
80
80
81
81
// Helper function for simplifying a type.
82
82
// `Type` is the type to simplify.
@@ -133,8 +133,10 @@ TemplateName getReferencedTemplateName(const Type *T) {
133
133
// Helper function for HeuristicResolver::resolveDependentMember()
134
134
// which takes a possibly-dependent type `T` and heuristically
135
135
// 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 ;
138
140
139
141
// Unwrap type sugar such as type aliases.
140
142
T = T->getCanonicalTypeInternal ().getTypePtr ();
@@ -330,8 +332,7 @@ HeuristicResolverImpl::resolveTypeOfCallExpr(const CallExpr *CE) {
330
332
if (const auto *FnTypePtr = CalleeType->getAs <PointerType>())
331
333
CalleeType = FnTypePtr->getPointeeType ();
332
334
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 ())) {
335
336
return {D};
336
337
}
337
338
}
@@ -442,7 +443,7 @@ bool findOrdinaryMember(const CXXRecordDecl *RD, CXXBasePath &Path,
442
443
bool HeuristicResolverImpl::findOrdinaryMemberInDependentClasses (
443
444
const CXXBaseSpecifier *Specifier, CXXBasePath &Path,
444
445
DeclarationName Name) {
445
- TagDecl *TD = resolveTypeToTagDecl (Specifier->getType (). getTypePtr () );
446
+ TagDecl *TD = resolveTypeToTagDecl (Specifier->getType ());
446
447
if (const auto *RD = dyn_cast_if_present<CXXRecordDecl>(TD)) {
447
448
return findOrdinaryMember (RD, Path, Name);
448
449
}
@@ -485,10 +486,7 @@ std::vector<const NamedDecl *> HeuristicResolverImpl::lookupDependentName(
485
486
std::vector<const NamedDecl *> HeuristicResolverImpl::resolveDependentMember (
486
487
QualType QT, DeclarationName Name,
487
488
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);
492
490
if (!TD)
493
491
return {};
494
492
if (auto *ED = dyn_cast<EnumDecl>(TD)) {
0 commit comments