1// RUN: %check_clang_tidy %s performance-no-int-to-ptr %t -- -- -Wno-int-conversion
2
3void *t0(char x) {
4 return x;
5 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
6}
7void *t1(signed char x) {
8 return x;
9 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
10}
11void *t2(unsigned char x) {
12 return x;
13 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
14}
15
16void *t3(short x) {
17 return x;
18 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
19}
20void *t4(unsigned short x) {
21 return x;
22 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
23}
24void *t5(signed short x) {
25 return x;
26 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
27}
28
29void *t6(int x) {
30 return x;
31 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
32}
33void *t7(unsigned int x) {
34 return x;
35 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
36}
37void *t8(signed int x) {
38 return x;
39 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
40}
41
42void *t9(long x) {
43 return x;
44 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
45}
46void *t10(unsigned long x) {
47 return x;
48 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
49}
50void *t11(signed long x) {
51 return x;
52 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
53}
54
55void *t12(long long x) {
56 return x;
57 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
58}
59void *t13(unsigned long long x) {
60 return x;
61 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
62}
63void *t14(signed long long x) {
64 return x;
65 // CHECK-MESSAGES: [[@LINE-1]]:10: warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]
66}
67

source code of clang-tools-extra/test/clang-tidy/checkers/performance/no-int-to-ptr.c