[PATCH] D155457: [clang] Skip tautological comparison if the comparison involves the 'size_t' type
Shivam Gupta via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 17 10:52:10 PDT 2023
xgupta added a comment.
In D155457#4506405 <https://reviews.llvm.org/D155457#4506405>, @xbolva00 wrote:
> You should add a testcase which uses “expected no diagnostics”.
There is some issue writing test
$ cat type-limit-compare.cpp
// RUN: %clang_cc1 -fsyntax-only -Wtautological-type-limit-compare -verify %s
// expected-no-diagnostics
#include <cstddef>
#include <cstdint>
#include <limits>
bool foo(uint64_t Size) {
if (sizeof(std::size_t) < sizeof(uint64_t) &&
Size > static_cast<uint64_t>(std::numeric_limits<std::size_t>::max())) // no-warning
return false;
return true;
}
failed with
$ llvm-project/clang/test/Sema/type-limit-compare.cpp:4:10: fatal error: 'cstddef' file not found
4 | #include <cstddef>
| ^~~~~~~~~
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155457/new/
https://reviews.llvm.org/D155457
More information about the cfe-commits
mailing list