diff options
author | Anders Carlsson <andersca@mac.com> | 2010-03-11 07:00:45 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-03-11 07:00:45 +0000 |
commit | e4424888e4d46b1337dca8170f3cf688b86d8a95 (patch) | |
tree | 181fe06ba6024699548ee98b12aead026ebe2690 /clang/lib/CodeGen | |
parent | 3521552ebeb2c3afd103207655939ac00f96cff8 (diff) | |
download | bcm5719-llvm-e4424888e4d46b1337dca8170f3cf688b86d8a95.tar.gz bcm5719-llvm-e4424888e4d46b1337dca8170f3cf688b86d8a95.zip |
When possible, use the vbase offset offsets from the most derived class directly.
llvm-svn: 98247
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGVtable.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGVtable.cpp b/clang/lib/CodeGen/CGVtable.cpp index 3e07756ad5c..9f792993ac4 100644 --- a/clang/lib/CodeGen/CGVtable.cpp +++ b/clang/lib/CodeGen/CGVtable.cpp @@ -1406,9 +1406,16 @@ VtableBuilder::ComputeReturnAdjustment(BaseOffset Offset) { if (!Offset.isEmpty()) { if (Offset.VirtualBase) { // Get the virtual base offset offset. - Adjustment.VBaseOffsetOffset = - VtableInfo.getVirtualBaseOffsetIndex(Offset.DerivedClass, - Offset.VirtualBase); + if (Offset.DerivedClass == MostDerivedClass) { + // We can get the offset offset directly from our map. + Adjustment.VBaseOffsetOffset = + VBaseOffsetOffsets.lookup(Offset.VirtualBase); + } else { + Adjustment.VBaseOffsetOffset = + VtableInfo.getVirtualBaseOffsetIndex(Offset.DerivedClass, + Offset.VirtualBase); + } + // FIXME: Once the assert in getVirtualBaseOffsetIndex is back again, // we can get rid of this assert. assert(Adjustment.VBaseOffsetOffset != 0 && |