diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2010-02-05 20:02:42 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2010-02-05 20:02:42 +0000 |
| commit | 9c4e4651d520f3d4743429530e91b6f93ca138a7 (patch) | |
| tree | beb2fed560faa24d7dad1e2b4ae38e301a5377f7 /clang/lib/CodeGen | |
| parent | b9397108c54851ce5f807420093df7102d5806a8 (diff) | |
| download | bcm5719-llvm-9c4e4651d520f3d4743429530e91b6f93ca138a7.tar.gz bcm5719-llvm-9c4e4651d520f3d4743429530e91b6f93ca138a7.zip | |
IRgen: A few more ConvertType cleanups.
llvm-svn: 95423
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index be5c7482b25..2684eb6e3ce 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -87,7 +87,7 @@ RValue CodeGenFunction::EmitAnyExprToTemp(const Expr *E, 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 @@ CodeGenFunction::EmitLValueForFieldInitialization(llvm::Value* BaseValue, } 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 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { 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::EmitCastLValue(const CastExpr *E) { 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()); |

