Skip to content

Commit 8ce17c1

Browse files
[clang][NFC] Remove CXXRecordDecl::lookupDependentName() and its helpers (#128392)
This function has been superseded by HeuristicResolver::lookupDependentName(), which implements the same heuristics and more. Porting note for any out-of-tree callers: ``` RD->lookupDependentName(Name, Filter); ``` can be replaced with: ``` HeuristicResolver(RD->getASTContext())->lookupDependentName(Name, Filter); ```
1 parent e55f1a7 commit 8ce17c1

File tree

2 files changed

+0
-61
lines changed

2 files changed

+0
-61
lines changed

clang/include/clang/AST/DeclCXX.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,14 +1720,6 @@ class CXXRecordDecl : public RecordDecl {
17201720
/// static analysis, or similar.
17211721
bool hasMemberName(DeclarationName N) const;
17221722

1723-
/// Performs an imprecise lookup of a dependent name in this class.
1724-
///
1725-
/// This function does not follow strict semantic rules and should be used
1726-
/// only when lookup rules can be relaxed, e.g. indexing.
1727-
std::vector<const NamedDecl *>
1728-
lookupDependentName(DeclarationName Name,
1729-
llvm::function_ref<bool(const NamedDecl *ND)> Filter);
1730-
17311723
/// Renders and displays an inheritance diagram
17321724
/// for this C++ class and all of its base classes (transitively) using
17331725
/// GraphViz.

clang/lib/AST/CXXInheritance.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -411,59 +411,6 @@ bool CXXRecordDecl::hasMemberName(DeclarationName Name) const {
411411
Paths);
412412
}
413413

414-
static bool
415-
findOrdinaryMemberInDependentClasses(const CXXBaseSpecifier *Specifier,
416-
CXXBasePath &Path, DeclarationName Name) {
417-
const TemplateSpecializationType *TST =
418-
Specifier->getType()->getAs<TemplateSpecializationType>();
419-
if (!TST) {
420-
auto *RT = Specifier->getType()->getAs<RecordType>();
421-
if (!RT)
422-
return false;
423-
return findOrdinaryMember(cast<CXXRecordDecl>(RT->getDecl()), Path, Name);
424-
}
425-
TemplateName TN = TST->getTemplateName();
426-
const auto *TD = dyn_cast_or_null<ClassTemplateDecl>(TN.getAsTemplateDecl());
427-
if (!TD)
428-
return false;
429-
CXXRecordDecl *RD = TD->getTemplatedDecl();
430-
if (!RD)
431-
return false;
432-
return findOrdinaryMember(RD, Path, Name);
433-
}
434-
435-
std::vector<const NamedDecl *> CXXRecordDecl::lookupDependentName(
436-
DeclarationName Name,
437-
llvm::function_ref<bool(const NamedDecl *ND)> Filter) {
438-
std::vector<const NamedDecl *> Results;
439-
// Lookup in the class.
440-
bool AnyOrdinaryMembers = false;
441-
for (const NamedDecl *ND : lookup(Name)) {
442-
if (isOrdinaryMember(ND))
443-
AnyOrdinaryMembers = true;
444-
if (Filter(ND))
445-
Results.push_back(ND);
446-
}
447-
if (AnyOrdinaryMembers)
448-
return Results;
449-
450-
// Perform lookup into our base classes.
451-
CXXBasePaths Paths;
452-
Paths.setOrigin(this);
453-
if (!lookupInBases(
454-
[&](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) {
455-
return findOrdinaryMemberInDependentClasses(Specifier, Path, Name);
456-
},
457-
Paths, /*LookupInDependent=*/true))
458-
return Results;
459-
for (DeclContext::lookup_iterator I = Paths.front().Decls, E = I.end();
460-
I != E; ++I) {
461-
if (isOrdinaryMember(*I) && Filter(*I))
462-
Results.push_back(*I);
463-
}
464-
return Results;
465-
}
466-
467414
void OverridingMethods::add(unsigned OverriddenSubobject,
468415
UniqueVirtualMethod Overriding) {
469416
SmallVectorImpl<UniqueVirtualMethod> &SubobjectOverrides

0 commit comments

Comments
 (0)