Debian Codegraph @

clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-var.cpp

raw
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 gloabl_header;
17
18 extern int global_extern;
19
20 static int global_static;
21
22 namespace {
23 static int global_anonymous_ns;
24 namespace NS {
25 static int global_anonymous_ns;
26 }
27 }
28
29 static void f(int para) {
30 int local;
31 static int local_static;
32 }
33
34 struct S {
35 int m1;
36 static int m2;
37 };
38 int S::m2;
39
40 extern "C" {
41 int global_in_extern_c_1;
42 }
43
44 extern "C" int global_in_extern_c_2;
45
46 const int const_global = 123;
47 constexpr int constexpr_global = 123;