summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGVtable.cpp
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
commit548cc9d14326edbab7770c80beb807b71c98c910 (patch)
tree2cd1ec477d9c7e90df139ebda35e77542671a655 /clang/lib/CodeGen/CGVtable.cpp
parent182498df65203fac046aad20dff2336f67c8a0e2 (diff)
downloadbcm5719-llvm-548cc9d14326edbab7770c80beb807b71c98c910.tar.gz
bcm5719-llvm-548cc9d14326edbab7770c80beb807b71c98c910.zip
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.
llvm-svn: 90024
Diffstat (limited to 'clang/lib/CodeGen/CGVtable.cpp')
-rw-r--r--clang/lib/CodeGen/CGVtable.cpp32
1 files changed, 5 insertions, 27 deletions
diff --git a/clang/lib/CodeGen/CGVtable.cpp b/clang/lib/CodeGen/CGVtable.cpp
index 57a82876cf6..a26a697250e 100644
--- a/clang/lib/CodeGen/CGVtable.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud