brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · 399afa5 Raw
116 lines · cpp
1// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -config="{CheckOptions: {readability-uppercase-literal-suffix.NewSuffixes: 'L;uL'}}" -- -I %clang_tidy_headers2 3#include "integral_constant.h"4 5void integer_suffix() {6  // Unsigned7 8  static constexpr auto v3 = 1u; // OK.9  static_assert(is_same<decltype(v3), const unsigned int>::value, "");10  static_assert(v3 == 1, "");11 12  static constexpr auto v4 = 1U; // OK.13  static_assert(is_same<decltype(v4), const unsigned int>::value, "");14  static_assert(v4 == 1, "");15 16  // Long17 18  static constexpr auto v5 = 1l;19  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'l', which is not uppercase20  // CHECK-FIXES: static constexpr auto v5 = 1L;21  static_assert(is_same<decltype(v5), const long>::value, "");22  static_assert(v5 == 1, "");23 24  static constexpr auto v6 = 1L; // OK.25  static_assert(is_same<decltype(v6), const long>::value, "");26  static_assert(v6 == 1, "");27 28  // Long Long29 30  static constexpr auto v7 = 1ll; // OK.31  static_assert(is_same<decltype(v7), const long long>::value, "");32  static_assert(v7 == 1, "");33 34  static constexpr auto v8 = 1LL; // OK.35  static_assert(is_same<decltype(v8), const long long>::value, "");36  static_assert(v8 == 1, "");37 38  // Unsigned Long39 40  static constexpr auto v9 = 1ul;41  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'ul', which is not uppercase42  // CHECK-FIXES: static constexpr auto v9 = 1uL;43  static_assert(is_same<decltype(v9), const unsigned long>::value, "");44  static_assert(v9 == 1, "");45 46  static constexpr auto v10 = 1uL; // OK.47  static_assert(is_same<decltype(v10), const unsigned long>::value, "");48  static_assert(v10 == 1, "");49 50  static constexpr auto v11 = 1Ul;51  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'Ul', which is not uppercase52  // CHECK-FIXES: static constexpr auto v11 = 1uL;53  static_assert(is_same<decltype(v11), const unsigned long>::value, "");54  static_assert(v11 == 1, "");55 56  static constexpr auto v12 = 1UL;57  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'UL', which is not uppercase58  // CHECK-FIXES: static constexpr auto v12 = 1uL;59  static_assert(is_same<decltype(v12), const unsigned long>::value, "");60  static_assert(v12 == 1, "");61 62  // Long Unsigned63 64  static constexpr auto v13 = 1lu; // OK.65  static_assert(is_same<decltype(v13), const unsigned long>::value, "");66  static_assert(v13 == 1, "");67 68  static constexpr auto v14 = 1Lu; // OK.69  static_assert(is_same<decltype(v14), const unsigned long>::value, "");70  static_assert(v14 == 1, "");71 72  static constexpr auto v15 = 1lU; // OK.73  static_assert(is_same<decltype(v15), const unsigned long>::value, "");74  static_assert(v15 == 1, "");75 76  static constexpr auto v16 = 1LU; // OK.77  static_assert(is_same<decltype(v16), const unsigned long>::value, "");78  static_assert(v16 == 1, "");79 80  // Unsigned Long Long81 82  static constexpr auto v17 = 1ull; // OK.83  static_assert(is_same<decltype(v17), const unsigned long long>::value, "");84  static_assert(v17 == 1, "");85 86  static constexpr auto v18 = 1uLL; // OK.87  static_assert(is_same<decltype(v18), const unsigned long long>::value, "");88  static_assert(v18 == 1, "");89 90  static constexpr auto v19 = 1Ull; // OK.91  static_assert(is_same<decltype(v19), const unsigned long long>::value, "");92  static_assert(v19 == 1, "");93 94  static constexpr auto v20 = 1ULL; // OK.95  static_assert(is_same<decltype(v20), const unsigned long long>::value, "");96  static_assert(v20 == 1, "");97 98  // Long Long Unsigned99 100  static constexpr auto v21 = 1llu; // OK.101  static_assert(is_same<decltype(v21), const unsigned long long>::value, "");102  static_assert(v21 == 1, "");103 104  static constexpr auto v22 = 1LLu; // OK.105  static_assert(is_same<decltype(v22), const unsigned long long>::value, "");106  static_assert(v22 == 1, "");107 108  static constexpr auto v23 = 1llU; // OK.109  static_assert(is_same<decltype(v23), const unsigned long long>::value, "");110  static_assert(v23 == 1, "");111 112  static constexpr auto v24 = 1LLU; // OK.113  static_assert(is_same<decltype(v24), const unsigned long long>::value, "");114  static_assert(v24 == 1, "");115}116