diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2017-09-20 09:54:47 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2017-09-20 09:54:47 +0000 |
commit | b0f0a1ea03b55df2c0fcd7e7d56006b7a849124b (patch) | |
tree | 503f46ed5a25839ab9b2328a097a55fbb115c06f /llvm/lib/CodeGen/MachineTraceMetrics.cpp | |
parent | 89628f641407c2b03899509b9a3317f792f634c3 (diff) | |
download | llvm-b0f0a1ea03b55df2c0fcd7e7d56006b7a849124b.zip llvm-b0f0a1ea03b55df2c0fcd7e7d56006b7a849124b.tar.gz llvm-b0f0a1ea03b55df2c0fcd7e7d56006b7a849124b.tar.bz2 |
[Sema] Move some stuff into -Wtautological-unsigned-enum-zero-compare
Recommit. Original commit was reverted because buildbots broke.
The error was only reproducible in the build with assertions.
The problem was that the diagnostic expected true/false as
bool, while it was provided as string "true"/"false".
Summary:
As requested by Sam McCall:
> Enums (not new I guess). Typical case: if (enum < 0 || enum > MAX)
> The warning strongly suggests that the enum < 0 check has no effect
> (for enums with nonnegative ranges).
> Clang doesn't seem to optimize such checks out though, and they seem
> likely to catch bugs in some cases. Yes, only if there's UB elsewhere,
> but I assume not optimizing out these checks indicates a deliberate
> decision to stay somewhat compatible with a technically-incorrect
> mental model.
> If this is the case, should we move these to a
> -Wtautological-compare-enum subcategory?
Reviewers: rjmccall, rsmith, aaron.ballman, sammccall, bkramer, djasper
Reviewed By: aaron.ballman
Subscribers: jroelofs, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D37629
llvm-svn: 313745
Diffstat (limited to 'llvm/lib/CodeGen/MachineTraceMetrics.cpp')
0 files changed, 0 insertions, 0 deletions