diff options
author | Mike Stump <mrs@apple.com> | 2009-11-13 23:13:20 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-11-13 23:13:20 +0000 |
commit | 65d0e28583ac050ec9aa71b469285faad48d137e (patch) | |
tree | 818beb8c4fe3b2ce530f096ca9aeb6f98b275c72 /lib/CodeGen | |
parent | 534ba90a1b865f3731aa56423e8f02d49ff62ec7 (diff) |
Also track address points for primaries bases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88717 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGVtable.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index 0de8430c72..bbe6ca1374 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -490,6 +490,32 @@ public: VCall.clear(); } + void AddAddressPoints(const CXXRecordDecl *RD, uint64_t Offset, + Index_t AddressPoint) { + D1(printf("XXX address point for %s in %s layout %s at offset %d is %d\n", + RD->getNameAsCString(), Class->getNameAsCString(), + LayoutClass->getNameAsCString(), (int)Offset, (int)AddressPoint)); + AddressPoints[std::make_pair(RD, Offset)] = AddressPoint; + + // Now also add the address point for all our primary bases. + while (1) { + const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD); + RD = Layout.getPrimaryBase(); + const bool PrimaryBaseWasVirtual = Layout.getPrimaryBaseWasVirtual(); + // FIXME: Double check this. + if (RD == 0) + break; + if (PrimaryBaseWasVirtual && + BLayout.getVBaseClassOffset(RD) != Offset) + break; + D1(printf("XXX address point for %s in %s layout %s at offset %d is %d\n", + RD->getNameAsCString(), Class->getNameAsCString(), + LayoutClass->getNameAsCString(), (int)Offset, (int)AddressPoint)); + AddressPoints[std::make_pair(RD, Offset)] = AddressPoint; + } + } + + Index_t end(const CXXRecordDecl *RD, const ASTRecordLayout &Layout, const CXXRecordDecl *PrimaryBase, bool PrimaryBaseWasVirtual, bool MorallyVirtual, int64_t Offset, bool ForVirtualBase, @@ -536,10 +562,7 @@ public: insertVCalls(VCallInsertionPoint); } - D1(printf("XXX address point for %s in %s layout %s at offset %d is %d\n", - RD->getNameAsCString(), Class->getNameAsCString(), - LayoutClass->getNameAsCString(), (int)Offset, (int)AddressPoint)); - AddressPoints[std::make_pair(RD, Offset)] = AddressPoint; + AddAddressPoints(RD, Offset, AddressPoint); if (alloc) { delete Path; |