1 | // RUN: %check_clang_tidy %s readability-identifier-naming %t -- \ |
2 | // RUN: -config='{CheckOptions: { \ |
3 | // RUN: readability-identifier-naming.ParameterCase: CamelCase, \ |
4 | // RUN: readability-identifier-naming.IgnoreMainLikeFunctions: true \ |
5 | // RUN: }}' |
6 | |
7 | int mainLike(int argc, char **argv); |
8 | int mainLike(int argc, char **argv, const char **env); |
9 | int mainLike(int argc, const char **argv); |
10 | int mainLike(int argc, const char **argv, const char **env); |
11 | int mainLike(int argc, char *argv[]); |
12 | int mainLike(int argc, const char *argv[]); |
13 | int mainLike(int argc, char *argv[], char *env[]); |
14 | int mainLike(int argc, const char *argv[], const char *env[]); |
15 | void notMain(int argc, char **argv); |
16 | // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for parameter 'argc' |
17 | // CHECK-MESSAGES: :[[@LINE-2]]:31: warning: invalid case style for parameter 'argv' |
18 | void notMain(int argc, char **argv, char **env); |
19 | // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for parameter 'argc' |
20 | // CHECK-MESSAGES: :[[@LINE-2]]:31: warning: invalid case style for parameter 'argv' |
21 | // CHECK-MESSAGES: :[[@LINE-3]]:44: warning: invalid case style for parameter 'env' |
22 | int notMain(int argc, char **argv, char **env, int ); |
23 | // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for parameter 'argc' |
24 | // CHECK-MESSAGES: :[[@LINE-2]]:30: warning: invalid case style for parameter 'argv' |
25 | // CHECK-MESSAGES: :[[@LINE-3]]:43: warning: invalid case style for parameter 'env' |
26 | int notMain(int argc, char **argv, int ); |
27 | // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for parameter 'argc' |
28 | // CHECK-MESSAGES: :[[@LINE-2]]:30: warning: invalid case style for parameter 'argv' |
29 | int notMain(int argc, char *argv); |
30 | // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for parameter 'argc' |
31 | // CHECK-MESSAGES: :[[@LINE-2]]:29: warning: invalid case style for parameter 'argv' |
32 | int notMain(unsigned argc, char **argv); |
33 | // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: invalid case style for parameter 'argc' |
34 | // CHECK-MESSAGES: :[[@LINE-2]]:35: warning: invalid case style for parameter 'argv' |
35 | int notMain(long argc, char *argv); |
36 | // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for parameter 'argc' |
37 | // CHECK-MESSAGES: :[[@LINE-2]]:30: warning: invalid case style for parameter 'argv' |
38 | int notMain(int argc, char16_t **argv); |
39 | // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for parameter 'argc' |
40 | // CHECK-MESSAGES: :[[@LINE-2]]:34: warning: invalid case style for parameter 'argv' |
41 | int notMain(int argc, char argv[]); |
42 | // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for parameter 'argc' |
43 | // CHECK-MESSAGES: :[[@LINE-2]]:28: warning: invalid case style for parameter 'argv' |
44 | typedef char myFunChar; |
45 | typedef int myFunInt; |
46 | typedef char **myFunCharPtr; |
47 | typedef long myFunLong; |
48 | myFunInt mainLikeTypedef(myFunInt argc, myFunChar **argv); |
49 | int mainLikeTypedef(int argc, myFunCharPtr argv); |
50 | int notMainTypedef(myFunLong argc, char **argv); |
51 | // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: invalid case style for parameter 'argc' |
52 | // CHECK-MESSAGES: :[[@LINE-2]]:43: warning: invalid case style for parameter 'argv' |
53 | |
54 | // Don't flag as name contains the word main |
55 | int myMainFunction(int argc, char *argv[]); |
56 | |
57 | // This is fine, named with wmain and has wchar ptr. |
58 | int wmainLike(int argc, wchar_t *argv[]); |
59 | |
60 | // Flag this as has signature of main, but named as wmain. |
61 | int wmainLike(int argc, char *argv[]); |
62 | // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: invalid case style for parameter 'argc' |
63 | // CHECK-MESSAGES: :[[@LINE-2]]:31: warning: invalid case style for parameter 'argv' |
64 | |
65 | struct Foo { |
66 | Foo(int argc, char *argv[]) {} |
67 | // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for parameter 'argc' |
68 | // CHECK-MESSAGES: :[[@LINE-2]]:23: warning: invalid case style for parameter 'argv' |
69 | |
70 | int mainPub(int argc, char *argv[]); |
71 | static int mainPubStatic(int argc, char *argv[]); |
72 | |
73 | protected: |
74 | int mainProt(int argc, char *argv[]); |
75 | // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for parameter 'argc' |
76 | // CHECK-MESSAGES: :[[@LINE-2]]:32: warning: invalid case style for parameter 'argv' |
77 | static int mainProtStatic(int argc, char *argv[]); |
78 | // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: invalid case style for parameter 'argc' |
79 | // CHECK-MESSAGES: :[[@LINE-2]]:45: warning: invalid case style for parameter 'argv' |
80 | |
81 | private: |
82 | int mainPriv(int argc, char *argv[]); |
83 | // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for parameter 'argc' |
84 | // CHECK-MESSAGES: :[[@LINE-2]]:32: warning: invalid case style for parameter 'argv' |
85 | static int mainPrivStatic(int argc, char *argv[]); |
86 | // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: invalid case style for parameter 'argc' |
87 | // CHECK-MESSAGES: :[[@LINE-2]]:45: warning: invalid case style for parameter 'argv' |
88 | }; |
89 | |