Move handling of pure virtual methods to AppendMethods (and rename it to AppendMethodsToVtable).
llvm-svn: 90529
This commit is contained in:
parent
5b3ea9bf1c
commit
ddf42c8d80
|
|
@ -289,17 +289,8 @@ public:
|
||||||
Index_t Offset, int64_t CurrentVBaseOffset);
|
Index_t Offset, int64_t CurrentVBaseOffset);
|
||||||
|
|
||||||
/// AppendMethods - Append the current methods to the vtable.
|
/// AppendMethods - Append the current methods to the vtable.
|
||||||
void AppendMethods();
|
void AppendMethodsToVtable();
|
||||||
|
|
||||||
void InstallThunks() {
|
|
||||||
for (PureVirtualMethodsSetTy::iterator i = PureVirtualMethods.begin(),
|
|
||||||
e = PureVirtualMethods.end(); i != e; ++i) {
|
|
||||||
GlobalDecl GD = *i;
|
|
||||||
submethods[Index[GD]] = getPureVirtualFn();
|
|
||||||
}
|
|
||||||
PureVirtualMethods.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
llvm::Constant *WrapAddrOf(GlobalDecl GD) {
|
llvm::Constant *WrapAddrOf(GlobalDecl GD) {
|
||||||
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
|
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
|
||||||
|
|
||||||
|
|
@ -486,7 +477,7 @@ public:
|
||||||
|
|
||||||
assert(submethods.size() == Methods.size() && "Method size mismatch!");
|
assert(submethods.size() == Methods.size() && "Method size mismatch!");
|
||||||
|
|
||||||
AppendMethods();
|
AppendMethodsToVtable();
|
||||||
|
|
||||||
// and then the non-virtual bases.
|
// and then the non-virtual bases.
|
||||||
NonVirtualBases(RD, Layout, PrimaryBase, PrimaryBaseWasVirtual,
|
NonVirtualBases(RD, Layout, PrimaryBase, PrimaryBaseWasVirtual,
|
||||||
|
|
@ -851,9 +842,7 @@ bool VtableBuilder::OverrideMethod(GlobalDecl GD, llvm::Constant *m,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VtableBuilder::AppendMethods() {
|
void VtableBuilder::AppendMethodsToVtable() {
|
||||||
InstallThunks();
|
|
||||||
|
|
||||||
for (unsigned i = 0, e = Methods.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Methods.size(); i != e; ++i) {
|
||||||
GlobalDecl GD = Methods[i];
|
GlobalDecl GD = Methods[i];
|
||||||
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
|
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
|
||||||
|
|
@ -886,6 +875,9 @@ void VtableBuilder::AppendMethods() {
|
||||||
} else if (!ThisAdjustment.isEmpty()) {
|
} else if (!ThisAdjustment.isEmpty()) {
|
||||||
// Build a "regular" thunk.
|
// Build a "regular" thunk.
|
||||||
submethods[i] = CGM.BuildThunk(GD, Extern, ThisAdjustment);
|
submethods[i] = CGM.BuildThunk(GD, Extern, ThisAdjustment);
|
||||||
|
} else if (MD->isPure()) {
|
||||||
|
// We have a pure virtual method.
|
||||||
|
submethods[i] = getPureVirtualFn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue