From: Anders Carlsson Date: Tue, 19 May 2009 04:48:36 +0000 (+0000) Subject: Have AggExprEmitter::VisitCXXConstructExpr make new variables if necessary. Stub... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f6ad153565245026c7569314f65a4d4ff4ac41f;p=clang Have AggExprEmitter::VisitCXXConstructExpr make new variables if necessary. Stub out VisitCXXExprWithTemporaries. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72103 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index b216cf70a4..92e535a5f0 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -99,6 +99,8 @@ public: Visit(DAE->getExpr()); } void VisitCXXConstructExpr(const CXXConstructExpr *E); + void VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E); + void VisitVAArgExpr(VAArgExpr *E); void EmitInitializationToLValue(Expr *E, LValue Address); @@ -295,9 +297,22 @@ void AggExprEmitter::VisitVAArgExpr(VAArgExpr *VE) { void AggExprEmitter::VisitCXXConstructExpr(const CXXConstructExpr *E) { - assert(DestPtr && "Must have a dest to emit into!"); + llvm::Value *V = DestPtr; + + if (!V) { + assert(isa(E->getVarDecl()) && + "Must have a temp var decl when there's no destination!"); + + V = CGF.CreateTempAlloca(CGF.ConvertType(E->getVarDecl()->getType()), + "tmpvar"); + } - CGF.EmitCXXConstructExpr(DestPtr, E); + CGF.EmitCXXConstructExpr(V, E); +} + +void AggExprEmitter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) { + // FIXME: Do something with the temporaries! + Visit(E->getSubExpr()); } void AggExprEmitter::EmitInitializationToLValue(Expr* E, LValue LV) { diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 5e0159e597..6ceb2a6790 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -269,6 +269,11 @@ public: return CGF.LoadCXXThis(); } + Value *VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) { + // FIXME: Do something with the temporaries! + return Visit(E->getSubExpr()); + } + // Binary Operators. Value *EmitMul(const BinOpInfo &Ops) { if (CGF.getContext().getLangOptions().OverflowChecking