Debian Codegraph @

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

raw
1 // RUN: %check_clang_tidy %s readability-redundant-access-specifiers %t -- \
2 // RUN: -config="{CheckOptions: {readability-redundant-access-specifiers.CheckFirstDeclaration: true}}" --
3
4 class FooPublic {
5 private: // 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
11 struct StructPublic {
12 public: // 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
18 union UnionPublic {
19 public: // 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
25 class FooMacro {
26 #if defined(ZZ)
27 private:
28 #endif
29 int a;
30 };
31
32 class ValidInnerStruct {
33 struct Inner {
34 private:
35 int b;
36 };
37 };
38
39 #define MIXIN private: int b;
40
41 class ValidMacro {
42 MIXIN
43 };