switch (E->getStmtClass()) {
default: return EmitUnsupportedLValue(E, "l-value expression");
+ case Expr::BinaryOperatorClass:
+ return EmitBinaryOperatorLValue(cast<BinaryOperator>(E));
case Expr::CallExprClass: return EmitCallExprLValue(cast<CallExpr>(E));
case Expr::DeclRefExprClass: return EmitDeclRefLValue(cast<DeclRefExpr>(E));
case Expr::ParenExprClass:return EmitLValue(cast<ParenExpr>(E)->getSubExpr());
dyn_cast<const FunctionDecl>(DRExpr->getDecl()))
if (unsigned builtinID = FDecl->getIdentifier()->getBuiltinID())
return EmitBuiltinExpr(builtinID, E);
-
+
llvm::Value *Callee = EmitScalarExpr(E->getCallee());
return EmitCallExpr(Callee, E->getCallee()->getType(),
E->arg_begin(), E->arg_end());
return EmitCallExpr(Callee, FnExpr->getType(), ArgBeg, ArgEnd);
}
+LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
+ // Can only get l-value for binary operator expressions which are a
+ // simple assignment of aggregate type.
+ if (E->getOpcode() != BinaryOperator::Assign)
+ return EmitUnsupportedLValue(E, "binary l-value expression");
+
+ llvm::Value *Temp = CreateTempAlloca(ConvertType(E->getType()));
+ EmitAggExpr(E, Temp, false);
+ // FIXME: Are these qualifiers correct?
+ return LValue::MakeAddr(Temp, E->getType().getCVRQualifiers());
+}
+
LValue CodeGenFunction::EmitCallExprLValue(const CallExpr *E) {
// Can only get l-value for call expression returning aggregate type
RValue RV = EmitCallExpr(E);
void EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst, QualType Ty);
void EmitStoreThroughPropertyRefLValue(RValue Src, LValue Dst, QualType Ty);
+ // Note: only availabe for agg return types
+ LValue EmitBinaryOperatorLValue(const BinaryOperator *E);
// Note: only availabe for agg return types
LValue EmitCallExprLValue(const CallExpr *E);
int location;
int length;
} range;
-
extern range f6();
void f7()
{
struct __attribute__((packed)) SS { long double a; char b; } SS;
+
+/* As lvalue */
+
+int f15() {
+ extern range f15_ext();
+ return f15_ext().location;
+}
+
+range f16() {
+ extern rangepair f16_ext();
+ return f16_ext().range1;
+}
+
+int f17() {
+ extern range f17_ext();
+ range r;
+ return (r = f17_ext()).location;
+}
+
+range f18() {
+ extern rangepair f18_ext();
+ rangepair rp;
+ return (rp = f18_ext()).range1;
+}