63 lines · cpp
1// RUN: %check_clang_tidy %s misc-use-internal-linkage %t -- -- -I%S/Inputs/use-internal-linkage2// 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-linkage4 5#include "var.h"6 7int global;8// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'global'9// CHECK-FIXES: static int global;10 11template<class T>12T global_template;13// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: variable 'global_template'14// CHECK-FIXES: static T global_template;15 16int 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 20const 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 24const 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 28int gloabl_header;29 30extern int global_extern;31 32static int global_static;33 34thread_local int global_thread_local;35 36namespace {37static int global_anonymous_ns;38namespace NS {39static int global_anonymous_ns;40}41}42 43static void f(int para) {44 int local;45 static int local_static;46 thread_local int local_thread_local;47}48 49struct S {50 int m1;51 static int m2;52};53int S::m2;54 55extern "C" {56int global_in_extern_c_1;57}58 59extern "C" int global_in_extern_c_2;60 61const int const_global = 123;62constexpr int constexpr_global = 123;63