[cfe-commits] r95423 - /cfe/trunk/lib/CodeGen/CGExpr.cpp

Daniel Dunbar daniel at zuster.org
Fri Feb 5 12:02:42 PST 2010


Author: ddunbar
Date: Fri Feb  5 14:02:42 2010
New Revision: 95423

URL: http://llvm.org/viewvc/llvm-project?rev=95423&view=rev
Log:
IRgen: A few more ConvertType cleanups.

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

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Feb  5 14:02:42 2010
@@ -87,7 +87,7 @@
 
   if (hasAggregateLLVMType(E->getType()) &&
       !E->getType()->isAnyComplexType())
-    AggLoc = CreateTempAlloca(ConvertType(E->getType()), "agg.tmp");
+    AggLoc = CreateTempAlloca(ConvertTypeForMem(E->getType()), "agg.tmp");
   return EmitAnyExpr(E, AggLoc, IsAggLocVolatile, /*IgnoreResult=*/false,
                      IsInitializer);
 }
@@ -1512,8 +1512,8 @@
 }
 
 LValue CodeGenFunction::EmitCompoundLiteralLValue(const CompoundLiteralExpr* E){
-  const llvm::Type *LTy = ConvertType(E->getType());
-  llvm::Value *DeclPtr = CreateTempAlloca(LTy, ".compoundliteral");
+  llvm::Value *DeclPtr = CreateTempAlloca(ConvertTypeForMem(E->getType()),
+                                          ".compoundliteral");
 
   const Expr* InitExpr = E->getInitializer();
   LValue Result = LValue::MakeAddr(DeclPtr, MakeQualifiers(E->getType()));
@@ -1628,12 +1628,8 @@
     
     return LValue::MakeAddr(Base, MakeQualifiers(E->getType()));
   }
-  case CastExpr::CK_ToUnion: {
-    llvm::Value *Temp = CreateTempAlloca(ConvertType(E->getType()));
-    EmitAnyExpr(E->getSubExpr(), Temp, false);
-
-    return LValue::MakeAddr(Temp, MakeQualifiers(E->getType()));
-  }
+  case CastExpr::CK_ToUnion:
+    return EmitAggExprToLValue(E);
   case CastExpr::CK_BaseToDerived: {
     const RecordType *BaseClassTy = 
       E->getSubExpr()->getType()->getAs<RecordType>();
@@ -1668,8 +1664,7 @@
 LValue CodeGenFunction::EmitNullInitializationLValue(
                                               const CXXZeroInitValueExpr *E) {
   QualType Ty = E->getType();
-  const llvm::Type *LTy = ConvertTypeForMem(Ty);
-  llvm::AllocaInst *Alloc = CreateTempAlloca(LTy);
+  llvm::AllocaInst *Alloc = CreateTempAlloca(ConvertTypeForMem(Ty));
   CharUnits Align = getContext().getTypeAlignInChars(Ty);
   Alloc->setAlignment(Align.getQuantity());
   LValue lvalue = LValue::MakeAddr(Alloc, Qualifiers());





More information about the cfe-commits mailing list