[clang-tools-extra] b3079e8 - [clang-tidy] Make test work on architectures which do not provide a `__int128_t`
Danny Mösch via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 29 23:03:53 PDT 2022
Author: Danny Mösch
Date: 2022-03-30T08:03:32+02:00
New Revision: b3079e8a7e06ebab63d615cfaece10c9edc3cc9f
URL: https://github.com/llvm/llvm-project/commit/b3079e8a7e06ebab63d615cfaece10c9edc3cc9f
DIFF: https://github.com/llvm/llvm-project/commit/b3079e8a7e06ebab63d615cfaece10c9edc3cc9f.diff
LOG: [clang-tidy] Make test work on architectures which do not provide a `__int128_t`
See f10cee91ae07022e602d6a47e504e86796d49a7d. The test did still not run successful since the
`CHECK-MESSAGE` line is still read and considered even though the `#ifdef` removes the code if
`__int128_t` is not available. Now there is a fallback type in this case.
Added:
Modified:
clang-tools-extra/test/clang-tidy/checkers/bugprone-sizeof-expression.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone-sizeof-expression.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone-sizeof-expression.cpp
index c93a9382d14c9..3f40d0e29024f 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone-sizeof-expression.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone-sizeof-expression.cpp
@@ -288,10 +288,12 @@ int Test6() {
#ifdef __SIZEOF_INT128__
template <__int128_t N>
+#else
+template <long N> // Fallback for platforms which do not define `__int128_t`
+#endif
bool Baz() { return sizeof(A) < N; }
// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: suspicious comparison of 'sizeof(expr)' to a constant
bool Test7() { return Baz<-1>(); }
-#endif
int ValidExpressions() {
int A[] = {1, 2, 3, 4};
More information about the cfe-commits
mailing list