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);
}
}
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()));
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>();
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());