[PATCH] D38101: [Sema] Diagnose tautological comparison with type's min/max values

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 20 14:38:41 PDT 2017


lebedev.ri created this revision.
lebedev.ri added a project: clang.

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

I don't really like this code, but given the previous feedback in https://reviews.llvm.org/D37629,
i decided to do it in the most simple way possible for now, and change it given on review feedback.

Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147
Continuation of https://reviews.llvm.org/D37565


Repository:
  rL LLVM

https://reviews.llvm.org/D38101

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaChecking.cpp
  test/Sema/outof-range-constant-compare.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38101.116075.patch
Type: text/x-patch
Size: 17516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170920/883802a0/attachment.bin>


More information about the cfe-commits mailing list