diff options
Diffstat (limited to 'clang-tools-extra/test/clang-tidy')
9 files changed, 0 insertions, 1035 deletions
diff --git a/clang-tools-extra/test/clang-tidy/cert-uppercase-literal-suffix-integer.cpp b/clang-tools-extra/test/clang-tidy/cert-uppercase-literal-suffix-integer.cpp deleted file mode 100644 index c19aacdd1b6..00000000000 --- a/clang-tools-extra/test/clang-tidy/cert-uppercase-literal-suffix-integer.cpp +++ /dev/null @@ -1,159 +0,0 @@ -// RUN: %check_clang_tidy %s cert-dcl16-c %t -- -- -I %S -// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp -// RUN: clang-tidy %t.cpp -checks='-*,cert-dcl16-c' -fix -- -I %S -// RUN: clang-tidy %t.cpp -checks='-*,cert-dcl16-c' -warnings-as-errors='-*,cert-dcl16-c' -- -I %S - -#include "readability-uppercase-literal-suffix.h" - -void integer_suffix() { - static constexpr auto v0 = __LINE__; // synthetic - static_assert(v0 == 9 || v0 == 5, ""); - - static constexpr auto v1 = __cplusplus; // synthetic, long - - static constexpr auto v2 = 1; // no literal - static_assert(is_same<decltype(v2), const int>::value, ""); - static_assert(v2 == 1, ""); - - // Unsigned - - static constexpr auto v3 = 1u; - static_assert(is_same<decltype(v3), const unsigned int>::value, ""); - static_assert(v3 == 1, ""); - - static constexpr auto v4 = 1U; // OK. - static_assert(is_same<decltype(v4), const unsigned int>::value, ""); - static_assert(v4 == 1, ""); - - // Long - - static constexpr auto v5 = 1l; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'l', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 1l; - // CHECK-MESSAGES-NEXT: ^~ - // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}} - // CHECK-FIXES: static constexpr auto v5 = 1L; - static_assert(is_same<decltype(v5), const long>::value, ""); - static_assert(v5 == 1, ""); - - static constexpr auto v6 = 1L; // OK. - static_assert(is_same<decltype(v6), const long>::value, ""); - static_assert(v6 == 1, ""); - - // Long Long - - static constexpr auto v7 = 1ll; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'll', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 1ll; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LL{{$}} - // CHECK-FIXES: static constexpr auto v7 = 1LL; - static_assert(is_same<decltype(v7), const long long>::value, ""); - static_assert(v7 == 1, ""); - - static constexpr auto v8 = 1LL; // OK. - static_assert(is_same<decltype(v8), const long long>::value, ""); - static_assert(v8 == 1, ""); - - // Unsigned Long - - static constexpr auto v9 = 1ul; - static_assert(is_same<decltype(v9), const unsigned long>::value, ""); - static_assert(v9 == 1, ""); - - static constexpr auto v10 = 1uL; - static_assert(is_same<decltype(v10), const unsigned long>::value, ""); - static_assert(v10 == 1, ""); - - static constexpr auto v11 = 1Ul; - static_assert(is_same<decltype(v11), const unsigned long>::value, ""); - static_assert(v11 == 1, ""); - - static constexpr auto v12 = 1UL; // OK. - static_assert(is_same<decltype(v12), const unsigned long>::value, ""); - static_assert(v12 == 1, ""); - - // Long Unsigned - - static constexpr auto v13 = 1lu; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'lu', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v13 = 1lu; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LU{{$}} - // CHECK-FIXES: static constexpr auto v13 = 1LU; - static_assert(is_same<decltype(v13), const unsigned long>::value, ""); - static_assert(v13 == 1, ""); - - static constexpr auto v14 = 1Lu; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'Lu', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 1Lu; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LU{{$}} - // CHECK-FIXES: static constexpr auto v14 = 1LU; - static_assert(is_same<decltype(v14), const unsigned long>::value, ""); - static_assert(v14 == 1, ""); - - static constexpr auto v15 = 1lU; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'lU', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v15 = 1lU; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LU{{$}} - // CHECK-FIXES: static constexpr auto v15 = 1LU; - static_assert(is_same<decltype(v15), const unsigned long>::value, ""); - static_assert(v15 == 1, ""); - - static constexpr auto v16 = 1LU; // OK. - static_assert(is_same<decltype(v16), const unsigned long>::value, ""); - static_assert(v16 == 1, ""); - - // Unsigned Long Long - - static constexpr auto v17 = 1ull; - static_assert(is_same<decltype(v17), const unsigned long long>::value, ""); - static_assert(v17 == 1, ""); - - static constexpr auto v18 = 1uLL; - static_assert(is_same<decltype(v18), const unsigned long long>::value, ""); - static_assert(v18 == 1, ""); - - static constexpr auto v19 = 1Ull; - static_assert(is_same<decltype(v19), const unsigned long long>::value, ""); - static_assert(v19 == 1, ""); - - static constexpr auto v20 = 1ULL; // OK. - static_assert(is_same<decltype(v20), const unsigned long long>::value, ""); - static_assert(v20 == 1, ""); - - // Long Long Unsigned - - static constexpr auto v21 = 1llu; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'llu', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v21 = 1llu; - // CHECK-MESSAGES-NEXT: ^~~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LLU{{$}} - // CHECK-FIXES: static constexpr auto v21 = 1LLU; - static_assert(is_same<decltype(v21), const unsigned long long>::value, ""); - static_assert(v21 == 1, ""); - - static constexpr auto v22 = 1LLu; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'LLu', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v22 = 1LLu; - // CHECK-MESSAGES-NEXT: ^~~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LLU{{$}} - // CHECK-FIXES: static constexpr auto v22 = 1LLU; - static_assert(is_same<decltype(v22), const unsigned long long>::value, ""); - static_assert(v22 == 1, ""); - - static constexpr auto v23 = 1llU; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'llU', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v23 = 1llU; - // CHECK-MESSAGES-NEXT: ^~~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LLU{{$}} - // CHECK-FIXES: static constexpr auto v23 = 1LLU; - static_assert(is_same<decltype(v23), const unsigned long long>::value, ""); - static_assert(v23 == 1, ""); - - static constexpr auto v24 = 1LLU; // OK. - static_assert(is_same<decltype(v24), const unsigned long long>::value, ""); - static_assert(v24 == 1, ""); -} diff --git a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-floating-point-opencl-half.cpp b/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-floating-point-opencl-half.cpp deleted file mode 100644 index 96d2eb086a9..00000000000 --- a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-floating-point-opencl-half.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -target x86_64-pc-linux-gnu -I %S -std=cl2.0 -x cl -// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp -// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -- -target x86_64-pc-linux-gnu -I %S -std=cl2.0 -x cl -// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -- -target x86_64-pc-linux-gnu -I %S -std=cl2.0 -x cl - -#pragma OPENCL EXTENSION cl_khr_fp16 : enable - -void floating_point_half_suffix() { - static half v0 = 0x0p0; // no literal - - // half - - static half v2 = 1.h; - // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: floating point literal has suffix 'h', which is not uppercase - // CHECK-MESSAGES-NEXT: static half v2 = 1.h; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}H{{$}} - // CHECK-HIXES: static half v2 = 1.H; - - static half v3 = 1.e0h; - // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: floating point literal has suffix 'h', which is not uppercase - // CHECK-MESSAGES-NEXT: static half v3 = 1.e0h; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}H{{$}} - // CHECK-HIXES: static half v3 = 1.e0H; - - static half v4 = 1.H; // OK. - - static half v5 = 1.e0H; // OK. -} diff --git a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp b/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp deleted file mode 100644 index 4d41db7a5ec..00000000000 --- a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp +++ /dev/null @@ -1,198 +0,0 @@ -// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -target x86_64-pc-linux-gnu -I %S -// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp -// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -- -target x86_64-pc-linux-gnu -I %S -// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -- -target x86_64-pc-linux-gnu -I %S - -#include "readability-uppercase-literal-suffix.h" - -void floating_point_suffix() { - static constexpr auto v0 = 1.; // no literal - static_assert(is_same<decltype(v0), const double>::value, ""); - static_assert(v0 == 1., ""); - - static constexpr auto v1 = 1.e0; // no literal - static_assert(is_same<decltype(v1), const double>::value, ""); - static_assert(v1 == 1., ""); - - // Float - - static constexpr auto v2 = 1.f; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v2 = 1.f; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}} - // CHECK-FIXES: static constexpr auto v2 = 1.F; - static_assert(is_same<decltype(v2), const float>::value, ""); - static_assert(v2 == 1.0F, ""); - - static constexpr auto v3 = 1.e0f; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v3 = 1.e0f; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}} - // CHECK-FIXES: static constexpr auto v3 = 1.e0F; - static_assert(is_same<decltype(v3), const float>::value, ""); - static_assert(v3 == 1.0F, ""); - - static constexpr auto v4 = 1.F; // OK. - static_assert(is_same<decltype(v4), const float>::value, ""); - static_assert(v4 == 1.0F, ""); - - static constexpr auto v5 = 1.e0F; // OK. - static_assert(is_same<decltype(v5), const float>::value, ""); - static_assert(v5 == 1.0F, ""); - - // Long double - - static constexpr auto v6 = 1.l; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'l', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v6 = 1.l; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}} - // CHECK-FIXES: static constexpr auto v6 = 1.L; - static_assert(is_same<decltype(v6), const long double>::value, ""); - static_assert(v6 == 1., ""); - - static constexpr auto v7 = 1.e0l; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'l', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 1.e0l; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}} - // CHECK-FIXES: static constexpr auto v7 = 1.e0L; - static_assert(is_same<decltype(v7), const long double>::value, ""); - static_assert(v7 == 1., ""); - - static constexpr auto v8 = 1.L; // OK. - static_assert(is_same<decltype(v8), const long double>::value, ""); - static_assert(v8 == 1., ""); - - static constexpr auto v9 = 1.e0L; // OK. - static_assert(is_same<decltype(v9), const long double>::value, ""); - static_assert(v9 == 1., ""); - - // __float128 - - static constexpr auto v10 = 1.q; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'q', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v10 = 1.q; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}Q{{$}} - // CHECK-FIXES: static constexpr auto v10 = 1.Q; - static_assert(is_same<decltype(v10), const __float128>::value, ""); - static_assert(v10 == 1., ""); - - static constexpr auto v11 = 1.e0q; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'q', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v11 = 1.e0q; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}Q{{$}} - // CHECK-FIXES: static constexpr auto v11 = 1.e0Q; - static_assert(is_same<decltype(v11), const __float128>::value, ""); - static_assert(v11 == 1., ""); - - static constexpr auto v12 = 1.Q; // OK. - static_assert(is_same<decltype(v12), const __float128>::value, ""); - static_assert(v12 == 1., ""); - - static constexpr auto v13 = 1.e0Q; // OK. - static_assert(is_same<decltype(v13), const __float128>::value, ""); - static_assert(v13 == 1., ""); - - // _Float16 - - static constexpr auto v14 = 1.f16; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 1.f16; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}F16{{$}} - // CHECK-FIXES: static constexpr auto v14 = 1.F16; - static_assert(is_same<decltype(v14), const _Float16>::value, ""); - static_assert(v14 == 1.F16, ""); - - static constexpr auto v15 = 1.e0f16; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v15 = 1.e0f16; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}F16{{$}} - // CHECK-FIXES: static constexpr auto v15 = 1.e0F16; - static_assert(is_same<decltype(v15), const _Float16>::value, ""); - static_assert(v15 == 1.F16, ""); - - static constexpr auto v16 = 1.F16; // OK. - static_assert(is_same<decltype(v16), const _Float16>::value, ""); - static_assert(v16 == 1.F16, ""); - - static constexpr auto v17 = 1.e0F16; // OK. - static_assert(is_same<decltype(v17), const _Float16>::value, ""); - static_assert(v17 == 1.F16, ""); -} - -void floating_point_complex_suffix() { - // _Complex, I - - static constexpr auto v14 = 1.i; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'i', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 1.i; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}I{{$}} - // CHECK-FIXES: static constexpr auto v14 = 1.I; - static_assert(is_same<decltype(v14), const _Complex double>::value, ""); - static_assert(v14 == 1.I, ""); - - static constexpr auto v15 = 1.e0i; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'i', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v15 = 1.e0i; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}I{{$}} - // CHECK-FIXES: static constexpr auto v15 = 1.e0I; - static_assert(is_same<decltype(v15), const _Complex double>::value, ""); - static_assert(v15 == 1.I, ""); - - static constexpr auto v16 = 1.I; // OK. - static_assert(is_same<decltype(v16), const _Complex double>::value, ""); - static_assert(v16 == 1.I, ""); - - static constexpr auto v17 = 1.e0I; // OK. - static_assert(is_same<decltype(v17), const _Complex double>::value, ""); - static_assert(v17 == 1.I, ""); - - // _Complex, J - - static constexpr auto v18 = 1.j; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'j', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v18 = 1.j; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}J{{$}} - // CHECK-FIXES: static constexpr auto v18 = 1.J; - static_assert(is_same<decltype(v18), const _Complex double>::value, ""); - static_assert(v18 == 1.J, ""); - - static constexpr auto v19 = 1.e0j; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'j', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v19 = 1.e0j; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}J{{$}} - // CHECK-FIXES: static constexpr auto v19 = 1.e0J; - static_assert(is_same<decltype(v19), const _Complex double>::value, ""); - static_assert(v19 == 1.J, ""); - - static constexpr auto v20 = 1.J; // OK. - static_assert(is_same<decltype(v20), const _Complex double>::value, ""); - static_assert(v20 == 1.J, ""); - - static constexpr auto v21 = 1.e0J; // OK. - static_assert(is_same<decltype(v21), const _Complex double>::value, ""); - static_assert(v21 == 1.J, ""); -} - -void macros() { -#define PASSTHROUGH(X) X - static constexpr auto m0 = PASSTHROUGH(1.f); - // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: floating point literal has suffix 'f', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto m0 = PASSTHROUGH(1.f); - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}} - // CHECK-FIXES: static constexpr auto m0 = PASSTHROUGH(1.F); - static_assert(is_same<decltype(m0), const float>::value, ""); - static_assert(m0 == 1.0F, ""); -} diff --git a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp b/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp deleted file mode 100644 index 4cc9d6d2a70..00000000000 --- a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -target x86_64-pc-linux-gnu -I %S -// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp -// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -- -target x86_64-pc-linux-gnu -I %S -// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -- -target x86_64-pc-linux-gnu -I %S - -#include "readability-uppercase-literal-suffix.h" - -void floating_point_suffix() { - static constexpr auto v0 = 0x0p0; // no literal - static_assert(is_same<decltype(v0), const double>::value, ""); - static_assert(v0 == 0, ""); - - // Float - - static constexpr auto v1 = 0xfp0f; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v1 = 0xfp0f; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}} - // CHECK-FIXES: static constexpr auto v1 = 0xfp0F; - static_assert(is_same<decltype(v1), const float>::value, ""); - static_assert(v1 == 15, ""); - - static constexpr auto v2 = 0xfp0F; // OK - static_assert(is_same<decltype(v2), const float>::value, ""); - static_assert(v2 == 15, ""); - - static constexpr auto v3 = 0xfP0f; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v3 = 0xfP0f; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}} - // CHECK-FIXES: static constexpr auto v3 = 0xfP0F; - static_assert(is_same<decltype(v3), const float>::value, ""); - static_assert(v3 == 15, ""); - - static constexpr auto v4 = 0xfP0F; // OK - static_assert(is_same<decltype(v4), const float>::value, ""); - static_assert(v4 == 15, ""); - - static constexpr auto v5 = 0xFP0f; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 0xFP0f; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}} - // CHECK-FIXES: static constexpr auto v5 = 0xFP0F; - static_assert(is_same<decltype(v5), const float>::value, ""); - static_assert(v5 == 15, ""); - - static constexpr auto v6 = 0xFP0F; // OK - static_assert(is_same<decltype(v6), const float>::value, ""); - static_assert(v6 == 15, ""); - - static constexpr auto v7 = 0xFp0f; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 0xFp0f; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}} - // CHECK-FIXES: static constexpr auto v7 = 0xFp0F; - static_assert(is_same<decltype(v7), const float>::value, ""); - static_assert(v7 == 15, ""); - - static constexpr auto v8 = 0xFp0F; // OK - static_assert(is_same<decltype(v8), const float>::value, ""); - static_assert(v8 == 15, ""); - - // long double - - static constexpr auto v9 = 0xfp0l; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'l', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v9 = 0xfp0l; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}} - // CHECK-FIXES: static constexpr auto v9 = 0xfp0L; - static_assert(is_same<decltype(v9), const long double>::value, ""); - static_assert(v9 == 0xfp0, ""); - - static constexpr auto v10 = 0xfp0L; // OK. - static_assert(is_same<decltype(v10), const long double>::value, ""); - static_assert(v10 == 0xfp0, ""); - - // __float128 - - static constexpr auto v11 = 0xfp0q; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'q', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v11 = 0xfp0q; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}Q{{$}} - // CHECK-FIXES: static constexpr auto v11 = 0xfp0Q; - static_assert(is_same<decltype(v11), const __float128>::value, ""); - static_assert(v11 == 0xfp0, ""); - - static constexpr auto v12 = 0xfp0Q; // OK. - static_assert(is_same<decltype(v12), const __float128>::value, ""); - static_assert(v12 == 0xfp0, ""); - - // _Float16 - - static constexpr auto v13 = 0xfp0f16; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v13 = 0xfp0f16; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}F16{{$}} - // CHECK-FIXES: static constexpr auto v13 = 0xfp0F16; - static_assert(is_same<decltype(v13), const _Float16>::value, ""); - static_assert(v13 == 0xfp0F16, ""); - - static constexpr auto v14 = 0xfp0F16; // OK. - static_assert(is_same<decltype(v14), const _Float16>::value, ""); - static_assert(v14 == 0xfp0F16, ""); -} - -void floating_point_complex_suffix() { - // _Complex, I - - static constexpr auto v14 = 0xfp0i; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'i', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 0xfp0i; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}I{{$}} - // CHECK-FIXES: static constexpr auto v14 = 0xfp0I; - static_assert(is_same<decltype(v14), const _Complex double>::value, ""); - static_assert(v14 == 0xfp0I, ""); - - static constexpr auto v16 = 0xfp0I; // OK. - static_assert(is_same<decltype(v16), const _Complex double>::value, ""); - static_assert(v16 == 0xfp0I, ""); - - // _Complex, J - - static constexpr auto v18 = 0xfp0j; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'j', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v18 = 0xfp0j; - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}J{{$}} - // CHECK-FIXES: static constexpr auto v18 = 0xfp0J; - static_assert(is_same<decltype(v18), const _Complex double>::value, ""); - static_assert(v18 == 0xfp0J, ""); - - static constexpr auto v20 = 0xfp0J; // OK. - static_assert(is_same<decltype(v20), const _Complex double>::value, ""); - static_assert(v20 == 0xfp0J, ""); -} - -void macros() { -#define PASSTHROUGH(X) X - static constexpr auto m0 = PASSTHROUGH(0x0p0f); - // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: floating point literal has suffix 'f', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto m0 = PASSTHROUGH(0x0p0f); - // CHECK-MESSAGES-NEXT: ^ ~ - // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}} - // CHECK-FIXES: static constexpr auto m0 = PASSTHROUGH(0x0p0F); - static_assert(is_same<decltype(m0), const float>::value, ""); - static_assert(m0 == 0x0p0F, ""); -} diff --git a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-integer-custom-list.cpp b/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-integer-custom-list.cpp deleted file mode 100644 index ff67a336b25..00000000000 --- a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-integer-custom-list.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -config="{CheckOptions: [{key: readability-uppercase-literal-suffix.NewSuffixes, value: 'L;uL'}]}" -- -I %S -// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp -// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -config="{CheckOptions: [{key: readability-uppercase-literal-suffix.NewSuffixes, value: 'L;uL'}]}" -- -I %S -// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -config="{CheckOptions: [{key: readability-uppercase-literal-suffix.NewSuffixes, value: 'L;uL'}]}" -- -I %S - -#include "readability-uppercase-literal-suffix.h" - -void integer_suffix() { - // Unsigned - - static constexpr auto v3 = 1u; // OK. - static_assert(is_same<decltype(v3), const unsigned int>::value, ""); - static_assert(v3 == 1, ""); - - static constexpr auto v4 = 1U; // OK. - static_assert(is_same<decltype(v4), const unsigned int>::value, ""); - static_assert(v4 == 1, ""); - - // Long - - static constexpr auto v5 = 1l; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'l', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 1l; - // CHECK-MESSAGES-NEXT: ^~ - // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}} - // CHECK-FIXES: static constexpr auto v5 = 1L; - static_assert(is_same<decltype(v5), const long>::value, ""); - static_assert(v5 == 1, ""); - - static constexpr auto v6 = 1L; // OK. - static_assert(is_same<decltype(v6), const long>::value, ""); - static_assert(v6 == 1, ""); - - // Long Long - - static constexpr auto v7 = 1ll; // OK. - static_assert(is_same<decltype(v7), const long long>::value, ""); - static_assert(v7 == 1, ""); - - static constexpr auto v8 = 1LL; // OK. - static_assert(is_same<decltype(v8), const long long>::value, ""); - static_assert(v8 == 1, ""); - - // Unsigned Long - - static constexpr auto v9 = 1ul; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'ul', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v9 = 1ul; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}uL{{$}} - // CHECK-FIXES: static constexpr auto v9 = 1uL; - static_assert(is_same<decltype(v9), const unsigned long>::value, ""); - static_assert(v9 == 1, ""); - - static constexpr auto v10 = 1uL; // OK. - static_assert(is_same<decltype(v10), const unsigned long>::value, ""); - static_assert(v10 == 1, ""); - - static constexpr auto v11 = 1Ul; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'Ul', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v11 = 1Ul; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}uL{{$}} - // CHECK-FIXES: static constexpr auto v11 = 1uL; - static_assert(is_same<decltype(v11), const unsigned long>::value, ""); - static_assert(v11 == 1, ""); - - static constexpr auto v12 = 1UL; // OK. - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'UL', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v12 = 1UL; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}uL{{$}} - // CHECK-FIXES: static constexpr auto v12 = 1uL; - static_assert(is_same<decltype(v12), const unsigned long>::value, ""); - static_assert(v12 == 1, ""); - - // Long Unsigned - - static constexpr auto v13 = 1lu; // OK. - static_assert(is_same<decltype(v13), const unsigned long>::value, ""); - static_assert(v13 == 1, ""); - - static constexpr auto v14 = 1Lu; // OK. - static_assert(is_same<decltype(v14), const unsigned long>::value, ""); - static_assert(v14 == 1, ""); - - static constexpr auto v15 = 1lU; // OK. - static_assert(is_same<decltype(v15), const unsigned long>::value, ""); - static_assert(v15 == 1, ""); - - static constexpr auto v16 = 1LU; // OK. - static_assert(is_same<decltype(v16), const unsigned long>::value, ""); - static_assert(v16 == 1, ""); - - // Unsigned Long Long - - static constexpr auto v17 = 1ull; // OK. - static_assert(is_same<decltype(v17), const unsigned long long>::value, ""); - static_assert(v17 == 1, ""); - - static constexpr auto v18 = 1uLL; // OK. - static_assert(is_same<decltype(v18), const unsigned long long>::value, ""); - static_assert(v18 == 1, ""); - - static constexpr auto v19 = 1Ull; // OK. - static_assert(is_same<decltype(v19), const unsigned long long>::value, ""); - static_assert(v19 == 1, ""); - - static constexpr auto v20 = 1ULL; // OK. - static_assert(is_same<decltype(v20), const unsigned long long>::value, ""); - static_assert(v20 == 1, ""); - - // Long Long Unsigned - - static constexpr auto v21 = 1llu; // OK. - static_assert(is_same<decltype(v21), const unsigned long long>::value, ""); - static_assert(v21 == 1, ""); - - static constexpr auto v22 = 1LLu; // OK. - static_assert(is_same<decltype(v22), const unsigned long long>::value, ""); - static_assert(v22 == 1, ""); - - static constexpr auto v23 = 1llU; // OK. - static_assert(is_same<decltype(v23), const unsigned long long>::value, ""); - static_assert(v23 == 1, ""); - - static constexpr auto v24 = 1LLU; // OK. - static_assert(is_same<decltype(v24), const unsigned long long>::value, ""); - static_assert(v24 == 1, ""); -} diff --git a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-integer-macro.cpp b/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-integer-macro.cpp deleted file mode 100644 index 9668a9ead9d..00000000000 --- a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-integer-macro.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -I %S - -void macros() { -#define INMACRO(X) 1.f - static constexpr auto m1 = INMACRO(); - // CHECK-NOTES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase - // CHECK-NOTES: :[[@LINE-3]]:20: note: expanded from macro 'INMACRO' - // CHECK-FIXES: #define INMACRO(X) 1.f - // CHECK-FIXES: static constexpr auto m1 = INMACRO(); - // ^ so no fix-its here. -} - -void horrible_macros() { -#define MAKE_UNSIGNED(x) x##u -#define ONE MAKE_UNSIGNED(1) - static constexpr auto hm0 = ONE; - // CHECK-NOTES: :[[@LINE-1]]:31: warning: integer literal has suffix 'u', which is not uppercase - // CHECK-NOTES: :[[@LINE-3]]:13: note: expanded from macro 'ONE' - // CHECK-NOTES: :[[@LINE-5]]:26: note: expanded from macro 'MAKE_UNSIGNED' - // CHECK-NOTES: note: expanded from here - // CHECK-FIXES: #define MAKE_UNSIGNED(x) x##u - // CHECK-FIXES: #define ONE MAKE_UNSIGNED(1) - // CHECK-FIXES: static constexpr auto hm0 = ONE; - // Certainly no fix-its. -} diff --git a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-integer-ms.cpp b/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-integer-ms.cpp deleted file mode 100644 index 1ec3211e58d..00000000000 --- a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-integer-ms.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -target x86_64-pc-linux-gnu -I %S -fms-extensions -// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp -// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -- -target x86_64-pc-linux-gnu -I %S -fms-extensions -// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -- -target x86_64-pc-linux-gnu -I %S -fms-extensions - -#include "readability-uppercase-literal-suffix.h" - -void integer_suffix() { - static constexpr auto v0 = __LINE__; // synthetic - static_assert(v0 == 9 || v0 == 5, ""); - - static constexpr auto v1 = __cplusplus; // synthetic, long - - static constexpr auto v2 = 1; // no literal - static_assert(is_same<decltype(v2), const int>::value, ""); - static_assert(v2 == 1, ""); - - // i32 - - static constexpr auto v3 = 1i32; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'i32', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v3 = 1i32; - // CHECK-MESSAGES-NEXT: ^~ - // CHECK-MESSAGES-NEXT: {{^ *}}I32{{$}} - // CHECK-FIXES: static constexpr auto v3 = 1I32; - static_assert(is_same<decltype(v3), const int>::value, ""); - static_assert(v3 == 1I32, ""); - - static constexpr auto v4 = 1I32; // OK. - static_assert(is_same<decltype(v4), const int>::value, ""); - static_assert(v4 == 1I32, ""); - - // i64 - - static constexpr auto v5 = 1i64; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'i64', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 1i64; - // CHECK-MESSAGES-NEXT: ^~ - // CHECK-MESSAGES-NEXT: {{^ *}}I64{{$}} - // CHECK-FIXES: static constexpr auto v5 = 1I64; - static_assert(is_same<decltype(v5), const long int>::value, ""); - static_assert(v5 == 1I64, ""); - - static constexpr auto v6 = 1I64; // OK. - static_assert(is_same<decltype(v6), const long int>::value, ""); - static_assert(v6 == 1I64, ""); - - // i16 - - static constexpr auto v7 = 1i16; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'i16', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 1i16; - // CHECK-MESSAGES-NEXT: ^~ - // CHECK-MESSAGES-NEXT: {{^ *}}I16{{$}} - // CHECK-FIXES: static constexpr auto v7 = 1I16; - static_assert(is_same<decltype(v7), const short>::value, ""); - static_assert(v7 == 1I16, ""); - - static constexpr auto v8 = 1I16; // OK. - static_assert(is_same<decltype(v8), const short>::value, ""); - static_assert(v8 == 1I16, ""); - - // i8 - - static constexpr auto v9 = 1i8; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'i8', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v9 = 1i8; - // CHECK-MESSAGES-NEXT: ^~ - // CHECK-MESSAGES-NEXT: {{^ *}}I8{{$}} - // CHECK-FIXES: static constexpr auto v9 = 1I8; - static_assert(is_same<decltype(v9), const char>::value, ""); - static_assert(v9 == 1I8, ""); - - static constexpr auto v10 = 1I8; // OK. - static_assert(is_same<decltype(v10), const char>::value, ""); - static_assert(v10 == 1I8, ""); -} diff --git a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp b/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp deleted file mode 100644 index f41cf7fffe2..00000000000 --- a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp +++ /dev/null @@ -1,245 +0,0 @@ -// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -I %S -// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp -// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -- -I %S -// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -- -I %S - -#include "readability-uppercase-literal-suffix.h" - -void integer_suffix() { - static constexpr auto v0 = __LINE__; // synthetic - static_assert(v0 == 9 || v0 == 5, ""); - - static constexpr auto v1 = __cplusplus; // synthetic, long - - static constexpr auto v2 = 1; // no literal - static_assert(is_same<decltype(v2), const int>::value, ""); - static_assert(v2 == 1, ""); - - // Unsigned - - static constexpr auto v3 = 1u; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'u', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v3 = 1u; - // CHECK-MESSAGES-NEXT: ^~ - // CHECK-MESSAGES-NEXT: {{^ *}}U{{$}} - // CHECK-FIXES: static constexpr auto v3 = 1U; - static_assert(is_same<decltype(v3), const unsigned int>::value, ""); - static_assert(v3 == 1, ""); - - static constexpr auto v4 = 1U; // OK. - static_assert(is_same<decltype(v4), const unsigned int>::value, ""); - static_assert(v4 == 1, ""); - - // Long - - static constexpr auto v5 = 1l; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'l', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 1l; - // CHECK-MESSAGES-NEXT: ^~ - // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}} - // CHECK-FIXES: static constexpr auto v5 = 1L; - static_assert(is_same<decltype(v5), const long>::value, ""); - static_assert(v5 == 1, ""); - - static constexpr auto v6 = 1L; // OK. - static_assert(is_same<decltype(v6), const long>::value, ""); - static_assert(v6 == 1, ""); - - // Long Long - - static constexpr auto v7 = 1ll; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'll', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 1ll; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LL{{$}} - // CHECK-FIXES: static constexpr auto v7 = 1LL; - static_assert(is_same<decltype(v7), const long long>::value, ""); - static_assert(v7 == 1, ""); - - static constexpr auto v8 = 1LL; // OK. - static_assert(is_same<decltype(v8), const long long>::value, ""); - static_assert(v8 == 1, ""); - - // Unsigned Long - - static constexpr auto v9 = 1ul; - // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'ul', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v9 = 1ul; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}UL{{$}} - // CHECK-FIXES: static constexpr auto v9 = 1UL; - static_assert(is_same<decltype(v9), const unsigned long>::value, ""); - static_assert(v9 == 1, ""); - - static constexpr auto v10 = 1uL; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'uL', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v10 = 1uL; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}UL{{$}} - // CHECK-FIXES: static constexpr auto v10 = 1UL; - static_assert(is_same<decltype(v10), const unsigned long>::value, ""); - static_assert(v10 == 1, ""); - - static constexpr auto v11 = 1Ul; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'Ul', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v11 = 1Ul; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}UL{{$}} - // CHECK-FIXES: static constexpr auto v11 = 1UL; - static_assert(is_same<decltype(v11), const unsigned long>::value, ""); - static_assert(v11 == 1, ""); - - static constexpr auto v12 = 1UL; // OK. - static_assert(is_same<decltype(v12), const unsigned long>::value, ""); - static_assert(v12 == 1, ""); - - // Long Unsigned - - static constexpr auto v13 = 1lu; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'lu', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v13 = 1lu; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LU{{$}} - // CHECK-FIXES: static constexpr auto v13 = 1LU; - static_assert(is_same<decltype(v13), const unsigned long>::value, ""); - static_assert(v13 == 1, ""); - - static constexpr auto v14 = 1Lu; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'Lu', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 1Lu; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LU{{$}} - // CHECK-FIXES: static constexpr auto v14 = 1LU; - static_assert(is_same<decltype(v14), const unsigned long>::value, ""); - static_assert(v14 == 1, ""); - - static constexpr auto v15 = 1lU; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'lU', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v15 = 1lU; - // CHECK-MESSAGES-NEXT: ^~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LU{{$}} - // CHECK-FIXES: static constexpr auto v15 = 1LU; - static_assert(is_same<decltype(v15), const unsigned long>::value, ""); - static_assert(v15 == 1, ""); - - static constexpr auto v16 = 1LU; // OK. - static_assert(is_same<decltype(v16), const unsigned long>::value, ""); - static_assert(v16 == 1, ""); - - // Unsigned Long Long - - static constexpr auto v17 = 1ull; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'ull', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v17 = 1ull; - // CHECK-MESSAGES-NEXT: ^~~~ - // CHECK-MESSAGES-NEXT: {{^ *}}ULL{{$}} - // CHECK-FIXES: static constexpr auto v17 = 1ULL; - static_assert(is_same<decltype(v17), const unsigned long long>::value, ""); - static_assert(v17 == 1, ""); - - static constexpr auto v18 = 1uLL; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'uLL', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v18 = 1uLL; - // CHECK-MESSAGES-NEXT: ^~~~ - // CHECK-MESSAGES-NEXT: {{^ *}}ULL{{$}} - // CHECK-FIXES: static constexpr auto v18 = 1ULL; - static_assert(is_same<decltype(v18), const unsigned long long>::value, ""); - static_assert(v18 == 1, ""); - - static constexpr auto v19 = 1Ull; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'Ull', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v19 = 1Ull; - // CHECK-MESSAGES-NEXT: ^~~~ - // CHECK-MESSAGES-NEXT: {{^ *}}ULL{{$}} - // CHECK-FIXES: static constexpr auto v19 = 1ULL; - static_assert(is_same<decltype(v19), const unsigned long long>::value, ""); - static_assert(v19 == 1, ""); - - static constexpr auto v20 = 1ULL; // OK. - static_assert(is_same<decltype(v20), const unsigned long long>::value, ""); - static_assert(v20 == 1, ""); - - // Long Long Unsigned - - static constexpr auto v21 = 1llu; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'llu', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v21 = 1llu; - // CHECK-MESSAGES-NEXT: ^~~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LLU{{$}} - // CHECK-FIXES: static constexpr auto v21 = 1LLU; - static_assert(is_same<decltype(v21), const unsigned long long>::value, ""); - static_assert(v21 == 1, ""); - - static constexpr auto v22 = 1LLu; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'LLu', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v22 = 1LLu; - // CHECK-MESSAGES-NEXT: ^~~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LLU{{$}} - // CHECK-FIXES: static constexpr auto v22 = 1LLU; - static_assert(is_same<decltype(v22), const unsigned long long>::value, ""); - static_assert(v22 == 1, ""); - - static constexpr auto v23 = 1llU; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'llU', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v23 = 1llU; - // CHECK-MESSAGES-NEXT: ^~~~ - // CHECK-MESSAGES-NEXT: {{^ *}}LLU{{$}} - // CHECK-FIXES: static constexpr auto v23 = 1LLU; - static_assert(is_same<decltype(v23), const unsigned long long>::value, ""); - static_assert(v23 == 1, ""); - - static constexpr auto v24 = 1LLU; // OK. - static_assert(is_same<decltype(v24), const unsigned long long>::value, ""); - static_assert(v24 == 1, ""); -} - -void integer_complex_suffix() { - // _Complex, I - - static constexpr auto v25 = 1i; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'i', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v25 = 1i; - // CHECK-MESSAGES-NEXT: ^~ - // CHECK-MESSAGES-NEXT: {{^ *}}I{{$}} - // CHECK-FIXES: static constexpr auto v25 = 1I; - static_assert(is_same<decltype(v25), const _Complex int>::value, ""); - static_assert(v25 == 1I, ""); - - static constexpr auto v26 = 1I; // OK. - static_assert(is_same<decltype(v26), const _Complex int>::value, ""); - static_assert(v26 == 1I, ""); - - // _Complex, J - - static constexpr auto v27 = 1j; - // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'j', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto v27 = 1j; - // CHECK-MESSAGES-NEXT: ^~ - // CHECK-MESSAGES-NEXT: {{^ *}}J{{$}} - // CHECK-FIXES: static constexpr auto v27 = 1J; - static_assert(is_same<decltype(v27), const _Complex int>::value, ""); - static_assert(v27 == 1J, ""); - - static constexpr auto v28 = 1J; // OK. - static_assert(is_same<decltype(v28), const _Complex int>::value, ""); - static_assert(v28 == 1J, ""); -} - -void macros() { -#define PASSTHROUGH(X) X - static constexpr auto m0 = PASSTHROUGH(1u); - // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: integer literal has suffix 'u', which is not uppercase - // CHECK-MESSAGES-NEXT: static constexpr auto m0 = PASSTHROUGH(1u); - // CHECK-MESSAGES-NEXT: ^~ - // CHECK-MESSAGES-NEXT: {{^ *}}U{{$}} - // CHECK-FIXES: static constexpr auto m0 = PASSTHROUGH(1U); - static_assert(is_same<decltype(m0), const unsigned int>::value, ""); - static_assert(m0 == 1, ""); -} - -// Check that user-defined literals do not cause any diags. - -unsigned long long int operator"" _ull(unsigned long long int); -void user_defined_literals() { - 1_ull; -} diff --git a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix.h b/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix.h deleted file mode 100644 index 680321e734c..00000000000 --- a/clang-tools-extra/test/clang-tidy/readability-uppercase-literal-suffix.h +++ /dev/null @@ -1,16 +0,0 @@ -template <class T, T v> -struct integral_constant { - static constexpr T value = v; - typedef T value_type; - typedef integral_constant type; // using injected-class-name - constexpr operator value_type() const noexcept { return value; } -}; - -using false_type = integral_constant<bool, false>; -using true_type = integral_constant<bool, true>; - -template <class T, class U> -struct is_same : false_type {}; - -template <class T> -struct is_same<T, T> : true_type {}; |

