[cfe-commits] r78857 - in /cfe/trunk/lib/CodeGen: CGCXX.cpp CodeGenFunction.h
Mike Stump
mrs at apple.com
Wed Aug 12 16:14:13 PDT 2009
Author: mrs
Date: Wed Aug 12 18:14:12 2009
New Revision: 78857
URL: http://llvm.org/viewvc/llvm-project?rev=78857&view=rev
Log:
Refactor. WIP. Eventually, this will all go into a vtable builder class.
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=78857&r1=78856&r2=78857&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Wed Aug 12 18:14:12 2009
@@ -621,6 +621,21 @@
return Rtti;
}
+void CodeGenFunction::GenerateVcalls(std::vector<llvm::Constant *> &methods,
+ const CXXRecordDecl *RD,
+ llvm::Type *Ptr8Ty) {
+ typedef CXXRecordDecl::method_iterator meth_iter;
+ llvm::Constant *m;
+ for (meth_iter mi = RD->method_begin(),
+ me = RD->method_end(); mi != me; ++mi) {
+ if (mi->isVirtual()) {
+ // FIXME: vcall: offset for virtual base for this function
+ m = llvm::Constant::getNullValue(Ptr8Ty);
+ methods.push_back(m);
+ }
+ }
+}
+
void CodeGenFunction::GenerateMethods(std::vector<llvm::Constant *> &methods,
const CXXRecordDecl *RD,
llvm::Type *Ptr8Ty) {
@@ -673,14 +688,8 @@
// then comes the the vcall offsets for all our functions...
if (isPrimary && ForVirtualBase)
- for (meth_iter mi = Class->method_begin(),
- me = Class->method_end(); mi != me; ++mi) {
- if (mi->isVirtual()) {
- // FIXME: vcall: offset for virtual base for this function
- m = llvm::Constant::getNullValue(Ptr8Ty);
- methods.push_back(m);
- }
- }
+ GenerateVcalls(methods, Class, Ptr8Ty);
+
bool TopPrimary = true;
// Primary tables are composed from the chain of primaries.
if (isPrimary) {
@@ -696,14 +705,7 @@
}
// then come the vcall offsets for all our virtual bases.
if (!isPrimary && RD && ForVirtualBase)
- for (meth_iter mi = RD->method_begin(), me = RD->method_end(); mi != me;
- ++mi) {
- if (mi->isVirtual()) {
- // FIXME: vcall: offset for virtual base for this function
- m = llvm::Constant::getNullValue(Ptr8Ty);
- methods.push_back(m);
- }
- }
+ GenerateVcalls(methods, RD, Ptr8Ty);
if (TopPrimary) {
if (RD) {
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=78857&r1=78856&r2=78857&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Aug 12 18:14:12 2009
@@ -359,6 +359,8 @@
void FinishFunction(SourceLocation EndLoc=SourceLocation());
llvm::Constant *GenerateRtti(const CXXRecordDecl *RD);
+ void GenerateVcalls(std::vector<llvm::Constant *> &methods,
+ const CXXRecordDecl *RD, llvm::Type *Ptr8Ty);
void GenerateMethods(std::vector<llvm::Constant *> &methods,
const CXXRecordDecl *RD, llvm::Type *Ptr8Ty);
void GenerateVtableForBase(const CXXRecordDecl *RD,
More information about the cfe-commits
mailing list