aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-11-28 03:03:52 +0000
committerAnders Carlsson <andersca@mac.com>2009-11-28 03:03:52 +0000
commit724e3e24ddf968d364b4e3dcff022377a8a72328 (patch)
tree8e1468610083771c8834264c028c7b53bfc1420b
parent1fb7cf9214402aacfaa74c92870b94c5879e97dc (diff)
We always want to create a virtual function pointer entry if the path from the derived return value to the base overridden return value contains a virtual base class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90024 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGVtable.cpp32
1 files changed, 5 insertions, 27 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index 57a82876cf..a26a697250 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -800,35 +800,13 @@ TypeConversionRequiresAdjustment(ASTContext &Ctx,
return false;
}
+ // If we found a virtual base we always want to require adjustment.
+ if (Paths.getDetectedVirtual())
+ return true;
+
const CXXBasePath &Path = Paths.front();
- size_t Start = 0, End = Path.size();
-
- // Check if we have a virtual base.
- if (const RecordType *RT = Paths.getDetectedVirtual()) {
- const CXXRecordDecl *VirtualBase = cast<CXXRecordDecl>(RT->getDecl());
- assert(VirtualBase->isCanonicalDecl() && "Must have canonical decl!");
-
- // Check the virtual base class offset.
- const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(DerivedDecl);
-
- if (Layout.getVBaseClassOffset(VirtualBase) != 0) {
- // This requires an adjustment.
- return true;
- }
-
- // Now ignore all the path elements up to the virtual base.
- // FIXME: It would be nice if CXXBasePaths could return an index to the
- // CXXElementSpecifier that corresponded to the virtual base.
- for (; Start != End; ++Start) {
- const CXXBasePathElement& Element = Path[Start];
-
- if (Element.Class == VirtualBase)
- break;
- }
- }
-
- for (; Start != End; ++Start) {
+ for (size_t Start = 0, End = Path.size(); Start != End; ++Start) {
const CXXBasePathElement &Element = Path[Start];
// Check the base class offset.