diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-28 15:11:24 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-28 15:11:24 +0000 |
commit | 4fc7ab364110d6ad1c10dd38dbeb0597fed7e2f5 (patch) | |
tree | 7123cf844cf6971d011973cfa5775bf6f6bb5229 /lib/CodeGen/CGCXX.cpp | |
parent | 7e8f8189d0876e03ebc5018f6a22e41f5aaa20d9 (diff) |
ir-gen related patch for type conversion
with class type conversion methods. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80365 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 3c7115d683..04dbe9760a 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -262,19 +262,20 @@ CodeGenFunction::EmitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *E) { "EmitCXXFunctionalCastExpr - called with wrong cast"); CXXMethodDecl *MD = E->getTypeConversionMethod(); + assert(MD && "EmitCXXFunctionalCastExpr - null conversion method"); + assert(isa<CXXConversionDecl>(MD) && "EmitCXXFunctionalCastExpr - not" + " method decl"); const FunctionProtoType *FPT = MD->getType()->getAsFunctionProtoType(); - llvm::Constant *Callee; - if (CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(MD)) - Callee = CGM.GetAddrOfCXXConstructor(CD, Ctor_Complete); - else { - const llvm::Type *Ty = - CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD), - FPT->isVariadic()); - Callee = CGM.GetAddrOfFunction(GlobalDecl(MD), Ty); - } - llvm::Value *This = EmitLValue(E->getSubExpr()).getAddress(); - return EmitCXXMemberCall(MD, Callee, This, 0, 0); + const llvm::Type *Ty = + CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD), + FPT->isVariadic()); + llvm::Constant *Callee = CGM.GetAddrOfFunction(GlobalDecl(MD), Ty); + llvm::Value *This = EmitLValue(E->getSubExpr()).getAddress(); + RValue RV = EmitCXXMemberCall(MD, Callee, This, 0, 0); + if (RV.isAggregate()) + RV = RValue::get(RV.getAggregateAddr()); + return RV; } llvm::Value *CodeGenFunction::LoadCXXThis() { |