[cfe-commits] r91670 - /cfe/trunk/lib/CodeGen/CGCXX.cpp

Douglas Gregor dgregor at apple.com
Thu Dec 17 21:19:44 PST 2009


Author: dgregor
Date: Thu Dec 17 23:19:44 2009
New Revision: 91670

URL: http://llvm.org/viewvc/llvm-project?rev=91670&view=rev
Log:
Address some of Anders comments

Modified:
    cfe/trunk/lib/CodeGen/CGCXX.cpp

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=91670&r1=91669&r2=91670&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Thu Dec 17 23:19:44 2009
@@ -579,10 +579,14 @@
     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);





More information about the cfe-commits mailing list