[PATCH] D85256: Add -Wtautological-value-range-compare warning.

2020-08-11 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In D85256#2211129 , @rsmith wrote: > This appears to be a general problem: the `GetExprRange` mechanism in > SemaChecking miscomputes the ranges for `+`, `*`, and `-` expressions, and > we'll get them wrong for all warnings that u

[PATCH] D85256: Add -Wtautological-value-range-compare warning.

2020-08-11 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In D85256#2209211 , @sberg wrote: > I think this generates a false positive with `test.cc` > > enum E { E1 = 1, E2 = 2 }; > bool f(E e) { return ((e & E1) ? 1 : 0) + ((e & E2) ? 1 : 0) > 1; } > > and `clang++ -fsyntax-only -Wtau

[PATCH] D85256: Add -Wtautological-value-range-compare warning.

2020-08-11 Thread Stephan Bergmann via Phabricator via cfe-commits
sberg added a comment. I think this generates a false positive with `test.cc` enum E { E1 = 1, E2 = 2 }; bool f(E e) { return ((e & E1) ? 1 : 0) + ((e & E2) ? 1 : 0) > 1; } and `clang++ -fsyntax-only -Wtautological-value-range-compare test.cc` test.cc:2:62: warning: result of comparison o

[PATCH] D85256: Add -Wtautological-value-range-compare warning.

2020-08-06 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGd6492d874478: Add -Wtautological-value-range-compare warning. (authored by rsmith). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85256/new/ https://reviews

[PATCH] D85256: Add -Wtautological-value-range-compare warning.

2020-08-06 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu accepted this revision. rtrieu added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85256/new/ https://reviews.llvm.org/D85256 ___ c

[PATCH] D85256: Add -Wtautological-value-range-compare warning.

2020-08-04 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment. >> But I think that and this are separate changes and I'd prefer not to combine >> them. Yeah, right. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85256/new/ https://reviews.llvm.org/D85256

[PATCH] D85256: Add -Wtautological-value-range-compare warning.

2020-08-04 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In D85256#2194892 , @xbolva00 wrote: > Could this solve https://bugs.llvm.org/show_bug.cgi?id=40921 ? Not directly; `GetExprRange` in `SemaChecking` apparently intentionally treats casts as producing an arbitrary value of the dest

[PATCH] D85256: Add -Wtautological-value-range-compare warning.

2020-08-04 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith updated this revision to Diff 283072. rsmith added a comment. N/A Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85256/new/ https://reviews.llvm.org/D85256 Files: clang/include/clang/Basic/DiagnosticGroups.td clang/include/clang/Basic/Di

[PATCH] D85256: Add -Wtautological-value-range-compare warning.

2020-08-04 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith updated this revision to Diff 283070. rsmith added a comment. Unbreak test that was autobroken by lint. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85256/new/ https://reviews.llvm.org/D85256 Files: clang/include/clang/Basic/DiagnosticGr

[PATCH] D85256: Add -Wtautological-value-range-compare warning.

2020-08-04 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment. Could this solve https://bugs.llvm.org/show_bug.cgi?id=40921? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85256/new/ https://reviews.llvm.org/D85256 ___ cfe-commits mailing li

[PATCH] D85256: Add -Wtautological-value-range-compare warning.

2020-08-04 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith created this revision. rsmith added a reviewer: rtrieu. Herald added a project: clang. Herald added a subscriber: cfe-commits. rsmith requested review of this revision. This warning diagnoses cases where an expression is compared to a constant, and the comparison is tautological due to the