aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-12-04 02:56:03 +0000
committerAnders Carlsson <andersca@mac.com>2009-12-04 02:56:03 +0000
commitbf54027d277650809b5957fc4165890e7202aca5 (patch)
treeb60fce2ada9dac6c311dfbd131c2716c58a40478 /lib/CodeGen
parentea357223e50bb4ecefaa9c69f421e5b37750ccc6 (diff)
Move handling of pure virtual methods to AppendMethods (and rename it to AppendMethodsToVtable).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGVtable.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index 2f5d3f7226..f1226227e6 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -289,17 +289,8 @@ public:
Index_t Offset, int64_t CurrentVBaseOffset);
/// 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) {
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
@@ -486,7 +477,7 @@ public:
assert(submethods.size() == Methods.size() && "Method size mismatch!");
- AppendMethods();
+ AppendMethodsToVtable();
// and then the non-virtual bases.
NonVirtualBases(RD, Layout, PrimaryBase, PrimaryBaseWasVirtual,
@@ -851,9 +842,7 @@ bool VtableBuilder::OverrideMethod(GlobalDecl GD, llvm::Constant *m,
return false;
}
-void VtableBuilder::AppendMethods() {
- InstallThunks();
-
+void VtableBuilder::AppendMethodsToVtable() {
for (unsigned i = 0, e = Methods.size(); i != e; ++i) {
GlobalDecl GD = Methods[i];
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
@@ -886,6 +875,9 @@ void VtableBuilder::AppendMethods() {
} else if (!ThisAdjustment.isEmpty()) {
// Build a "regular" thunk.
submethods[i] = CGM.BuildThunk(GD, Extern, ThisAdjustment);
+ } else if (MD->isPure()) {
+ // We have a pure virtual method.
+ submethods[i] = getPureVirtualFn();
}
}