1// RUN: %check_clang_tidy %s readability-redundant-access-specifiers %t -- \
2// RUN: -config="{CheckOptions: {readability-redundant-access-specifiers.CheckFirstDeclaration: true}}" --
3
4class FooPublic {
5private: // comment-0
6 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: redundant access specifier has the same accessibility as the implicit access specifier [readability-redundant-access-specifiers]
7 // CHECK-FIXES: {{^}}// comment-0{{$}}
8 int a;
9};
10
11struct StructPublic {
12public: // comment-1
13 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: redundant access specifier has the same accessibility as the implicit access specifier [readability-redundant-access-specifiers]
14 // CHECK-FIXES: {{^}}// comment-1{{$}}
15 int a;
16};
17
18union UnionPublic {
19public: // comment-2
20 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: redundant access specifier has the same accessibility as the implicit access specifier [readability-redundant-access-specifiers]
21 // CHECK-FIXES: {{^}}// comment-2{{$}}
22 int a;
23};
24
25class FooMacro {
26#if defined(ZZ)
27private:
28#endif
29 int a;
30};
31
32class ValidInnerStruct {
33 struct Inner {
34 private:
35 int b;
36 };
37};
38
39#define MIXIN private: int b;
40
41class ValidMacro {
42 MIXIN
43};
44

source code of clang-tools-extra/test/clang-tidy/checkers/readability/redundant-access-specifiers-check-first-declaration.cpp