brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 7462818 Raw
61 lines · cpp
1// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -target x86_64-pc-linux-gnu -I %clang_tidy_headers -fms-extensions2 3#include "integral_constant.h"4 5void integer_suffix() {6  static constexpr auto v0 = __LINE__; // synthetic7  static constexpr auto v1 = __cplusplus; // synthetic, long8 9  static constexpr auto v2 = 1; // no literal10  static_assert(is_same<decltype(v2), const int>::value, "");11  static_assert(v2 == 1, "");12 13  // i3214 15  static constexpr auto v3 = 1i32;16  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'i32', which is not uppercase17  // CHECK-FIXES: static constexpr auto v3 = 1I32;18  static_assert(is_same<decltype(v3), const int>::value, "");19  static_assert(v3 == 1I32, "");20 21  static constexpr auto v4 = 1I32; // OK.22  static_assert(is_same<decltype(v4), const int>::value, "");23  static_assert(v4 == 1I32, "");24 25  // i6426 27  static constexpr auto v5 = 1i64;28  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'i64', which is not uppercase29  // CHECK-FIXES: static constexpr auto v5 = 1I64;30  static_assert(is_same<decltype(v5), const long int>::value, "");31  static_assert(v5 == 1I64, "");32 33  static constexpr auto v6 = 1I64; // OK.34  static_assert(is_same<decltype(v6), const long int>::value, "");35  static_assert(v6 == 1I64, "");36 37  // i1638 39  static constexpr auto v7 = 1i16;40  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'i16', which is not uppercase41  // CHECK-FIXES: static constexpr auto v7 = 1I16;42  static_assert(is_same<decltype(v7), const short>::value, "");43  static_assert(v7 == 1I16, "");44 45  static constexpr auto v8 = 1I16; // OK.46  static_assert(is_same<decltype(v8), const short>::value, "");47  static_assert(v8 == 1I16, "");48 49  // i850 51  static constexpr auto v9 = 1i8;52  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'i8', which is not uppercase53  // CHECK-FIXES: static constexpr auto v9 = 1I8;54  static_assert(is_same<decltype(v9), const char>::value, "");55  static_assert(v9 == 1I8, "");56 57  static constexpr auto v10 = 1I8; // OK.58  static_assert(is_same<decltype(v10), const char>::value, "");59  static_assert(v10 == 1I8, "");60}61