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

source code of clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.c