diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-02-05 19:38:31 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-02-05 19:38:31 +0000 |
commit | 18aba0dd518e486d8b50523e7dafb4b5657135d2 (patch) | |
tree | cb4857d9acfce92362240c3a9a924cab0896f50c /lib/CodeGen/CGExprAgg.cpp | |
parent | 5ed676c90c839c89093b605d76c7e581ab69ebb8 (diff) |
IRgen: Factor out EmitAggExprToLValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95416 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r-- | lib/CodeGen/CGExprAgg.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index ba25f358e8..bdeecb85be 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -685,6 +685,8 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) { /// type. The result is computed into DestPtr. Note that if DestPtr is null, /// the value of the aggregate expression is not needed. If VolatileDest is /// true, DestPtr cannot be 0. +// +// FIXME: Take Qualifiers object. void CodeGenFunction::EmitAggExpr(const Expr *E, llvm::Value *DestPtr, bool VolatileDest, bool IgnoreResult, bool IsInitializer, @@ -699,6 +701,14 @@ void CodeGenFunction::EmitAggExpr(const Expr *E, llvm::Value *DestPtr, .Visit(const_cast<Expr*>(E)); } +LValue CodeGenFunction::EmitAggExprToLValue(const Expr *E) { + assert(hasAggregateLLVMType(E->getType()) && "Invalid argument!"); + Qualifiers Q = MakeQualifiers(E->getType()); + llvm::Value *Temp = CreateTempAlloca(ConvertTypeForMem(E->getType())); + EmitAggExpr(E, Temp, Q.hasVolatile()); + return LValue::MakeAddr(Temp, Q); +} + void CodeGenFunction::EmitAggregateClear(llvm::Value *DestPtr, QualType Ty) { assert(!Ty->isAnyComplexType() && "Shouldn't happen for complex"); |