Add a member lookup criteria constructor for searching for overridden virtual member functions. Use this instead of regular name lookup when checking for overriding functions so we will see declarations that would otherwise be hidden. Fixes 6902298.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72601 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaInherit.cpp b/lib/Sema/SemaInherit.cpp
index 5eef1eb..1eccc1f 100644
--- a/lib/Sema/SemaInherit.cpp
+++ b/lib/Sema/SemaInherit.cpp
@@ -191,6 +191,22 @@
++Paths.ScratchPath.Decls.first;
}
break;
+ case MemberLookupCriteria::LK_OverriddenMember:
+ Paths.ScratchPath.Decls =
+ BaseRecord->lookup(Context, Criteria.Method->getDeclName());
+ while (Paths.ScratchPath.Decls.first != Paths.ScratchPath.Decls.second) {
+ CXXMethodDecl *MD =
+ cast<CXXMethodDecl>(*Paths.ScratchPath.Decls.first);
+
+ OverloadedFunctionDecl::function_iterator MatchedDecl;
+ if (MD->isVirtual() && !IsOverload(Criteria.Method, MD, MatchedDecl)) {
+ FoundPathToThisBase = true;
+ break;
+ }
+
+ ++Paths.ScratchPath.Decls.first;
+ }
+ break;
}
if (FoundPathToThisBase) {