aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration-ignore-macros.cpp
blob: 1fe7d1d356db379d086e92a0387233b3beb84c78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
// RUN:   -config="{CheckOptions: \
// RUN:             {readability-redundant-declaration.IgnoreMacros: \
// RUN:                true}}"

extern int Xyz;
extern int Xyz; // Xyz
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'Xyz' declaration [readability-redundant-declaration]
// CHECK-FIXES: // Xyz

namespace macros {
#define DECLARE(x) extern int x
#define DEFINE(x) extern int x; int x = 42
DECLARE(test);
DEFINE(test);
// CHECK-FIXES: #define DECLARE(x) extern int x
// CHECK-FIXES: #define DEFINE(x) extern int x; int x = 42
// CHECK-FIXES: DECLARE(test);
// CHECK-FIXES: DEFINE(test);

} // namespace macros