aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-10-27 23:46:47 +0000
committerMike Stump <mrs@apple.com>2009-10-27 23:46:47 +0000
commit94aff9341e7996f012e937385be18cd19f68a45e (patch)
tree4c2ab94bbe2d287be1445d81ca2895c81e4e9d93 /lib/CodeGen
parent1ae3178842823dfeb5586856659d75e77b62de30 (diff)
Prep work for putting ___cxa_pure_virtual in the vtables for pure functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85345 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGVtable.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index bed15132de..0b81c2165e 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -43,6 +43,9 @@ private:
llvm::DenseMap<const CXXMethodDecl *, Index_t> VCall;
llvm::DenseMap<const CXXMethodDecl *, Index_t> VCallOffset;
llvm::DenseMap<const CXXRecordDecl *, Index_t> VBIndex;
+
+ typedef llvm::DenseMap<const CXXMethodDecl *, int> Pures_t;
+ Pures_t Pures;
typedef std::pair<Index_t, Index_t> CallOffset;
typedef llvm::DenseMap<const CXXMethodDecl *, CallOffset> Thunks_t;
Thunks_t Thunks;
@@ -58,6 +61,7 @@ private:
Index_t extra;
int CurrentVBaseOffset;
typedef std::vector<std::pair<const CXXRecordDecl *, int64_t> > Path_t;
+ llvm::Constant *cxa_pure;
public:
VtableBuilder(std::vector<llvm::Constant *> &meth,
const CXXRecordDecl *c,
@@ -68,6 +72,8 @@ public:
LLVMPointerWidth(cgm.getContext().Target.getPointerWidth(0)),
CurrentVBaseOffset(0) {
Ptr8Ty = llvm::PointerType::get(llvm::Type::getInt8Ty(VMContext), 0);
+ // FIXME: ___cxa_pure_virtual
+ cxa_pure = wrap((Index_t)0);
}
llvm::DenseMap<const CXXMethodDecl *, Index_t> &getIndex() { return Index; }
@@ -285,6 +291,13 @@ public:
v_r);
}
CovariantThunks.clear();
+ for (Pures_t::iterator i = Pures.begin(), e = Pures.end();
+ i != e; ++i) {
+ const CXXMethodDecl *MD = i->first;
+ Index_t idx = Index[MD];
+ submethods[idx] = cxa_pure;
+ }
+ Pures.clear();
}
llvm::Constant *WrapAddrOf(const CXXMethodDecl *MD) {