1 | // RUN: %check_clang_tidy %s readability-redundant-declaration %t |
2 | |
3 | extern int Xyz; |
4 | extern int Xyz; // Xyz |
5 | // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'Xyz' declaration [readability-redundant-declaration] |
6 | // CHECK-FIXES: {{^}}// Xyz{{$}} |
7 | int Xyz = 123; |
8 | |
9 | extern int A; |
10 | extern int A, B; |
11 | // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'A' declaration |
12 | // CHECK-FIXES: {{^}}extern int A, B;{{$}} |
13 | |
14 | extern int Buf[10]; |
15 | extern int Buf[10]; // Buf[10] |
16 | // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'Buf' declaration |
17 | // CHECK-FIXES: {{^}}// Buf[10]{{$}} |
18 | |
19 | static int f(void); |
20 | static int f(void); // f |
21 | // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'f' declaration |
22 | // CHECK-FIXES: {{^}}// f{{$}} |
23 | static int f(void) {} |
24 | |
25 | inline void g(void) {} |
26 | |
27 | inline void g(void); |
28 | // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant 'g' declaration |
29 | |
30 | // OK: Needed to emit an external definition. |
31 | extern inline void g(void); |
32 | |