aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGVtable.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-12-15 03:31:17 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-12-15 03:31:17 +0000
commitea5ae3170d8022c2007295ec794bdaf63f0273a1 (patch)
treecd6925fa1bab5fcd507ba8bbd5cb11e94dbb5116 /lib/CodeGen/CGVtable.cpp
parent34531470e6f6e394de7fd47d69917db280fee206 (diff)
Fix a small bug in ComputeMethodVtableIndices.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91411 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r--lib/CodeGen/CGVtable.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index 868a341440..5283ed9366 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -952,7 +952,15 @@ void CGVtableInfo::ComputeMethodVtableIndices(const CXXRecordDecl *RD) {
// we need to start counting at the end of the primary base's vtable.
CurrentIndex = getNumVirtualFunctionPointers(PrimaryBase);
}
-
+
+ // Collect all the primary bases, so we can check whether methods override
+ // a method from the base.
+ llvm::SmallPtrSet<const CXXRecordDecl *, 5> PrimaryBases;
+ for (ASTRecordLayout::primary_base_info_iterator
+ I = Layout.primary_base_begin(), E = Layout.primary_base_end();
+ I != E; ++I)
+ PrimaryBases.insert((*I).getBase());
+
const CXXDestructorDecl *ImplicitVirtualDtor = 0;
for (CXXRecordDecl::method_iterator i = RD->method_begin(),
@@ -973,7 +981,7 @@ void CGVtableInfo::ComputeMethodVtableIndices(const CXXRecordDecl *RD) {
assert(OverriddenMD->isCanonicalDecl() &&
"Should have the canonical decl of the overridden RD!");
- if (OverriddenRD == PrimaryBase) {
+ if (PrimaryBases.count(OverriddenRD)) {
// Check if converting from the return type of the method to the
// return type of the overridden method requires conversion.
QualType ReturnType =