[cfe-commits] r95226 - /cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Anders Carlsson andersca at mac.com
Wed Feb 3 09:33:16 PST 2010


Author: andersca
Date: Wed Feb  3 11:33:16 2010
New Revision: 95226

URL: http://llvm.org/viewvc/llvm-project?rev=95226&view=rev
Log:
More cleanup.

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

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Wed Feb  3 11:33:16 2010
@@ -118,7 +118,7 @@
 
   void VisitVAArgExpr(VAArgExpr *E);
 
-  void EmitInitializationToLValue(Expr *E, LValue Address);
+  void EmitInitializationToLValue(Expr *E, LValue Address, QualType T);
   void EmitNullInitializationToLValue(LValue Address, QualType T);
   //  case Expr::ChooseExprClass:
   void VisitCXXThrowExpr(const CXXThrowExpr *E) { CGF.EmitCXXThrowExpr(E); }
@@ -188,7 +188,8 @@
     llvm::Value *CastPtr = Builder.CreateBitCast(DestPtr,
                                                  CGF.ConvertType(PtrTy));
     EmitInitializationToLValue(E->getSubExpr(),
-                               LValue::MakeAddr(CastPtr, Qualifiers()));
+                               LValue::MakeAddr(CastPtr, Qualifiers()), 
+                               E->getType());
     break;
   }
 
@@ -511,17 +512,18 @@
   EmitNullInitializationToLValue(LV, E->getType());
 }
 
-void AggExprEmitter::EmitInitializationToLValue(Expr* E, LValue LV) {
+void 
+AggExprEmitter::EmitInitializationToLValue(Expr* E, LValue LV, QualType T) {
   // FIXME: Ignore result?
   // FIXME: Are initializers affected by volatile?
   if (isa<ImplicitValueInitExpr>(E)) {
-    EmitNullInitializationToLValue(LV, E->getType());
-  } else if (E->getType()->isComplexType()) {
+    EmitNullInitializationToLValue(LV, T);
+  } else if (T->isAnyComplexType()) {
     CGF.EmitComplexExprIntoAddr(E, LV.getAddress(), false);
-  } else if (CGF.hasAggregateLLVMType(E->getType())) {
+  } else if (CGF.hasAggregateLLVMType(T)) {
     CGF.EmitAnyExpr(E, LV.getAddress(), false);
   } else {
-    CGF.EmitStoreThroughLValue(CGF.EmitAnyExpr(E), LV, E->getType());
+    CGF.EmitStoreThroughLValue(CGF.EmitAnyExpr(E), LV, T);
   }
 }
 
@@ -590,7 +592,8 @@
       llvm::Value *NextVal = Builder.CreateStructGEP(DestPtr, i, ".array");
       if (i < NumInitElements)
         EmitInitializationToLValue(E->getInit(i),
-                                   LValue::MakeAddr(NextVal, Quals));
+                                   LValue::MakeAddr(NextVal, Quals), 
+                                   ElementType);
       else
         EmitNullInitializationToLValue(LValue::MakeAddr(NextVal, Quals),
                                        ElementType);
@@ -631,7 +634,7 @@
 
     if (NumInitElements) {
       // Store the initializer into the field
-      EmitInitializationToLValue(E->getInit(0), FieldLoc);
+      EmitInitializationToLValue(E->getInit(0), FieldLoc, Field->getType());
     } else {
       // Default-initialize to null
       EmitNullInitializationToLValue(FieldLoc, Field->getType());
@@ -658,7 +661,8 @@
     LValue::SetObjCNonGC(FieldLoc, true);
     if (CurInitVal < NumInitElements) {
       // Store the initializer into the field
-      EmitInitializationToLValue(E->getInit(CurInitVal++), FieldLoc);
+      EmitInitializationToLValue(E->getInit(CurInitVal++), FieldLoc, 
+                                 Field->getType());
     } else {
       // We're out of initalizers; default-initialize to null
       EmitNullInitializationToLValue(FieldLoc, Field->getType());





More information about the cfe-commits mailing list