[cfe-commits] r51304 - in /cfe/trunk: lib/CodeGen/CGExprAgg.cpp test/CodeGen/struct-comma.c
Eli Friedman
eli.friedman at gmail.com
Tue May 20 00:56:31 PDT 2008
Author: efriedma
Date: Tue May 20 02:56:31 2008
New Revision: 51304
URL: http://llvm.org/viewvc/llvm-project?rev=51304&view=rev
Log:
Implement codegen for comma operator for structs.
Added:
cfe/trunk/test/CodeGen/struct-comma.c
Modified:
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=51304&r1=51303&r2=51304&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Tue May 20 02:56:31 2008
@@ -82,6 +82,7 @@
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 @@
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);
}
Added: cfe/trunk/test/CodeGen/struct-comma.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/struct-comma.c?rev=51304&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/struct-comma.c (added)
+++ cfe/trunk/test/CodeGen/struct-comma.c Tue May 20 02:56:31 2008
@@ -0,0 +1,4 @@
+// RUN: clang %s -emit-llvm
+
+struct S {int a, b;} x;
+void a(struct S* b) {*b = (r(), x);}
More information about the cfe-commits
mailing list