brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 8c47636 Raw
117 lines · cpp
1// RUN: %check_clang_tidy %s readability-redundant-access-specifiers %t2 3class FooPublic {4public:5  int a;6public: // comment-07  // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]8  // CHECK-MESSAGES: :[[@LINE-4]]:1: note: previously declared here9  // CHECK-FIXES: // comment-010  int b;11private:12  int c;13};14 15struct StructPublic {16public:17  int a;18public: // comment-119  // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]20  // CHECK-MESSAGES: :[[@LINE-4]]:1: note: previously declared here21  // CHECK-FIXES: // comment-122  int b;23private:24  int c;25};26 27union UnionPublic {28public:29  int a;30public: // comment-231  // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]32  // CHECK-MESSAGES: :[[@LINE-4]]:1: note: previously declared here33  // CHECK-FIXES: // comment-234  int b;35private:36  int c;37};38 39class FooProtected {40protected:41  int a;42protected: // comment-343  // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]44  // CHECK-MESSAGES: :[[@LINE-4]]:1: note: previously declared here45  // CHECK-FIXES: // comment-346  int b;47private:48  int c;49};50 51class FooPrivate {52private:53  int a;54private: // comment-455  // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]56  // CHECK-MESSAGES: :[[@LINE-4]]:1: note: previously declared here57  // CHECK-FIXES: // comment-458  int b;59public:60  int c;61};62 63class FooMacro {64private:65  int a;66#if defined(ZZ)67  public:68  int b;69#endif70private: // comment-571  // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]72  // CHECK-MESSAGES: :[[@LINE-8]]:1: note: previously declared here73  // CHECK-FIXES: // comment-574  int c;75protected:76  int d;77public:78  int e;79};80 81class Valid {82private:83  int a;84public:85  int b;86private:87  int c;88protected:89  int d;90public:91  int e;92};93 94class ValidInnerClass {95public:96  int a;97 98  class Inner {99  public:100    int b;101  };102};103 104#define MIXIN private: int b;105 106class ValidMacro {107private:108  int a;109MIXIN110private:111  int c;112protected:113  int d;114public:115  int e;116};117