aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGVtable.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-02-27 04:12:52 +0000
committerAnders Carlsson <andersca@mac.com>2010-02-27 04:12:52 +0000
commit5560969d73e3e72747972d0f0f37ca4e3b042186 (patch)
tree3eccc6128e01119d1c192652097461ca1822aba6 /lib/CodeGen/CGVtable.cpp
parent08c26752efa51fb5dc47bd3382ea21814bd0c5b8 (diff)
Handle vcall offset sharing between destructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97304 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r--lib/CodeGen/CGVtable.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index 3c8ddfaed5..89676d4343 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -835,16 +835,20 @@ bool VCallOffsetMap::MethodsCanShareVCallOffset(const CXXMethodDecl *LHS,
assert(LHS->isVirtual() && "LHS must be virtual!");
assert(RHS->isVirtual() && "LHS must be virtual!");
+ // A destructor can share a vcall offset with another destructor.
+ if (isa<CXXDestructorDecl>(LHS))
+ return isa<CXXDestructorDecl>(RHS);
+
// FIXME: We need to check more things here.
- // Must have the same name.
- // FIXME: are destructors an exception to this?
+ // The methods must have the same name.
DeclarationName LHSName = LHS->getDeclName();
DeclarationName RHSName = RHS->getDeclName();
if (LHSName != RHSName)
return false;
- return (HasSameVirtualSignature(LHS, RHS));
+ // And the same signatures.
+ return HasSameVirtualSignature(LHS, RHS);
}
bool VCallOffsetMap::AddVCallOffset(const CXXMethodDecl *MD,