diff options
author | John McCall <rjmccall@apple.com> | 2011-07-13 06:35:24 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-07-13 06:35:24 +0000 |
commit | c368838b20d84137f7e42ba02b00d3113fed7a57 (patch) | |
tree | b08e4472e6897e0000a16e68855b88c8b6074db5 /clang/lib/Sema/SemaChecking.cpp | |
parent | f677a8e99eb93f078bfafe0792f5ae3e98885d8d (diff) | |
download | bcm5719-llvm-c368838b20d84137f7e42ba02b00d3113fed7a57.tar.gz bcm5719-llvm-c368838b20d84137f7e42ba02b00d3113fed7a57.zip |
Make the integer-range analysis recognize ^= correctly,
and (while I'm at it) teach it to grok the results of simple
assignments.
The first is PR10336.
llvm-svn: 135034
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 8bad032911f..267cda8f401 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -2586,15 +2586,24 @@ IntRange GetExprRange(ASTContext &C, Expr *E, unsigned MaxWidth) { case BO_NE: return IntRange::forBoolType(); - // The type of these compound assignments is the type of the LHS, - // so the RHS is not necessarily an integer. + // The type of the assignments is the type of the LHS, so the RHS + // is not necessarily the same type. case BO_MulAssign: case BO_DivAssign: case BO_RemAssign: case BO_AddAssign: case BO_SubAssign: + case BO_XorAssign: + case BO_OrAssign: + // TODO: bitfields? return IntRange::forValueOfType(C, E->getType()); + // Simple assignments just pass through the RHS, which will have + // been coerced to the LHS type. + case BO_Assign: + // TODO: bitfields? + return GetExprRange(C, BO->getRHS(), MaxWidth); + // Operations with opaque sources are black-listed. case BO_PtrMemD: case BO_PtrMemI: |