Author: Danny Mösch
Date: 2022-03-29T17:58:12+02:00
New Revision: f10cee91ae07022e602d6a47e504e86796d49a7d

URL: 
https://github.com/llvm/llvm-project/commit/f10cee91ae07022e602d6a47e504e86796d49a7d
DIFF: 
https://github.com/llvm/llvm-project/commit/f10cee91ae07022e602d6a47e504e86796d49a7d.diff

LOG: [clang-tidy] Fix test failing on 32-bit architectures due to missing 
`__int128_t`

This was caused by ff60af91ac0bbab12dd5ff5dc9b78bc1636f2d86. The reason for the 
failure is that
the type `__int128_t` is not available on 32-bit architectures. So just exclude 
the test case if
128-bit integers are not available.

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 605243cf7a782..c93a9382d14c9 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
@@ -172,10 +172,7 @@ int Foo() { int A[T]; return sizeof(T); }
 template <typename T>
 int Bar() { T A[5]; return sizeof(A[0]) / sizeof(T); }
 // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: suspicious usage of sizeof 
pointer 'sizeof(T)/sizeof(T)'
-template <__int128_t N> 
-bool Baz() { return sizeof(A) < N; }
-// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: suspicious comparison of 
'sizeof(expr)' to a constant
-int Test3() { return Foo<42>() + Bar<char>() + Baz<-1>(); }
+int Test3() { return Foo<42>() + Bar<char>(); }
 
 static const char* kABC = "abc";
 static const wchar_t* kDEF = L"def";
@@ -289,6 +286,13 @@ int Test6() {
   return sum;
 }
 
+#ifdef __SIZEOF_INT128__
+template <__int128_t N> 
+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};
   static const char str[] = "hello";


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to