implement codegen support for preinc as an lvalue, PR5514.

llvm-svn: 93076
This commit is contained in:
Chris Lattner 2010-01-09 21:44:40 +00:00
parent 116ce8f172
commit bb8976e36e
2 changed files with 14 additions and 2 deletions

View File

@ -1120,8 +1120,16 @@ LValue CodeGenFunction::EmitUnaryOpLValue(const UnaryOperator *E) {
MakeQualifiers(ExprTy));
}
case UnaryOperator::PreInc:
case UnaryOperator::PreDec:
return EmitUnsupportedLValue(E, "pre-inc/dec expression");
case UnaryOperator::PreDec: {
LValue LV = EmitLValue(E->getSubExpr());
bool isInc = E->getOpcode() == UnaryOperator::PreInc;
if (E->getType()->isAnyComplexType())
EmitComplexPrePostIncDec(E, LV, isInc, true/*isPre*/);
else
EmitScalarPrePostIncDec(E, LV, isInc, true/*isPre*/);
return LV;
}
}
}

View File

@ -10,3 +10,7 @@ void test1() {
char *xpto;
while ( true && xpto[0] );
}
// PR5514
int a;
void test2() { ++a+=10; }