]> granicus.if.org Git - clang/commitdiff
Create CXXConstructExpr calls for arguments passed to functions.
authorAnders Carlsson <andersca@mac.com>
Tue, 19 May 2009 04:45:15 +0000 (04:45 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 19 May 2009 04:45:15 +0000 (04:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72102 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExprCXX.cpp

index 109247f977e17f2a9f7aa0de2714da77e2089fc9..30a7598ec62253e01cb785513243c24ef8508376 100644 (file)
@@ -854,9 +854,13 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
   QualType FromType = From->getType();
 
   if (SCS.CopyConstructor) {
-    // FIXME: Create a temporary object by calling the copy constructor.
-    ImpCastExprToType(From, ToType.getNonReferenceType(), 
-                      ToType->isLValueReferenceType());
+    // FIXME: When can ToType be a reference type?
+    assert(!ToType->isReferenceType());
+    
+    CXXTempVarDecl *Temp = CXXTempVarDecl::Create(Context, CurContext, ToType);
+    // FIXME: Keep track of whether the copy constructor is elidable or not.
+    From = CXXConstructExpr::Create(Context, Temp, ToType, 
+                                    SCS.CopyConstructor, false, &From, 1);
     return false;
   }