[PATCH] D122544: Utilize comparison operation implemented in APInt

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 29 04:06:57 PDT 2022


aaron.ballman added inline comments.


================
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; }
----------------
aaronpuchert wrote:
> 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.
Good catch! @SimplyDanny, can you fix up the test?


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