1// RUN: %check_clang_tidy %s readability-identifier-naming %t -- \
2// RUN: --config-file=%S/Inputs/identifier-naming/hungarian-notation2/.clang-tidy -- -I %S
3
4#include "identifier-naming-standard-types.h"
5
6// clang-format off
7//===----------------------------------------------------------------------===//
8// Cases to CheckOptions
9//===----------------------------------------------------------------------===//
10class CMyClass1 {
11public:
12 static int ClassMemberCase;
13 // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for class member 'ClassMemberCase' [readability-identifier-naming]
14 // CHECK-FIXES: {{^}} static int myiClassMemberCase;
15
16 char const ConstantMemberCase = 0;
17 // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for constant member 'ConstantMemberCase' [readability-identifier-naming]
18 // CHECK-FIXES: {{^}} char const mycConstantMemberCase = 0;
19
20 void MyFunc1(const int ConstantParameterCase);
21 // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for constant parameter 'ConstantParameterCase' [readability-identifier-naming]
22 // CHECK-FIXES: {{^}} void MyFunc1(const int myiConstantParameterCase);
23
24 void MyFunc2(const int* ConstantPointerParameterCase);
25 // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: invalid case style for pointer parameter 'ConstantPointerParameterCase' [readability-identifier-naming]
26 // CHECK-FIXES: {{^}} void MyFunc2(const int* mypmyiConstantPointerParameterCase);
27
28 static constexpr int ConstexprVariableCase = 123;
29 // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for constexpr variable 'ConstexprVariableCase' [readability-identifier-naming]
30 // CHECK-FIXES: {{^}} static constexpr int myiConstexprVariableCase = 123;
31};
32
33const int GlobalConstantCase = 0;
34// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global constant 'GlobalConstantCase' [readability-identifier-naming]
35// CHECK-FIXES: {{^}}const int myiGlobalConstantCase = 0;
36
37const int* GlobalConstantPointerCase = nullptr;
38// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global pointer 'GlobalConstantPointerCase' [readability-identifier-naming]
39// CHECK-FIXES: {{^}}const int* mypmyiGlobalConstantPointerCase = nullptr;
40
41int* GlobalPointerCase = nullptr;
42// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global pointer 'GlobalPointerCase' [readability-identifier-naming]
43// CHECK-FIXES: {{^}}int* mypmyiGlobalPointerCase = nullptr;
44
45int GlobalVariableCase = 0;
46// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'GlobalVariableCase' [readability-identifier-naming]
47// CHECK-FIXES: {{^}}int myiGlobalVariableCase = 0;
48
49void Func1(){
50 int const LocalConstantCase = 3;
51 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for local constant 'LocalConstantCase' [readability-identifier-naming]
52 // CHECK-FIXES: {{^}} int const myiLocalConstantCase = 3;
53
54 unsigned const ConstantCase = 1;
55 // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for local constant 'ConstantCase' [readability-identifier-naming]
56 // CHECK-FIXES: {{^}} unsigned const myuConstantCase = 1;
57
58 int* const LocalConstantPointerCase = nullptr;
59 // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for local constant pointer 'LocalConstantPointerCase' [readability-identifier-naming]
60 // CHECK-FIXES: {{^}} int* const mypmyiLocalConstantPointerCase = nullptr;
61
62 int *LocalPointerCase = nullptr;
63 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for local pointer 'LocalPointerCase' [readability-identifier-naming]
64 // CHECK-FIXES: {{^}} int *mypmyiLocalPointerCase = nullptr;
65
66 int LocalVariableCase = 0;
67 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for local variable 'LocalVariableCase' [readability-identifier-naming]
68 // CHECK-FIXES: {{^}} int myiLocalVariableCase = 0;
69}
70
71class CMyClass2 {
72 char MemberCase;
73 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for private member 'MemberCase' [readability-identifier-naming]
74 // CHECK-FIXES: {{^}} char mycMemberCase;
75
76 void Func1(int ParameterCase);
77 // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for parameter 'ParameterCase' [readability-identifier-naming]
78 // CHECK-FIXES: {{^}} void Func1(int myiParameterCase);
79
80 void Func2(const int ParameterCase);
81 // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for constant parameter 'ParameterCase' [readability-identifier-naming]
82 // CHECK-FIXES: {{^}} void Func2(const int myiParameterCase);
83
84 void Func3(const int *PointerParameterCase);
85 // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: invalid case style for pointer parameter 'PointerParameterCase' [readability-identifier-naming]
86 // CHECK-FIXES: {{^}} void Func3(const int *mypmyiPointerParameterCase);
87};
88
89class CMyClass3 {
90private:
91 char PrivateMemberCase;
92 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for private member 'PrivateMemberCase' [readability-identifier-naming]
93 // CHECK-FIXES: {{^}} char mycPrivateMemberCase;
94
95protected:
96 char ProtectedMemberCase;
97 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for protected member 'ProtectedMemberCase' [readability-identifier-naming]
98 // CHECK-FIXES: {{^}} char mycProtectedMemberCase;
99
100public:
101 char PublicMemberCase;
102 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for public member 'PublicMemberCase' [readability-identifier-naming]
103 // CHECK-FIXES: {{^}} char mycPublicMemberCase;
104};
105
106static const int StaticConstantCase = 3;
107// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global constant 'StaticConstantCase' [readability-identifier-naming]
108// CHECK-FIXES: {{^}}static const int myiStaticConstantCase = 3;
109
110static int StaticVariableCase = 3;
111// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'StaticVariableCase' [readability-identifier-naming]
112// CHECK-FIXES: {{^}}static int myiStaticVariableCase = 3;
113
114struct CMyStruct { int StructCase; };
115// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for public member 'StructCase' [readability-identifier-naming]
116// CHECK-FIXES: {{^}}struct CMyStruct { int myiStructCase; };
117
118union MyUnion { int UnionCase; long mylUnionCase; };
119// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: invalid case style for public member 'UnionCase' [readability-identifier-naming]
120// CHECK-FIXES: {{^}}union MyUnion { int myiUnionCase; long mylUnionCase; };
121
122//===----------------------------------------------------------------------===//
123// C string
124//===----------------------------------------------------------------------===//
125const char *NamePtr = "Name";
126// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global pointer 'NamePtr' [readability-identifier-naming]
127// CHECK-FIXES: {{^}}const char *myszNamePtr = "Name";
128
129const char NameArray[] = "Name";
130// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global constant 'NameArray' [readability-identifier-naming]
131// CHECK-FIXES: {{^}}const char myszNameArray[] = "Name";
132
133const char *NamePtrArray[] = {"AA", "BB"};
134// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global variable 'NamePtrArray' [readability-identifier-naming]
135// CHECK-FIXES: {{^}}const char *mypmyszNamePtrArray[] = {"AA", "BB"};
136
137const wchar_t *WideNamePtr = L"Name";
138// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global pointer 'WideNamePtr' [readability-identifier-naming]
139// CHECK-FIXES: {{^}}const wchar_t *mywszWideNamePtr = L"Name";
140
141const wchar_t WideNameArray[] = L"Name";
142// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global constant 'WideNameArray' [readability-identifier-naming]
143// CHECK-FIXES: {{^}}const wchar_t mywszWideNameArray[] = L"Name";
144
145const wchar_t *WideNamePtrArray[] = {L"AA", L"BB"};
146// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global variable 'WideNamePtrArray' [readability-identifier-naming]
147// CHECK-FIXES: {{^}}const wchar_t *mypmywszWideNamePtrArray[] = {L"AA", L"BB"};
148
149class CMyClass4 {
150private:
151 char *Name = "Text";
152 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for private member 'Name' [readability-identifier-naming]
153 // CHECK-FIXES: {{^}} char *myszName = "Text";
154
155 const char *ConstName = "Text";
156 // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for private member 'ConstName' [readability-identifier-naming]
157 // CHECK-FIXES: {{^}} const char *myszConstName = "Text";
158
159public:
160 const char* DuplicateString(const char* Input, size_t mynRequiredSize);
161 // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: invalid case style for pointer parameter 'Input' [readability-identifier-naming]
162 // CHECK-FIXES: {{^}} const char* DuplicateString(const char* myszInput, size_t mynRequiredSize);
163
164 size_t UpdateText(const char* Buffer, size_t mynBufferSize);
165 // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: invalid case style for pointer parameter 'Buffer' [readability-identifier-naming]
166 // CHECK-FIXES: {{^}} size_t UpdateText(const char* myszBuffer, size_t mynBufferSize);
167};
168
169
170//===----------------------------------------------------------------------===//
171// Microsoft Windows data types
172//===----------------------------------------------------------------------===//
173DWORD MsDword = 0;
174// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsDword' [readability-identifier-naming]
175// CHECK-FIXES: {{^}}DWORD mydwMsDword = 0;
176
177BYTE MsByte = 0;
178// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsByte' [readability-identifier-naming]
179// CHECK-FIXES: {{^}}BYTE mybyMsByte = 0;
180
181WORD MsWord = 0;
182// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsWord' [readability-identifier-naming]
183// CHECK-FIXES: {{^}}WORD mywMsWord = 0;
184
185BOOL MsBool = 0;
186// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsBool' [readability-identifier-naming]
187// CHECK-FIXES: {{^}}BOOL mybMsBool = 0;
188
189BOOLEAN MsBoolean = 0;
190// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsBoolean' [readability-identifier-naming]
191// CHECK-FIXES: {{^}}BOOLEAN mybMsBoolean = 0;
192
193CHAR MsValueChar = 0;
194// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueChar' [readability-identifier-naming]
195// CHECK-FIXES: {{^}}CHAR mycMsValueChar = 0;
196
197UCHAR MsValueUchar = 0;
198// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueUchar' [readability-identifier-naming]
199// CHECK-FIXES: {{^}}UCHAR myucMsValueUchar = 0;
200
201SHORT MsValueShort = 0;
202// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueShort' [readability-identifier-naming]
203// CHECK-FIXES: {{^}}SHORT mysMsValueShort = 0;
204
205USHORT MsValueUshort = 0;
206// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUshort' [readability-identifier-naming]
207// CHECK-FIXES: {{^}}USHORT myusMsValueUshort = 0;
208
209WORD MsValueWord = 0;
210// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueWord' [readability-identifier-naming]
211// CHECK-FIXES: {{^}}WORD mywMsValueWord = 0;
212
213DWORD MsValueDword = 0;
214// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueDword' [readability-identifier-naming]
215// CHECK-FIXES: {{^}}DWORD mydwMsValueDword = 0;
216
217DWORD32 MsValueDword32 = 0;
218// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueDword32' [readability-identifier-naming]
219// CHECK-FIXES: {{^}}DWORD32 mydw32MsValueDword32 = 0;
220
221DWORD64 MsValueDword64 = 0;
222// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueDword64' [readability-identifier-naming]
223// CHECK-FIXES: {{^}}DWORD64 mydw64MsValueDword64 = 0;
224
225LONG MsValueLong = 0;
226// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueLong' [readability-identifier-naming]
227// CHECK-FIXES: {{^}}LONG mylMsValueLong = 0;
228
229ULONG MsValueUlong = 0;
230// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueUlong' [readability-identifier-naming]
231// CHECK-FIXES: {{^}}ULONG myulMsValueUlong = 0;
232
233ULONG32 MsValueUlong32 = 0;
234// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueUlong32' [readability-identifier-naming]
235// CHECK-FIXES: {{^}}ULONG32 myul32MsValueUlong32 = 0;
236
237ULONG64 MsValueUlong64 = 0;
238// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueUlong64' [readability-identifier-naming]
239// CHECK-FIXES: {{^}}ULONG64 myul64MsValueUlong64 = 0;
240
241ULONGLONG MsValueUlongLong = 0;
242// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global variable 'MsValueUlongLong' [readability-identifier-naming]
243// CHECK-FIXES: {{^}}ULONGLONG myullMsValueUlongLong = 0;
244
245HANDLE MsValueHandle = 0;
246// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global pointer 'MsValueHandle' [readability-identifier-naming]
247// CHECK-FIXES: {{^}}HANDLE myhMsValueHandle = 0;
248
249INT MsValueInt = 0;
250// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'MsValueInt' [readability-identifier-naming]
251// CHECK-FIXES: {{^}}INT myiMsValueInt = 0;
252
253INT8 MsValueInt8 = 0;
254// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueInt8' [readability-identifier-naming]
255// CHECK-FIXES: {{^}}INT8 myi8MsValueInt8 = 0;
256
257INT16 MsValueInt16 = 0;
258// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueInt16' [readability-identifier-naming]
259// CHECK-FIXES: {{^}}INT16 myi16MsValueInt16 = 0;
260
261INT32 MsValueInt32 = 0;
262// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueInt32' [readability-identifier-naming]
263// CHECK-FIXES: {{^}}INT32 myi32MsValueInt32 = 0;
264
265INT64 MsValueINt64 = 0;
266// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueINt64' [readability-identifier-naming]
267// CHECK-FIXES: {{^}}INT64 myi64MsValueINt64 = 0;
268
269UINT MsValueUint = 0;
270// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueUint' [readability-identifier-naming]
271// CHECK-FIXES: {{^}}UINT myuiMsValueUint = 0;
272
273UINT8 MsValueUint8 = 0;
274// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueUint8' [readability-identifier-naming]
275// CHECK-FIXES: {{^}}UINT8 myu8MsValueUint8 = 0;
276
277UINT16 MsValueUint16 = 0;
278// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUint16' [readability-identifier-naming]
279// CHECK-FIXES: {{^}}UINT16 myu16MsValueUint16 = 0;
280
281UINT32 MsValueUint32 = 0;
282// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUint32' [readability-identifier-naming]
283// CHECK-FIXES: {{^}}UINT32 myu32MsValueUint32 = 0;
284
285UINT64 MsValueUint64 = 0;
286// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUint64' [readability-identifier-naming]
287// CHECK-FIXES: {{^}}UINT64 myu64MsValueUint64 = 0;
288
289PVOID MsValuePvoid = NULL;
290// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global pointer 'MsValuePvoid' [readability-identifier-naming]
291// CHECK-FIXES: {{^}}PVOID mypMsValuePvoid = NULL;
292
293
294//===----------------------------------------------------------------------===//
295// Array
296//===----------------------------------------------------------------------===//
297unsigned GlobalUnsignedArray[] = {1, 2, 3};
298// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'GlobalUnsignedArray' [readability-identifier-naming]
299// CHECK-FIXES: {{^}}unsigned myaGlobalUnsignedArray[] = {1, 2, 3};
300
301int GlobalIntArray[] = {1, 2, 3};
302// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'GlobalIntArray' [readability-identifier-naming]
303// CHECK-FIXES: {{^}}int myaGlobalIntArray[] = {1, 2, 3};
304
305int DataInt[1] = {0};
306// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'DataInt' [readability-identifier-naming]
307// CHECK-FIXES: {{^}}int myaDataInt[1] = {0};
308
309int DataArray[2] = {0};
310// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'DataArray' [readability-identifier-naming]
311// CHECK-FIXES: {{^}}int myaDataArray[2] = {0};
312
313
314//===----------------------------------------------------------------------===//
315// Pointer
316//===----------------------------------------------------------------------===//
317int *DataIntPtr[1] = {0};
318// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'DataIntPtr' [readability-identifier-naming]
319// CHECK-FIXES: {{^}}int *mypmyaDataIntPtr[1] = {0};
320
321void *BufferPtr1;
322// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global pointer 'BufferPtr1' [readability-identifier-naming]
323// CHECK-FIXES: {{^}}void *mypmyvBufferPtr1;
324
325void **BufferPtr2;
326// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global pointer 'BufferPtr2' [readability-identifier-naming]
327// CHECK-FIXES: {{^}}void **mypmypmyvBufferPtr2;
328
329void **mypBufferPtr3;
330// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global pointer 'mypBufferPtr3' [readability-identifier-naming]
331// CHECK-FIXES: {{^}}void **mypmypmyvBufferPtr3;
332
333int *mypBufferPtr4;
334// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global pointer 'mypBufferPtr4' [readability-identifier-naming]
335// CHECK-FIXES: {{^}}int *mypmyiBufferPtr4;
336
337typedef void (*FUNC_PTR_HELLO)();
338FUNC_PTR_HELLO Hello = NULL;
339// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global pointer 'Hello' [readability-identifier-naming]
340// CHECK-FIXES: {{^}}FUNC_PTR_HELLO myfnHello = NULL;
341
342void *ValueVoidPtr = NULL;
343// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global pointer 'ValueVoidPtr' [readability-identifier-naming]
344// CHECK-FIXES: {{^}}void *mypmyvValueVoidPtr = NULL;
345
346ptrdiff_t PtrDiff = NULL;
347// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global variable 'PtrDiff' [readability-identifier-naming]
348// CHECK-FIXES: {{^}}ptrdiff_t mypPtrDiff = NULL;
349
350int8_t *ValueI8Ptr;
351// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global pointer 'ValueI8Ptr' [readability-identifier-naming]
352// CHECK-FIXES: {{^}}int8_t *mypmyi8ValueI8Ptr;
353
354uint8_t *ValueU8Ptr;
355// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global pointer 'ValueU8Ptr' [readability-identifier-naming]
356// CHECK-FIXES: {{^}}uint8_t *mypmyu8ValueU8Ptr;
357
358unsigned char *ValueUcPtr;
359// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global pointer 'ValueUcPtr' [readability-identifier-naming]
360// CHECK-FIXES: {{^}}unsigned char *mypmyucValueUcPtr;
361
362unsigned char **ValueUcPtr2;
363// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for global pointer 'ValueUcPtr2' [readability-identifier-naming]
364// CHECK-FIXES: {{^}}unsigned char **mypmypmyucValueUcPtr2;
365
366void MyFunc2(void* Val){}
367// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for pointer parameter 'Val' [readability-identifier-naming]
368// CHECK-FIXES: {{^}}void MyFunc2(void* mypmyvVal){}
369
370
371//===----------------------------------------------------------------------===//
372// Reference
373//===----------------------------------------------------------------------===//
374int myiValueIndex = 1;
375int &RefValueIndex = myiValueIndex;
376// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'RefValueIndex' [readability-identifier-naming]
377// CHECK-FIXES: {{^}}int &myiRefValueIndex = myiValueIndex;
378
379const int &ConstRefValue = myiValueIndex;
380// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'ConstRefValue' [readability-identifier-naming]
381// CHECK-FIXES: {{^}}const int &myiConstRefValue = myiValueIndex;
382
383long long myllValueLongLong = 2;
384long long &RefValueLongLong = myllValueLongLong;
385// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'RefValueLongLong' [readability-identifier-naming]
386// CHECK-FIXES: {{^}}long long &myllRefValueLongLong = myllValueLongLong;
387
388
389//===----------------------------------------------------------------------===//
390// Various types
391//===----------------------------------------------------------------------===//
392int8_t ValueI8;
393// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueI8' [readability-identifier-naming]
394// CHECK-FIXES: {{^}}int8_t myi8ValueI8;
395
396int16_t ValueI16 = 0;
397// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'ValueI16' [readability-identifier-naming]
398// CHECK-FIXES: {{^}}int16_t myi16ValueI16 = 0;
399
400int32_t ValueI32 = 0;
401// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'ValueI32' [readability-identifier-naming]
402// CHECK-FIXES: {{^}}int32_t myi32ValueI32 = 0;
403
404int64_t ValueI64 = 0;
405// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'ValueI64' [readability-identifier-naming]
406// CHECK-FIXES: {{^}}int64_t myi64ValueI64 = 0;
407
408uint8_t ValueU8 = 0;
409// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'ValueU8' [readability-identifier-naming]
410// CHECK-FIXES: {{^}}uint8_t myu8ValueU8 = 0;
411
412uint16_t ValueU16 = 0;
413// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueU16' [readability-identifier-naming]
414// CHECK-FIXES: {{^}}uint16_t myu16ValueU16 = 0;
415
416uint32_t ValueU32 = 0;
417// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueU32' [readability-identifier-naming]
418// CHECK-FIXES: {{^}}uint32_t myu32ValueU32 = 0;
419
420uint64_t ValueU64 = 0;
421// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueU64' [readability-identifier-naming]
422// CHECK-FIXES: {{^}}uint64_t myu64ValueU64 = 0;
423
424float ValueFloat = 0;
425// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'ValueFloat' [readability-identifier-naming]
426// CHECK-FIXES: {{^}}float myfValueFloat = 0;
427
428double ValueDouble = 0;
429// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueDouble' [readability-identifier-naming]
430// CHECK-FIXES: {{^}}double mydValueDouble = 0;
431
432char ValueChar = 'c';
433// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'ValueChar' [readability-identifier-naming]
434// CHECK-FIXES: {{^}}char mycValueChar = 'c';
435
436bool ValueBool = true;
437// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'ValueBool' [readability-identifier-naming]
438// CHECK-FIXES: {{^}}bool mybValueBool = true;
439
440int ValueInt = 0;
441// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'ValueInt' [readability-identifier-naming]
442// CHECK-FIXES: {{^}}int myiValueInt = 0;
443
444size_t ValueSize = 0;
445// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueSize' [readability-identifier-naming]
446// CHECK-FIXES: {{^}}size_t mynValueSize = 0;
447
448wchar_t ValueWchar = 'w';
449// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'ValueWchar' [readability-identifier-naming]
450// CHECK-FIXES: {{^}}wchar_t mywcValueWchar = 'w';
451
452short ValueShort = 0;
453// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'ValueShort' [readability-identifier-naming]
454// CHECK-FIXES: {{^}}short mysValueShort = 0;
455
456unsigned ValueUnsigned = 0;
457// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueUnsigned' [readability-identifier-naming]
458// CHECK-FIXES: {{^}}unsigned myuValueUnsigned = 0;
459
460signed ValueSigned = 0;
461// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueSigned' [readability-identifier-naming]
462// CHECK-FIXES: {{^}}signed mysValueSigned = 0;
463
464long ValueLong = 0;
465// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'ValueLong' [readability-identifier-naming]
466// CHECK-FIXES: {{^}}long mylValueLong = 0;
467
468long long ValueLongLong = 0;
469// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global variable 'ValueLongLong' [readability-identifier-naming]
470// CHECK-FIXES: {{^}}long long myllValueLongLong = 0;
471
472long long int ValueLongLongInt = 0;
473// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global variable 'ValueLongLongInt' [readability-identifier-naming]
474// CHECK-FIXES: {{^}}long long int mylliValueLongLongInt = 0;
475
476long double ValueLongDouble = 0;
477// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global variable 'ValueLongDouble' [readability-identifier-naming]
478// CHECK-FIXES: {{^}}long double myldValueLongDouble = 0;
479
480signed int ValueSignedInt = 0;
481// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'ValueSignedInt' [readability-identifier-naming]
482// CHECK-FIXES: {{^}}signed int mysiValueSignedInt = 0;
483
484signed short ValueSignedShort = 0;
485// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'ValueSignedShort' [readability-identifier-naming]
486// CHECK-FIXES: {{^}}signed short myssValueSignedShort = 0;
487
488signed short int ValueSignedShortInt = 0;
489// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global variable 'ValueSignedShortInt' [readability-identifier-naming]
490// CHECK-FIXES: {{^}}signed short int myssiValueSignedShortInt = 0;
491
492signed long long ValueSignedLongLong = 0;
493// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global variable 'ValueSignedLongLong' [readability-identifier-naming]
494// CHECK-FIXES: {{^}}signed long long mysllValueSignedLongLong = 0;
495
496signed long int ValueSignedLongInt = 0;
497// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for global variable 'ValueSignedLongInt' [readability-identifier-naming]
498// CHECK-FIXES: {{^}}signed long int mysliValueSignedLongInt = 0;
499
500signed long ValueSignedLong = 0;
501// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global variable 'ValueSignedLong' [readability-identifier-naming]
502// CHECK-FIXES: {{^}}signed long myslValueSignedLong = 0;
503
504unsigned long long int ValueUnsignedLongLongInt = 0;
505// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for global variable 'ValueUnsignedLongLongInt' [readability-identifier-naming]
506// CHECK-FIXES: {{^}}unsigned long long int myulliValueUnsignedLongLongInt = 0;
507
508unsigned long long ValueUnsignedLongLong = 0;
509// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for global variable 'ValueUnsignedLongLong' [readability-identifier-naming]
510// CHECK-FIXES: {{^}}unsigned long long myullValueUnsignedLongLong = 0;
511
512unsigned long int ValueUnsignedLongInt = 0;
513// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: invalid case style for global variable 'ValueUnsignedLongInt' [readability-identifier-naming]
514// CHECK-FIXES: {{^}}unsigned long int myuliValueUnsignedLongInt = 0;
515
516unsigned long ValueUnsignedLong = 0;
517// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global variable 'ValueUnsignedLong' [readability-identifier-naming]
518// CHECK-FIXES: {{^}}unsigned long myulValueUnsignedLong = 0;
519
520unsigned short int ValueUnsignedShortInt = 0;
521// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for global variable 'ValueUnsignedShortInt' [readability-identifier-naming]
522// CHECK-FIXES: {{^}}unsigned short int myusiValueUnsignedShortInt = 0;
523
524unsigned short ValueUnsignedShort = 0;
525// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global variable 'ValueUnsignedShort' [readability-identifier-naming]
526// CHECK-FIXES: {{^}}unsigned short myusValueUnsignedShort = 0;
527
528unsigned int ValueUnsignedInt = 0;
529// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'ValueUnsignedInt' [readability-identifier-naming]
530// CHECK-FIXES: {{^}}unsigned int myuiValueUnsignedInt = 0;
531
532unsigned char ValueUnsignedChar = 0;
533// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global variable 'ValueUnsignedChar' [readability-identifier-naming]
534// CHECK-FIXES: {{^}}unsigned char myucValueUnsignedChar = 0;
535
536long int ValueLongInt = 0;
537// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueLongInt' [readability-identifier-naming]
538// CHECK-FIXES: {{^}}long int myliValueLongInt = 0;
539
540
541//===----------------------------------------------------------------------===//
542// Specifier, Qualifier, Other keywords
543//===----------------------------------------------------------------------===//
544volatile int VolatileInt = 0;
545// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'VolatileInt' [readability-identifier-naming]
546// CHECK-FIXES: {{^}}volatile int myiVolatileInt = 0;
547
548thread_local int ThreadLocalValueInt = 0;
549// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global variable 'ThreadLocalValueInt' [readability-identifier-naming]
550// CHECK-FIXES: {{^}}thread_local int myiThreadLocalValueInt = 0;
551
552extern int ExternValueInt;
553// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'ExternValueInt' [readability-identifier-naming]
554// CHECK-FIXES: {{^}}extern int myiExternValueInt;
555
556struct CDataBuffer {
557 mutable size_t Size;
558};
559// CHECK-MESSAGES: :[[@LINE-2]]:20: warning: invalid case style for public member 'Size' [readability-identifier-naming]
560// CHECK-FIXES: {{^}} mutable size_t mynSize;
561
562static constexpr int const &ConstExprInt = 42;
563// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: invalid case style for constexpr variable 'ConstExprInt' [readability-identifier-naming]
564// CHECK-FIXES: {{^}}static constexpr int const &myiConstExprInt = 42;
565
566
567//===----------------------------------------------------------------------===//
568// Redefined types
569//===----------------------------------------------------------------------===//
570typedef int INDEX;
571INDEX myiIndex = 0;
572// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'myiIndex' [readability-identifier-naming]
573// CHECK-FIXES: {{^}}INDEX Index = 0;
574
575
576//===----------------------------------------------------------------------===//
577// Class and struct
578//===----------------------------------------------------------------------===//
579class ClassCase { int Func(); };
580// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'ClassCase' [readability-identifier-naming]
581// CHECK-FIXES: {{^}}class CClassCase { int Func(); };
582
583class AbstractClassCase { virtual int Func() = 0; };
584// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for abstract class 'AbstractClassCase' [readability-identifier-naming]
585// CHECK-FIXES: {{^}}class IAbstractClassCase { virtual int Func() = 0; };
586
587class AbstractClassCase1 { virtual int Func1() = 0; int Func2(); };
588// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for abstract class 'AbstractClassCase1' [readability-identifier-naming]
589// CHECK-FIXES: {{^}}class IAbstractClassCase1 { virtual int Func1() = 0; int Func2(); };
590
591class ClassConstantCase { public: static const int myiConstantCase; };
592// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'ClassConstantCase' [readability-identifier-naming]
593// CHECK-FIXES: {{^}}class CClassConstantCase { public: static const int myiConstantCase; };
594
595struct StructCase { int Func(); };
596// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for class 'StructCase' [readability-identifier-naming]
597// CHECK-FIXES: {{^}}struct CStructCase { int Func(); };
598
599//===----------------------------------------------------------------------===//
600// Other Cases
601//===----------------------------------------------------------------------===//
602int lower_case = 0;
603// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'lower_case' [readability-identifier-naming]
604// CHECK-FIXES: {{^}}int myiLowerCase = 0;
605
606int lower_case1 = 0;
607// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'lower_case1' [readability-identifier-naming]
608// CHECK-FIXES: {{^}}int myiLowerCase1 = 0;
609
610int lower_case_2 = 0;
611// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'lower_case_2' [readability-identifier-naming]
612// CHECK-FIXES: {{^}}int myiLowerCase2 = 0;
613
614int UPPER_CASE = 0;
615// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'UPPER_CASE' [readability-identifier-naming]
616// CHECK-FIXES: {{^}}int myiUpperCase = 0;
617
618int UPPER_CASE_1 = 0;
619// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'UPPER_CASE_1' [readability-identifier-naming]
620// CHECK-FIXES: {{^}}int myiUpperCase1 = 0;
621
622int camelBack = 0;
623// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camelBack' [readability-identifier-naming]
624// CHECK-FIXES: {{^}}int myiCamelBack = 0;
625
626int camelBack_1 = 0;
627// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camelBack_1' [readability-identifier-naming]
628// CHECK-FIXES: {{^}}int myiCamelBack1 = 0;
629
630int camelBack2 = 0;
631// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camelBack2' [readability-identifier-naming]
632// CHECK-FIXES: {{^}}int myiCamelBack2 = 0;
633
634int CamelCase = 0;
635// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'CamelCase' [readability-identifier-naming]
636// CHECK-FIXES: {{^}}int myiCamelCase = 0;
637
638int CamelCase_1 = 0;
639// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'CamelCase_1' [readability-identifier-naming]
640// CHECK-FIXES: {{^}}int myiCamelCase1 = 0;
641
642int CamelCase2 = 0;
643// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'CamelCase2' [readability-identifier-naming]
644// CHECK-FIXES: {{^}}int myiCamelCase2 = 0;
645
646int camel_Snake_Back = 0;
647// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camel_Snake_Back' [readability-identifier-naming]
648// CHECK-FIXES: {{^}}int myiCamelSnakeBack = 0;
649
650int camel_Snake_Back_1 = 0;
651// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camel_Snake_Back_1' [readability-identifier-naming]
652// CHECK-FIXES: {{^}}int myiCamelSnakeBack1 = 0;
653
654int Camel_Snake_Case = 0;
655// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'Camel_Snake_Case' [readability-identifier-naming]
656// CHECK-FIXES: {{^}}int myiCamelSnakeCase = 0;
657
658int Camel_Snake_Case_1 = 0;
659// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'Camel_Snake_Case_1' [readability-identifier-naming]
660// CHECK-FIXES: {{^}}int myiCamelSnakeCase1 = 0;
661
662//===----------------------------------------------------------------------===//
663// Enum
664//===----------------------------------------------------------------------===//
665enum REV_TYPE { RevValid };
666// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for enum constant 'RevValid' [readability-identifier-naming]
667// CHECK-FIXES: {{^}}enum REV_TYPE { rtRevValid };
668
669enum EnumConstantCase { OneByte, TwoByte };
670// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: invalid case style for enum constant 'OneByte' [readability-identifier-naming]
671// CHECK-MESSAGES: :[[@LINE-2]]:34: warning: invalid case style for enum constant 'TwoByte' [readability-identifier-naming]
672// CHECK-FIXES: {{^}}enum EnumConstantCase { eccOneByte, eccTwoByte };
673
674enum class ScopedEnumConstantCase { Case1 };
675// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: invalid case style for scoped enum constant 'Case1' [readability-identifier-naming]
676// CHECK-FIXES: {{^}}enum class ScopedEnumConstantCase { seccCase1 };
677// clang-format on
678

source code of clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-cfgfile.cpp