[Sema] Re-land: Diagnose tautological comparison with type's min/max values
The first attempt, rL315614 was reverted because one libcxx test broke, and i did not know at the time how to deal with it. Summary: Currently, clang only diagnoses completely out-of-range comparisons (e.g. `char` and constant `300`), and comparisons of unsigned and `0`. But gcc also does diagnose the comparisons with the `std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147 Continuation of https://reviews.llvm.org/D37565 Reviewers: rjmccall, rsmith, aaron.ballman Reviewed By: rsmith Subscribers: rtrieu, jroelofs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D38101 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315875 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- docs/ReleaseNotes.rst 4 additions, 0 deletionsdocs/ReleaseNotes.rst
- include/clang/Basic/DiagnosticGroups.td 5 additions, 3 deletionsinclude/clang/Basic/DiagnosticGroups.td
- include/clang/Basic/DiagnosticSemaKinds.td 10 additions, 10 deletionsinclude/clang/Basic/DiagnosticSemaKinds.td
- lib/Sema/SemaChecking.cpp 146 additions, 95 deletionslib/Sema/SemaChecking.cpp
- test/Analysis/conversion.c 1 addition, 1 deletiontest/Analysis/conversion.c
- test/Analysis/null-deref-ps.c 2 additions, 2 deletionstest/Analysis/null-deref-ps.c
- test/Sema/outof-range-constant-compare.c 0 additions, 159 deletionstest/Sema/outof-range-constant-compare.c
- test/Sema/tautological-constant-compare.c 514 additions, 0 deletionstest/Sema/tautological-constant-compare.c
- test/Sema/tautological-unsigned-zero-compare.c 350 additions, 27 deletionstest/Sema/tautological-unsigned-zero-compare.c
Loading
Please register or sign in to comment