Implement codegen for comma operator for structs.

llvm-svn: 51304
This commit is contained in:
Eli Friedman 2008-05-20 07:56:31 +00:00
parent 5148a4ba66
commit 4b0e2a30e0
2 changed files with 11 additions and 0 deletions

View File

@ -82,6 +82,7 @@ public:
void VisitBinaryOperator(const BinaryOperator *BO);
void VisitBinAssign(const BinaryOperator *E);
void VisitOverloadExpr(const OverloadExpr *E);
void VisitBinComma(const BinaryOperator *E);
void VisitConditionalOperator(const ConditionalOperator *CO);
@ -213,6 +214,12 @@ void AggExprEmitter::VisitOverloadExpr(const OverloadExpr *E)
EmitAggregateCopy(DestPtr, RV.getAggregateAddr(), E->getType());
}
void AggExprEmitter::VisitBinComma(const BinaryOperator *E)
{
CGF.EmitAnyExpr(E->getLHS());
CGF.EmitAggExpr(E->getRHS(), DestPtr, false);
}
void AggExprEmitter::VisitStmtExpr(const StmtExpr *E) {
CGF.EmitCompoundStmt(*E->getSubStmt(), true, DestPtr, VolatileDest);
}

View File

@ -0,0 +1,4 @@
// RUN: clang %s -emit-llvm
struct S {int a, b;} x;
void a(struct S* b) {*b = (r(), x);}