1 // RUN: %check_clang_tidy %s misc-use-anonymous-namespace %t 2 3 static void f1(); 4 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: function 'f1' declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace] 5 static int v1; 6 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: variable 'v1' declared 'static', move to anonymous namespace instead 7 8 namespace a { 9 static void f3(); 10 // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: function 'f3' declared 'static', move to anonymous namespace instead 11 static int v3; 12 // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: variable 'v3' declared 'static', move to anonymous namespace instead 13 } 14 15 // OK 16 void f5(); 17 int v5; 18 19 // OK 20 namespace { 21 void f6(); 22 int v6; 23 } 24 25 // OK 26 namespace a { 27 namespace { 28 void f7(); 29 int v7; 30 } 31 } 32 33 // OK 34 struct Foo { 35 static void f(); 36 static int x; 37 }; 38 39 // OK 40 void foo() 41 { 42 static int x; 43 } 44