forked from OSchip/llvm-project
parent
db14a73606
commit
ea8eea2c45
|
@ -1077,6 +1077,32 @@ public:
|
||||||
return AddressPoint;
|
return AddressPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Primaries(const CXXRecordDecl *RD, bool forPrimary,
|
||||||
|
bool MorallyVirtual, int64_t Offset, bool ForVirtualBase) {
|
||||||
|
if (!RD->isDynamicClass())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
|
||||||
|
const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase();
|
||||||
|
const bool PrimaryBaseWasVirtual = Layout.getPrimaryBaseWasVirtual();
|
||||||
|
|
||||||
|
std::vector<llvm::Constant *> offsets;
|
||||||
|
|
||||||
|
bool Top = true;
|
||||||
|
|
||||||
|
// vtables are composed from the chain of primaries.
|
||||||
|
if (PrimaryBase) {
|
||||||
|
if (PrimaryBaseWasVirtual)
|
||||||
|
IndirectPrimary.insert(PrimaryBase);
|
||||||
|
Top = false;
|
||||||
|
Primaries(PrimaryBase, true, PrimaryBaseWasVirtual|MorallyVirtual,
|
||||||
|
Offset, PrimaryBaseWasVirtual);
|
||||||
|
}
|
||||||
|
|
||||||
|
// And add the virtuals for the class to the primary vtable.
|
||||||
|
AddMethods(RD, MorallyVirtual, Offset);
|
||||||
|
}
|
||||||
|
|
||||||
int64_t GenerateVtableForBase(const CXXRecordDecl *RD, bool forPrimary,
|
int64_t GenerateVtableForBase(const CXXRecordDecl *RD, bool forPrimary,
|
||||||
bool Bottom, bool MorallyVirtual,
|
bool Bottom, bool MorallyVirtual,
|
||||||
int64_t Offset, bool ForVirtualBase) {
|
int64_t Offset, bool ForVirtualBase) {
|
||||||
|
@ -1089,8 +1115,7 @@ public:
|
||||||
|
|
||||||
std::vector<llvm::Constant *> offsets;
|
std::vector<llvm::Constant *> offsets;
|
||||||
// FIXME: Audit, is this right?
|
// FIXME: Audit, is this right?
|
||||||
if (Bottom && (PrimaryBase == 0 || forPrimary || !PrimaryBaseWasVirtual
|
if (Bottom) {
|
||||||
|| Bottom)) {
|
|
||||||
extra = 0;
|
extra = 0;
|
||||||
GenerateVBaseOffsets(offsets, RD, Offset);
|
GenerateVBaseOffsets(offsets, RD, Offset);
|
||||||
if (ForVirtualBase)
|
if (ForVirtualBase)
|
||||||
|
@ -1104,9 +1129,8 @@ public:
|
||||||
if (PrimaryBaseWasVirtual)
|
if (PrimaryBaseWasVirtual)
|
||||||
IndirectPrimary.insert(PrimaryBase);
|
IndirectPrimary.insert(PrimaryBase);
|
||||||
Top = false;
|
Top = false;
|
||||||
GenerateVtableForBase(PrimaryBase, true, false,
|
Primaries(PrimaryBase, true, PrimaryBaseWasVirtual|MorallyVirtual,
|
||||||
PrimaryBaseWasVirtual|MorallyVirtual, Offset,
|
Offset, PrimaryBaseWasVirtual);
|
||||||
PrimaryBaseWasVirtual);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// And add the virtuals for the class to the primary vtable.
|
// And add the virtuals for the class to the primary vtable.
|
||||||
|
|
Loading…
Reference in New Issue