44 lines · cpp
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-06 // 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-08 int a;9};10 11struct StructPublic {12public: // comment-113 // 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-115 int a;16};17 18union UnionPublic {19public: // comment-220 // 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-222 int a;23};24 25class FooMacro {26#if defined(ZZ)27private:28#endif29 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 MIXIN43};44