brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 0a363dd Raw
76 lines · cpp
1// RUN: %check_clang_tidy -check-suffixes=DTORS,WIDENING,NARROWING %s misc-override-with-different-visibility %t -- \2// RUN:   -config="{CheckOptions: {misc-override-with-different-visibility.CheckDestructors: true}}"3 4// RUN: %check_clang_tidy -check-suffixes=OPS,WIDENING,NARROWING %s misc-override-with-different-visibility %t -- \5// RUN:   -config="{CheckOptions: {misc-override-with-different-visibility.CheckOperators: true}}"6 7// RUN: %check_clang_tidy -check-suffixes=WIDENING %s misc-override-with-different-visibility %t -- \8// RUN:   -config="{CheckOptions: {misc-override-with-different-visibility.DisallowedVisibilityChange: 'widening'}}"9 10// RUN: %check_clang_tidy -check-suffixes=NARROWING %s misc-override-with-different-visibility %t -- \11// RUN:   -config="{CheckOptions: {misc-override-with-different-visibility.DisallowedVisibilityChange: 'narrowing'}}"12 13namespace test_change {14 15class A {16protected:17  virtual void f1();18  virtual void f2();19};20 21class B: public A {22public:23  void f1();24  // CHECK-MESSAGES-WIDENING: :[[@LINE-1]]:8: warning: visibility of function 'f1'25  // CHECK-MESSAGES-WIDENING: :[[@LINE-8]]:16: note: function declared here26private:27  void f2();28  // CHECK-MESSAGES-NARROWING: :[[@LINE-1]]:8: warning: visibility of function 'f2'29  // CHECK-MESSAGES-NARROWING: :[[@LINE-11]]:16: note: function declared here30};31 32}33 34namespace test_destructor {35 36class A {37public:38  virtual ~A();39};40 41class B: public A {42protected:43  ~B();44  // CHECK-MESSAGES-DTORS: :[[@LINE-1]]:3: warning: visibility of function '~B'45  // CHECK-MESSAGES-DTORS: :[[@LINE-7]]:11: note: function declared here46};47 48}49 50namespace test_operator {51 52class A {53  virtual A& operator=(const A&);54  virtual A& operator++();55  virtual int operator()(int);56  virtual operator double() const;57};58 59class B: public A {60protected:61  A& operator=(const A&);62  // CHECK-MESSAGES-OPS: :[[@LINE-1]]:6: warning: visibility of function 'operator='63  // CHECK-MESSAGES-OPS: :[[@LINE-10]]:14: note: function declared here64  A& operator++();65  // CHECK-MESSAGES-OPS: :[[@LINE-1]]:6: warning: visibility of function 'operator++'66  // CHECK-MESSAGES-OPS: :[[@LINE-12]]:14: note: function declared here67  int operator()(int);68  // CHECK-MESSAGES-OPS: :[[@LINE-1]]:7: warning: visibility of function 'operator()'69  // CHECK-MESSAGES-OPS: :[[@LINE-14]]:15: note: function declared here70  operator double() const;71  // CHECK-MESSAGES-OPS: :[[@LINE-1]]:3: warning: visibility of function 'operator double'72  // CHECK-MESSAGES-OPS: :[[@LINE-16]]:11: note: function declared here73};74 75}76