summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/VTableBuilder.cpp
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2013-10-29 14:13:45 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2013-10-29 14:13:45 +0000
commit66f4381b396d2c2afa6c8edb6efa14cf35e0c6fe (patch)
tree795f3bc22c43fe9ca4da4b294bb979cf090f39ef /clang/lib/AST/VTableBuilder.cpp
parent5d1b7456893620b3360e23fe0e78191dd87969b2 (diff)
downloadbcm5719-llvm-66f4381b396d2c2afa6c8edb6efa14cf35e0c6fe.tar.gz
bcm5719-llvm-66f4381b396d2c2afa6c8edb6efa14cf35e0c6fe.zip
Fix an assertion when handling a custom case of virtual inheritance; also reduce code duplication
llvm-svn: 193610
Diffstat (limited to 'clang/lib/AST/VTableBuilder.cpp')
-rw-r--r--clang/lib/AST/VTableBuilder.cpp26
1 files changed, 2 insertions, 24 deletions
diff --git a/clang/lib/AST/VTableBuilder.cpp b/clang/lib/AST/VTableBuilder.cpp
index a161802b291..30319554528 100644
--- a/clang/lib/AST/VTableBuilder.cpp
+++ b/clang/lib/AST/VTableBuilder.cpp
@@ -2730,28 +2730,6 @@ VFTableBuilder::ComputeThisOffset(const CXXMethodDecl *MD,
return Ret;
}
-static const CXXMethodDecl*
-FindDirectlyOverriddenMethodInBases(const CXXMethodDecl *MD,
- BasesSetVectorTy &Bases) {
- // We can't just iterate over the overridden methods and return the first one
- // which has its parent in Bases, e.g. this doesn't work when we have
- // multiple subobjects of the same type that have its virtual function
- // overridden.
- for (int I = Bases.size(), E = 0; I != E; --I) {
- const CXXRecordDecl *CurrentBase = Bases[I - 1];
-
- for (CXXMethodDecl::method_iterator I = MD->begin_overridden_methods(),
- E = MD->end_overridden_methods(); I != E; ++I) {
- const CXXMethodDecl *OverriddenMD = *I;
-
- if (OverriddenMD->getParent() == CurrentBase)
- return OverriddenMD;
- }
- }
-
- return 0;
-}
-
static void GroupNewVirtualOverloads(
const CXXRecordDecl *RD,
SmallVector<const CXXMethodDecl *, 10> &VirtualMethods) {
@@ -2843,7 +2821,7 @@ void VFTableBuilder::AddMethods(BaseSubobject Base, unsigned BaseDepth,
// Check if this virtual member function overrides
// a method in one of the visited bases.
if (const CXXMethodDecl *OverriddenMD =
- FindDirectlyOverriddenMethodInBases(MD, VisitedBases)) {
+ FindNearestOverriddenMethod(MD, VisitedBases)) {
MethodInfoMapTy::iterator OverriddenMDIterator =
MethodInfoMap.find(OverriddenMD);
@@ -2887,7 +2865,7 @@ void VFTableBuilder::AddMethods(BaseSubobject Base, unsigned BaseDepth,
// FIXME: this is O(N^2), can be O(N).
const CXXMethodDecl *SubOverride = OverriddenMD;
while ((SubOverride =
- FindDirectlyOverriddenMethodInBases(SubOverride, VisitedBases))) {
+ FindNearestOverriddenMethod(SubOverride, VisitedBases))) {
MethodInfoMapTy::iterator SubOverrideIterator =
MethodInfoMap.find(SubOverride);
if (SubOverrideIterator == MethodInfoMap.end())
OpenPOWER on IntegriCloud