1// RUN: %check_clang_tidy %s google-runtime-int %t -- \
2// RUN: -config='{CheckOptions: { \
3// RUN: google-runtime-int.UnsignedTypePrefix: "std::uint", \
4// RUN: google-runtime-int.SignedTypePrefix: "std::int", \
5// RUN: google-runtime-int.TypeSuffix: "_t", \
6// RUN: }}'
7
8long a();
9// CHECK-MESSAGES: [[@LINE-1]]:1: warning: consider replacing 'long' with 'std::int{{..}}_t'
10
11typedef unsigned long long uint64; // NOLINT
12
13long b(long = 1);
14// CHECK-MESSAGES: [[@LINE-1]]:1: warning: consider replacing 'long' with 'std::int{{..}}_t'
15// CHECK-MESSAGES: [[@LINE-2]]:8: warning: consider replacing 'long' with 'std::int{{..}}_t'
16
17template <typename T>
18void tmpl() {
19 T i;
20}
21
22short bar(const short, unsigned short) {
23// CHECK-MESSAGES: [[@LINE-1]]:1: warning: consider replacing 'short' with 'std::int16_t'
24// CHECK-MESSAGES: [[@LINE-2]]:17: warning: consider replacing 'short' with 'std::int16_t'
25// CHECK-MESSAGES: [[@LINE-3]]:24: warning: consider replacing 'unsigned short' with 'std::uint16_t'
26 long double foo = 42;
27 uint64 qux = 42;
28 unsigned short port;
29
30 const unsigned short bar = 0;
31// CHECK-MESSAGES: [[@LINE-1]]:9: warning: consider replacing 'unsigned short' with 'std::uint16_t'
32 long long *baar;
33// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'long long' with 'std::int64_t'
34 const unsigned short &bara = bar;
35// CHECK-MESSAGES: [[@LINE-1]]:9: warning: consider replacing 'unsigned short' with 'std::uint16_t'
36 long const long moo = 1;
37// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'long long' with 'std::int64_t'
38 long volatile long wat = 42;
39// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'long long' with 'std::int64_t'
40 unsigned long y;
41// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'unsigned long' with 'std::uint{{..}}_t'
42 unsigned long long **const *tmp;
43// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'unsigned long long' with 'std::uint64_t'
44 unsigned long long **const *&z = tmp;
45// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'unsigned long long' with 'std::uint64_t'
46 unsigned short porthole;
47// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'unsigned short' with 'std::uint16_t'
48
49 uint64 cast = (short)42;
50// CHECK-MESSAGES: [[@LINE-1]]:18: warning: consider replacing 'short' with 'std::int16_t'
51
52#define l long
53 l x;
54
55 tmpl<short>();
56// CHECK-MESSAGES: [[@LINE-1]]:8: warning: consider replacing 'short' with 'std::int16_t'
57}
58

source code of clang-tools-extra/test/clang-tidy/checkers/google/runtime-int-std.cpp