[PATCH] D122544: Utilize comparison operation implemented in APInt
Aaron Puchert via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 28 18:50:33 PDT 2022
aaronpuchert added a comment.
Note that `__int128_t` is not available everywhere, generally only on 64-bit platforms.
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone-sizeof-expression.cpp:175
// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'
-int Test3() { return Foo<42>() + Bar<char>(); }
+template <__int128_t N>
+bool Baz() { return sizeof(A) < N; }
----------------
This causes test failures on 32-bit architectures:
```
/home/tcwg-buildbot/worker/clang-armv7-2stage/stage2/tools/clang/tools/extra/test/clang-tidy/checkers/Output/bugprone-sizeof-expression.cpp.tmp.cpp:175:11: error: unknown type name '__int128_t' [clang-diagnostic-error]
template <__int128_t N>
^
```
It's probably best to wrap this in `#ifdef __SIZEOF_INT128__` lest we disable the entire test on the affected platforms.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122544/new/
https://reviews.llvm.org/D122544
More information about the cfe-commits
mailing list