aaron.ballman added a comment. In D155457#4507107 <https://reviews.llvm.org/D155457#4507107>, @xgupta wrote:
> 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> > | ^~~~~~~~~ We typically do not include any system headers (STL or otherwise) as part of the compiler tests; that would test whatever is found on the test system instead of a consistent test. Instead, I'd recommend doing: namespace std { using size_t = decltype(sizeof(0)); } Similarly, you can replace `uint64_t` with `unsigned long long` and the `numeric_limits` call with `__SIZE_MAX__` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155457/new/ https://reviews.llvm.org/D155457 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits