1 // RUN: %check_clang_tidy %s misc-use-internal-linkage %t -- -- -I%S/Inputs/use-internal-linkage 2 // RUN: %check_clang_tidy %s misc-use-internal-linkage %t -- \ 3 // RUN: -config="{CheckOptions: {misc-use-internal-linkage.FixMode: 'UseStatic'}}" -- -I%S/Inputs/use-internal-linkage 4 5 #include "var.h" 6 7 int global; 8 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'global' 9 // CHECK-FIXES: static int global; 10 11 template<class T> 12 T global_template; 13 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: variable 'global_template' 14 // CHECK-FIXES: static T global_template; 15 16 int const* ptr_const_star; 17 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: variable 'ptr_const_star' 18 // CHECK-FIXES: static int const* ptr_const_star; 19 20 const int* const_ptr_star; 21 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: variable 'const_ptr_star' 22 // CHECK-FIXES: static const int* const_ptr_star; 23 24 const volatile int* const_volatile_ptr_star; 25 // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: variable 'const_volatile_ptr_star' 26 // CHECK-FIXES: static const volatile int* const_volatile_ptr_star; 27 28 int gloabl_header; 29 30 extern int global_extern; 31 32 static int global_static; 33 34 namespace { 35 static int global_anonymous_ns; 36 namespace NS { 37 static int global_anonymous_ns; 38 } 39 } 40 41 static void f(int para) { 42 int local; 43 static int local_static; 44 } 45 46 struct S { 47 int m1; 48 static int m2; 49 }; 50 int S::m2; 51 52 extern "C" { 53 int global_in_extern_c_1; 54 } 55 56 extern "C" int global_in_extern_c_2; 57 58 const int const_global = 123; 59 constexpr int constexpr_global = 123; 60