• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
2 // RUN:   -config="{CheckOptions: \
3 // RUN:             [{key: readability-redundant-declaration.IgnoreMacros, \
4 // RUN:               value: 1}]}"
5 
6 extern int Xyz;
7 extern int Xyz; // Xyz
8 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'Xyz' declaration [readability-redundant-declaration]
9 // CHECK-FIXES: {{^}}// Xyz{{$}}
10 
11 namespace macros {
12 #define DECLARE(x) extern int x
13 #define DEFINE(x) extern int x; int x = 42
14 DECLARE(test);
15 DEFINE(test);
16 // CHECK-FIXES: {{^}}#define DECLARE(x) extern int x{{$}}
17 // CHECK-FIXES: {{^}}#define DEFINE(x) extern int x; int x = 42{{$}}
18 // CHECK-FIXES: {{^}}DECLARE(test);{{$}}
19 // CHECK-FIXES: {{^}}DEFINE(test);{{$}}
20 
21 } // namespace macros
22