[lldb] Fix build after found_decls was removed by 1f40d60a3b

This commit is contained in:
Fangrui Song 2020-12-01 19:14:34 -08:00
parent e181a6aedd
commit ce5e21868c
1 changed files with 6 additions and 3 deletions

View File

@ -148,10 +148,11 @@ void addOverridesForMethod(clang::CXXMethodDecl *decl) {
return;
clang::CXXBasePaths paths;
llvm::SmallVector<clang::NamedDecl *, 4> decls;
auto find_overridden_methods =
[decl](const clang::CXXBaseSpecifier *specifier,
clang::CXXBasePath &path) {
[&decls, decl](const clang::CXXBaseSpecifier *specifier,
clang::CXXBasePath &path) {
if (auto *base_record = llvm::dyn_cast<clang::CXXRecordDecl>(
specifier->getType()->getAs<clang::RecordType>()->getDecl())) {
@ -163,6 +164,7 @@ void addOverridesForMethod(clang::CXXMethodDecl *decl) {
if (auto *baseDtorDecl = base_record->getDestructor()) {
if (baseDtorDecl->isVirtual()) {
path.Decls = baseDtorDecl;
decls.push_back(baseDtorDecl);
return true;
} else
return false;
@ -175,6 +177,7 @@ void addOverridesForMethod(clang::CXXMethodDecl *decl) {
llvm::dyn_cast<clang::CXXMethodDecl>(path.Decls.front()))
if (method_decl->isVirtual() && !isOverload(decl, method_decl)) {
path.Decls = method_decl;
decls.push_back(method_decl);
return true;
}
}
@ -184,7 +187,7 @@ void addOverridesForMethod(clang::CXXMethodDecl *decl) {
};
if (decl->getParent()->lookupInBases(find_overridden_methods, paths)) {
for (auto *overridden_decl : paths.found_decls())
for (auto *overridden_decl : decls)
decl->addOverriddenMethod(
llvm::cast<clang::CXXMethodDecl>(overridden_decl));
}