diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-18 05:19:44 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-18 05:19:44 +0000 |
commit | 9657c443688998dc84915e841a10509017b209db (patch) | |
tree | 11a8cf9b4c7af24c12ae1ebf86a1e44874562b91 /lib/CodeGen/CGCXX.cpp | |
parent | 18ef5e28a9a2677f8b1dce1fb2638d66e0a1621f (diff) |
Address some of Anders comments
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91670 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 21f3e00ac0..011257b749 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -579,10 +579,14 @@ CodeGenFunction::EmitCXXConstructExpr(llvm::Value *Dest, const Expr *Arg = E->getArg(0); if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Arg)) { - if (isa<CXXBindTemporaryExpr>(ICE->getSubExpr())) - Arg = cast<CXXBindTemporaryExpr>(ICE->getSubExpr())->getSubExpr(); - } else if (const CXXBindTemporaryExpr *BindExpr = - dyn_cast<CXXBindTemporaryExpr>(Arg)) + assert((ICE->getCastKind() == CastExpr::CK_NoOp || + ICE->getCastKind() == CastExpr::CK_ConstructorConversion) && + "Unknown implicit cast kind in constructor elision"); + Arg = ICE->getSubExpr(); + } + + if (const CXXBindTemporaryExpr *BindExpr = + dyn_cast<CXXBindTemporaryExpr>(Arg)) Arg = BindExpr->getSubExpr(); EmitAggExpr(Arg, Dest, false); |