diff options
| author | Mike Stump <mrs@apple.com> | 2009-08-12 23:00:59 +0000 |
|---|---|---|
| committer | Mike Stump <mrs@apple.com> | 2009-08-12 23:00:59 +0000 |
| commit | 82165efbc48aa36817d6d3f4599cdb23b86d0ef2 (patch) | |
| tree | c5ee33f7ec8c1aae72322e1da2642ef859f35253 /clang/lib/CodeGen/CGCXX.cpp | |
| parent | ff2db10211a12e663df0c9f25db9c42e365d2b8e (diff) | |
| download | bcm5719-llvm-82165efbc48aa36817d6d3f4599cdb23b86d0ef2.tar.gz bcm5719-llvm-82165efbc48aa36817d6d3f4599cdb23b86d0ef2.zip | |
Refactor.
llvm-svn: 78854
Diffstat (limited to 'clang/lib/CodeGen/CGCXX.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGCXX.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index 80781ad934d..e63bd7c87e0 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -621,6 +621,22 @@ llvm::Constant *CodeGenFunction::GenerateRtti(const CXXRecordDecl *RD) { return Rtti; } +void CodeGenFunction::GenerateMethods(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()) { + m = CGM.GetAddrOfFunction(GlobalDecl(*mi)); + m = llvm::ConstantExpr::getBitCast(m, Ptr8Ty); + methods.push_back(m); + } + } +} + void CodeGenFunction::GenerateVtableForBase(const CXXRecordDecl *RD, const CXXRecordDecl *Class, llvm::Constant *rtti, @@ -700,29 +716,13 @@ void CodeGenFunction::GenerateVtableForBase(const CXXRecordDecl *RD, } if (!isPrimary) { - if (!RD) - return; - - for (meth_iter mi = RD->method_begin(), me = RD->method_end(); mi != me; - ++mi) { - if (mi->isVirtual()) { - m = CGM.GetAddrOfFunction(GlobalDecl(*mi)); - m = llvm::ConstantExpr::getBitCast(m, Ptr8Ty); - methods.push_back(m); - } - } + if (RD) + GenerateMethods(methods, RD, Ptr8Ty); return; } // And add the virtuals for the class to the primary vtable. - for (meth_iter mi = Class->method_begin(), me = Class->method_end(); mi != me; - ++mi) { - if (mi->isVirtual()) { - m = CGM.GetAddrOfFunction(GlobalDecl(*mi)); - m = llvm::ConstantExpr::getBitCast(m, Ptr8Ty); - methods.push_back(m); - } - } + GenerateMethods(methods, Class, Ptr8Ty); } llvm::Value *CodeGenFunction::GenerateVtable(const CXXRecordDecl *RD) { |

