[cfe-commits] r70067 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CodeGenFunction.h test/CodeGen/exprs.c
Chris Lattner
sabre at nondot.org
Sat Apr 25 12:35:26 PDT 2009
Author: lattner
Date: Sat Apr 25 14:35:26 2009
New Revision: 70067
URL: http://llvm.org/viewvc/llvm-project?rev=70067&view=rev
Log:
fix PR4067: [Linux kernel] cannot aggregate codegen stmtexpr as lvalue
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/test/CodeGen/exprs.c
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=70067&r1=70066&r2=70067&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Sat Apr 25 14:35:26 2009
@@ -168,8 +168,10 @@
case Expr::ObjCKVCRefExprClass:
return EmitObjCKVCRefLValue(cast<ObjCKVCRefExpr>(E));
case Expr::ObjCSuperExprClass:
- return EmitObjCSuperExpr(cast<ObjCSuperExpr>(E));
+ return EmitObjCSuperExprLValue(cast<ObjCSuperExpr>(E));
+ case Expr::StmtExprClass:
+ return EmitStmtExprLValue(cast<StmtExpr>(E));
case Expr::UnaryOperatorClass:
return EmitUnaryOpLValue(cast<UnaryOperator>(E));
case Expr::ArraySubscriptExprClass:
@@ -1195,10 +1197,21 @@
}
LValue
-CodeGenFunction::EmitObjCSuperExpr(const ObjCSuperExpr *E) {
+CodeGenFunction::EmitObjCSuperExprLValue(const ObjCSuperExpr *E) {
return EmitUnsupportedLValue(E, "use of super");
}
+LValue CodeGenFunction::EmitStmtExprLValue(const StmtExpr *E) {
+
+ // Can only get l-value for message expression returning aggregate type
+ RValue RV = EmitAnyExprToTemp(E);
+ // FIXME: can this be volatile?
+ return LValue::MakeAddr(RV.getAggregateAddr(),
+ E->getType().getCVRQualifiers(),
+ getContext().getObjCGCAttrKind(E->getType()));
+}
+
+
RValue CodeGenFunction::EmitCallExpr(llvm::Value *Callee, QualType CalleeType,
CallExpr::const_arg_iterator ArgBeg,
CallExpr::const_arg_iterator ArgEnd,
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=70067&r1=70066&r2=70067&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Sat Apr 25 14:35:26 2009
@@ -78,8 +78,6 @@
}
// Operators.
- // case Expr::UnaryOperatorClass:
- // case Expr::CastExprClass:
void VisitCStyleCastExpr(CStyleCastExpr *E);
void VisitImplicitCastExpr(ImplicitCastExpr *E);
void VisitCallExpr(const CallExpr *E);
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=70067&r1=70066&r2=70067&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sat Apr 25 14:35:26 2009
@@ -645,7 +645,8 @@
LValue EmitObjCIvarRefLValue(const ObjCIvarRefExpr *E);
LValue EmitObjCPropertyRefLValue(const ObjCPropertyRefExpr *E);
LValue EmitObjCKVCRefLValue(const ObjCKVCRefExpr *E);
- LValue EmitObjCSuperExpr(const ObjCSuperExpr *E);
+ LValue EmitObjCSuperExprLValue(const ObjCSuperExpr *E);
+ LValue EmitStmtExprLValue(const StmtExpr *E);
//===--------------------------------------------------------------------===//
// Scalar Expression Emission
Modified: cfe/trunk/test/CodeGen/exprs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exprs.c?rev=70067&r1=70066&r2=70067&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/exprs.c (original)
+++ cfe/trunk/test/CodeGen/exprs.c Sat Apr 25 14:35:26 2009
@@ -99,3 +99,8 @@
void f7() {
__func__;
}
+
+// PR4067
+int f8() {
+ return ({ foo(); }).Y;
+}
More information about the cfe-commits
mailing list