aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-18 01:26:17 +0000
committerChris Lattner <sabre@nondot.org>2008-11-18 01:26:17 +0000
commit858bb6f2d6790feeb03b3c2a24f01ef24b54301b (patch)
tree45dd8659dd0c5d63a26cd249928acda673704ad2 /lib/Sema/SemaExpr.cpp
parentf67bd9f41ce60cbb5f107e980e940ae13471016c (diff)
implement a fixme by making warnings for ++/-- on non-modifiable-lvalues better.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59484 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 1abc5a31df..61b6f7e577 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -2368,7 +2368,7 @@ static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) {
}
if (NeedType)
- S.Diag(Loc, Diag, E->getType().getAsString(), SR);
+ S.Diag(Loc, Diag, E->getType().getAsString(), E->getSourceRange());
else
S.Diag(Loc, Diag, E->getSourceRange());
return true;
@@ -2463,13 +2463,8 @@ QualType Sema::CheckIncrementDecrementOperand(Expr *op, SourceLocation OpLoc) {
}
// At this point, we know we have a real, complex or pointer type.
// Now make sure the operand is a modifiable lvalue.
- Expr::isModifiableLvalueResult mlval = op->isModifiableLvalue(Context);
- if (mlval != Expr::MLV_Valid) {
- // FIXME: emit a more precise diagnostic...
- Diag(OpLoc, diag::err_typecheck_invalid_lvalue_incr_decr,
- op->getSourceRange());
+ if (CheckForModifiableLvalue(op, OpLoc, *this))
return QualType();
- }
return resType;
}