1 // RUN: clang-tidy %s --config-file=%S/Inputs/readability-identifier-naming/hungarian-notation2/.clang-tidy 2>&1 \
2 // RUN:   | FileCheck -check-prefixes=CHECK-MESSAGES %s
3 
4 // clang-format off
5 typedef signed char         int8_t;     // NOLINT
6 typedef short               int16_t;    // NOLINT
7 typedef long                int32_t;    // NOLINT
8 typedef long long           int64_t;    // NOLINT
9 typedef unsigned char       uint8_t;    // NOLINT
10 typedef unsigned short      uint16_t;   // NOLINT
11 typedef unsigned long       uint32_t;   // NOLINT
12 typedef unsigned long long  uint64_t;   // NOLINT
13 #ifndef _WIN32
14 typedef unsigned long long  size_t;     // NOLINT
15 #endif
16 typedef long                intptr_t;   // NOLINT
17 typedef unsigned long       uintptr_t;  // NOLINT
18 typedef long int            ptrdiff_t;  // NOLINT
19 typedef unsigned char       BYTE;       // NOLINT
20 typedef unsigned short      WORD;       // NOLINT
21 typedef unsigned long       DWORD;      // NOLINT
22 typedef int                 BOOL;       // NOLINT
23 typedef int                 BOOLEAN;    // NOLINT
24 typedef float               FLOAT;      // NOLINT
25 typedef int                 INT;        // NOLINT
26 typedef unsigned int        UINT;       // NOLINT
27 typedef unsigned long       ULONG;      // NOLINT
28 typedef short               SHORT;      // NOLINT
29 typedef unsigned short      USHORT;     // NOLINT
30 typedef char                CHAR;       // NOLINT
31 typedef unsigned char       UCHAR;      // NOLINT
32 typedef signed char         INT8;       // NOLINT
33 typedef signed short        INT16;      // NOLINT
34 typedef signed int          INT32;      // NOLINT
35 typedef signed long long    INT64;      // NOLINT
36 typedef unsigned char       UINT8;      // NOLINT
37 typedef unsigned short      UINT16;     // NOLINT
38 typedef unsigned int        UINT32;     // NOLINT
39 typedef unsigned long long  UINT64;     // NOLINT
40 typedef long                LONG;       // NOLINT
41 typedef signed int          LONG32;     // NOLINT
42 typedef unsigned int        ULONG32;    // NOLINT
43 typedef uint64_t            ULONG64;    // NOLINT
44 typedef unsigned int        DWORD32;    // NOLINT
45 typedef uint64_t            DWORD64;    // NOLINT
46 typedef uint64_t            ULONGLONG;  // NOLINT
47 typedef void*               PVOID;      // NOLINT
48 typedef void*               HANDLE;     // NOLINT
49 typedef void*               FILE;       // NOLINT
50 #define NULL                (0)         // NOLINT
51 // clang-format on
52 
53 // clang-format off
54 //===----------------------------------------------------------------------===//
55 // Cases to CheckOptions
56 //===----------------------------------------------------------------------===//
57 class CMyClass1 {
58 public:
59   static int ClassMemberCase;
60   // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for class member 'ClassMemberCase' [readability-identifier-naming]
61   // CHECK-FIXES: {{^}}  static int iClassMemberCase;
62 
63   char const ConstantMemberCase = 0;
64   // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for constant member 'ConstantMemberCase' [readability-identifier-naming]
65   // CHECK-FIXES: {{^}}  char const cConstantMemberCase = 0;
66 
67   void MyFunc1(const int ConstantParameterCase);
68   // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for constant parameter 'ConstantParameterCase' [readability-identifier-naming]
69   // CHECK-FIXES: {{^}}  void MyFunc1(const int iConstantParameterCase);
70 
71   void MyFunc2(const int* ConstantPointerParameterCase);
72   // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: invalid case style for pointer parameter 'ConstantPointerParameterCase' [readability-identifier-naming]
73   // CHECK-FIXES: {{^}}  void MyFunc2(const int* piConstantPointerParameterCase);
74 
75   static constexpr int ConstexprVariableCase = 123;
76   // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for constexpr variable 'ConstexprVariableCase' [readability-identifier-naming]
77   // CHECK-FIXES: {{^}}  static constexpr int iConstexprVariableCase = 123;
78 };
79 
80 const int GlobalConstantCase = 0;
81 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global constant 'GlobalConstantCase' [readability-identifier-naming]
82 // CHECK-FIXES: {{^}}const int iGlobalConstantCase = 0;
83 
84 const int* GlobalConstantPointerCase = nullptr;
85 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global pointer 'GlobalConstantPointerCase' [readability-identifier-naming]
86 // CHECK-FIXES: {{^}}const int* piGlobalConstantPointerCase = nullptr;
87 
88 int* GlobalPointerCase = nullptr;
89 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global pointer 'GlobalPointerCase' [readability-identifier-naming]
90 // CHECK-FIXES: {{^}}int* piGlobalPointerCase = nullptr;
91 
92 int GlobalVariableCase = 0;
93 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'GlobalVariableCase' [readability-identifier-naming]
94 // CHECK-FIXES: {{^}}int iGlobalVariableCase = 0;
95 
Func1()96 void Func1(){
97   int const LocalConstantCase = 3;
98   // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for local constant 'LocalConstantCase' [readability-identifier-naming]
99   // CHECK-FIXES: {{^}}  int const iLocalConstantCase = 3;
100 
101   unsigned const ConstantCase = 1;
102   // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for local constant 'ConstantCase' [readability-identifier-naming]
103   // CHECK-FIXES: {{^}}  unsigned const uConstantCase = 1;
104 
105   int* const LocalConstantPointerCase = nullptr;
106   // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for local constant pointer 'LocalConstantPointerCase' [readability-identifier-naming]
107   // CHECK-FIXES: {{^}}  int* const piLocalConstantPointerCase = nullptr;
108 
109   int *LocalPointerCase = nullptr;
110   // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for local pointer 'LocalPointerCase' [readability-identifier-naming]
111   // CHECK-FIXES: {{^}}  int *piLocalPointerCase = nullptr;
112 
113   int LocalVariableCase = 0;
114   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for local variable 'LocalVariableCase' [readability-identifier-naming]
115   // CHECK-FIXES: {{^}}  int iLocalVariableCase = 0;
116 }
117 
118 class CMyClass2 {
119   char MemberCase;
120   // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for private member 'MemberCase' [readability-identifier-naming]
121   // CHECK-FIXES: {{^}}  char cMemberCase;
122 
123   void Func1(int ParameterCase);
124   // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for parameter 'ParameterCase' [readability-identifier-naming]
125   // CHECK-FIXES: {{^}}  void Func1(int iParameterCase);
126 
127   void Func2(const int ParameterCase);
128   // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for constant parameter 'ParameterCase' [readability-identifier-naming]
129   // CHECK-FIXES: {{^}}  void Func2(const int iParameterCase);
130 
131   void Func3(const int *PointerParameterCase);
132   // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: invalid case style for pointer parameter 'PointerParameterCase' [readability-identifier-naming]
133   // CHECK-FIXES: {{^}}  void Func3(const int *piPointerParameterCase);
134 };
135 
136 class CMyClass3 {
137 private:
138   char PrivateMemberCase;
139   // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for private member 'PrivateMemberCase' [readability-identifier-naming]
140   // CHECK-FIXES: {{^}}  char cPrivateMemberCase;
141 
142 protected:
143   char ProtectedMemberCase;
144   // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for protected member 'ProtectedMemberCase' [readability-identifier-naming]
145   // CHECK-FIXES: {{^}}  char cProtectedMemberCase;
146 
147 public:
148   char PublicMemberCase;
149   // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for public member 'PublicMemberCase' [readability-identifier-naming]
150   // CHECK-FIXES: {{^}}  char cPublicMemberCase;
151 };
152 
153 static const int StaticConstantCase = 3;
154 // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global constant 'StaticConstantCase' [readability-identifier-naming]
155 // CHECK-FIXES: {{^}}static const int iStaticConstantCase = 3;
156 
157 static int StaticVariableCase = 3;
158 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'StaticVariableCase' [readability-identifier-naming]
159 // CHECK-FIXES: {{^}}static int iStaticVariableCase = 3;
160 
161 struct MyStruct { int StructCase; };
162 // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: invalid case style for public member 'StructCase' [readability-identifier-naming]
163 // CHECK-FIXES: {{^}}struct MyStruct { int iStructCase; };
164 
165 union MyUnion { int UnionCase; long lUnionCase; };
166 // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: invalid case style for public member 'UnionCase' [readability-identifier-naming]
167 // CHECK-FIXES: {{^}}union MyUnion { int iUnionCase; long lUnionCase; };
168 
169 //===----------------------------------------------------------------------===//
170 // C string
171 //===----------------------------------------------------------------------===//
172 const char *NamePtr = "Name";
173 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global pointer 'NamePtr' [readability-identifier-naming]
174 // CHECK-FIXES: {{^}}const char *szNamePtr = "Name";
175 
176 const char NameArray[] = "Name";
177 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global constant 'NameArray' [readability-identifier-naming]
178 // CHECK-FIXES: {{^}}const char szNameArray[] = "Name";
179 
180 const char *NamePtrArray[] = {"AA", "BB"};
181 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global variable 'NamePtrArray' [readability-identifier-naming]
182 // CHECK-FIXES: {{^}}const char *pszNamePtrArray[] = {"AA", "BB"};
183 
184 const wchar_t *WideNamePtr = L"Name";
185 // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global pointer 'WideNamePtr' [readability-identifier-naming]
186 // CHECK-FIXES: {{^}}const wchar_t *wszWideNamePtr = L"Name";
187 
188 const wchar_t WideNameArray[] = L"Name";
189 // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global constant 'WideNameArray' [readability-identifier-naming]
190 // CHECK-FIXES: {{^}}const wchar_t wszWideNameArray[] = L"Name";
191 
192 const wchar_t *WideNamePtrArray[] = {L"AA", L"BB"};
193 // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global variable 'WideNamePtrArray' [readability-identifier-naming]
194 // CHECK-FIXES: {{^}}const wchar_t *pwszWideNamePtrArray[] = {L"AA", L"BB"};
195 
196 class CMyClass4 {
197 private:
198   char *Name = "Text";
199   // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for private member 'Name' [readability-identifier-naming]
200   // CHECK-FIXES: {{^}}  char *szName = "Text";
201 
202   const char *ConstName = "Text";
203   // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for private member 'ConstName' [readability-identifier-naming]
204   // CHECK-FIXES: {{^}}  const char *szConstName = "Text";
205 
206 public:
207   const char* DuplicateString(const char* Input, size_t nRequiredSize);
208   // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: invalid case style for pointer parameter 'Input' [readability-identifier-naming]
209   // CHECK-FIXES: {{^}}  const char* DuplicateString(const char* szInput, size_t nRequiredSize);
210 
211   size_t UpdateText(const char* Buffer, size_t nBufferSize);
212   // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: invalid case style for pointer parameter 'Buffer' [readability-identifier-naming]
213   // CHECK-FIXES: {{^}}  size_t UpdateText(const char* szBuffer, size_t nBufferSize);
214 };
215 
216 
217 //===----------------------------------------------------------------------===//
218 // Microsoft Windows data types
219 //===----------------------------------------------------------------------===//
220 DWORD MsDword = 0;
221 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsDword' [readability-identifier-naming]
222 // CHECK-FIXES: {{^}}DWORD dwMsDword = 0;
223 
224 BYTE MsByte = 0;
225 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsByte' [readability-identifier-naming]
226 // CHECK-FIXES: {{^}}BYTE byMsByte = 0;
227 
228 WORD MsWord = 0;
229 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsWord' [readability-identifier-naming]
230 // CHECK-FIXES: {{^}}WORD wMsWord = 0;
231 
232 BOOL MsBool = 0;
233 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsBool' [readability-identifier-naming]
234 // CHECK-FIXES: {{^}}BOOL bMsBool = 0;
235 
236 BOOLEAN MsBoolean = 0;
237 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsBoolean' [readability-identifier-naming]
238 // CHECK-FIXES: {{^}}BOOLEAN bMsBoolean = 0;
239 
240 CHAR MsValueChar = 0;
241 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueChar' [readability-identifier-naming]
242 // CHECK-FIXES: {{^}}CHAR cMsValueChar = 0;
243 
244 UCHAR MsValueUchar = 0;
245 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueUchar' [readability-identifier-naming]
246 // CHECK-FIXES: {{^}}UCHAR ucMsValueUchar = 0;
247 
248 SHORT MsValueShort = 0;
249 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueShort' [readability-identifier-naming]
250 // CHECK-FIXES: {{^}}SHORT sMsValueShort = 0;
251 
252 USHORT MsValueUshort = 0;
253 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUshort' [readability-identifier-naming]
254 // CHECK-FIXES: {{^}}USHORT usMsValueUshort = 0;
255 
256 WORD MsValueWord = 0;
257 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueWord' [readability-identifier-naming]
258 // CHECK-FIXES: {{^}}WORD wMsValueWord = 0;
259 
260 DWORD MsValueDword = 0;
261 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueDword' [readability-identifier-naming]
262 // CHECK-FIXES: {{^}}DWORD dwMsValueDword = 0;
263 
264 DWORD32 MsValueDword32 = 0;
265 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueDword32' [readability-identifier-naming]
266 // CHECK-FIXES: {{^}}DWORD32 dw32MsValueDword32 = 0;
267 
268 DWORD64 MsValueDword64 = 0;
269 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueDword64' [readability-identifier-naming]
270 // CHECK-FIXES: {{^}}DWORD64 dw64MsValueDword64 = 0;
271 
272 LONG MsValueLong = 0;
273 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueLong' [readability-identifier-naming]
274 // CHECK-FIXES: {{^}}LONG lMsValueLong = 0;
275 
276 ULONG MsValueUlong = 0;
277 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueUlong' [readability-identifier-naming]
278 // CHECK-FIXES: {{^}}ULONG ulMsValueUlong = 0;
279 
280 ULONG32 MsValueUlong32 = 0;
281 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueUlong32' [readability-identifier-naming]
282 // CHECK-FIXES: {{^}}ULONG32 ul32MsValueUlong32 = 0;
283 
284 ULONG64 MsValueUlong64 = 0;
285 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueUlong64' [readability-identifier-naming]
286 // CHECK-FIXES: {{^}}ULONG64 ul64MsValueUlong64 = 0;
287 
288 ULONGLONG MsValueUlongLong = 0;
289 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global variable 'MsValueUlongLong' [readability-identifier-naming]
290 // CHECK-FIXES: {{^}}ULONGLONG ullMsValueUlongLong = 0;
291 
292 HANDLE MsValueHandle = 0;
293 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global pointer 'MsValueHandle' [readability-identifier-naming]
294 // CHECK-FIXES: {{^}}HANDLE hMsValueHandle = 0;
295 
296 INT MsValueInt = 0;
297 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'MsValueInt' [readability-identifier-naming]
298 // CHECK-FIXES: {{^}}INT iMsValueInt = 0;
299 
300 INT8 MsValueInt8 = 0;
301 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueInt8' [readability-identifier-naming]
302 // CHECK-FIXES: {{^}}INT8 i8MsValueInt8 = 0;
303 
304 INT16 MsValueInt16 = 0;
305 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueInt16' [readability-identifier-naming]
306 // CHECK-FIXES: {{^}}INT16 i16MsValueInt16 = 0;
307 
308 INT32 MsValueInt32 = 0;
309 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueInt32' [readability-identifier-naming]
310 // CHECK-FIXES: {{^}}INT32 i32MsValueInt32 = 0;
311 
312 INT64 MsValueINt64 = 0;
313 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueINt64' [readability-identifier-naming]
314 // CHECK-FIXES: {{^}}INT64 i64MsValueINt64 = 0;
315 
316 UINT MsValueUint = 0;
317 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueUint' [readability-identifier-naming]
318 // CHECK-FIXES: {{^}}UINT uiMsValueUint = 0;
319 
320 UINT8 MsValueUint8 = 0;
321 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueUint8' [readability-identifier-naming]
322 // CHECK-FIXES: {{^}}UINT8 u8MsValueUint8 = 0;
323 
324 UINT16 MsValueUint16 = 0;
325 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUint16' [readability-identifier-naming]
326 // CHECK-FIXES: {{^}}UINT16 u16MsValueUint16 = 0;
327 
328 UINT32 MsValueUint32 = 0;
329 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUint32' [readability-identifier-naming]
330 // CHECK-FIXES: {{^}}UINT32 u32MsValueUint32 = 0;
331 
332 UINT64 MsValueUint64 = 0;
333 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUint64' [readability-identifier-naming]
334 // CHECK-FIXES: {{^}}UINT64 u64MsValueUint64 = 0;
335 
336 PVOID MsValuePvoid = NULL;
337 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global pointer 'MsValuePvoid' [readability-identifier-naming]
338 // CHECK-FIXES: {{^}}PVOID pMsValuePvoid = NULL;
339 
340 
341 //===----------------------------------------------------------------------===//
342 // Array
343 //===----------------------------------------------------------------------===//
344 unsigned GlobalUnsignedArray[] = {1, 2, 3};
345 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'GlobalUnsignedArray' [readability-identifier-naming]
346 // CHECK-FIXES: {{^}}unsigned aGlobalUnsignedArray[] = {1, 2, 3};
347 
348 int GlobalIntArray[] = {1, 2, 3};
349 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'GlobalIntArray' [readability-identifier-naming]
350 // CHECK-FIXES: {{^}}int aGlobalIntArray[] = {1, 2, 3};
351 
352 int DataInt[1] = {0};
353 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'DataInt' [readability-identifier-naming]
354 // CHECK-FIXES: {{^}}int aDataInt[1] = {0};
355 
356 int DataArray[2] = {0};
357 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'DataArray' [readability-identifier-naming]
358 // CHECK-FIXES: {{^}}int aDataArray[2] = {0};
359 
360 
361 //===----------------------------------------------------------------------===//
362 // Pointer
363 //===----------------------------------------------------------------------===//
364 int *DataIntPtr[1] = {0};
365 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'DataIntPtr' [readability-identifier-naming]
366 // CHECK-FIXES: {{^}}int *paDataIntPtr[1] = {0};
367 
368 void *BufferPtr1;
369 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global pointer 'BufferPtr1' [readability-identifier-naming]
370 // CHECK-FIXES: {{^}}void *pBufferPtr1;
371 
372 void **BufferPtr2;
373 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global pointer 'BufferPtr2' [readability-identifier-naming]
374 // CHECK-FIXES: {{^}}void **ppBufferPtr2;
375 
376 void **pBufferPtr3;
377 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global pointer 'pBufferPtr3' [readability-identifier-naming]
378 // CHECK-FIXES: {{^}}void **ppBufferPtr3;
379 
380 int *pBufferPtr4;
381 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global pointer 'pBufferPtr4' [readability-identifier-naming]
382 // CHECK-FIXES: {{^}}int *piBufferPtr4;
383 
384 typedef void (*FUNC_PTR_HELLO)();
385 FUNC_PTR_HELLO Hello = NULL;
386 // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global pointer 'Hello' [readability-identifier-naming]
387 // CHECK-FIXES: {{^}}FUNC_PTR_HELLO fnHello = NULL;
388 
389 void *ValueVoidPtr = NULL;
390 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global pointer 'ValueVoidPtr' [readability-identifier-naming]
391 // CHECK-FIXES: {{^}}void *pValueVoidPtr = NULL;
392 
393 ptrdiff_t PtrDiff = NULL;
394 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global variable 'PtrDiff' [readability-identifier-naming]
395 // CHECK-FIXES: {{^}}ptrdiff_t pPtrDiff = NULL;
396 
397 int8_t *ValueI8Ptr;
398 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global pointer 'ValueI8Ptr' [readability-identifier-naming]
399 // CHECK-FIXES: {{^}}int8_t *pi8ValueI8Ptr;
400 
401 uint8_t *ValueU8Ptr;
402 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global pointer 'ValueU8Ptr' [readability-identifier-naming]
403 // CHECK-FIXES: {{^}}uint8_t *pu8ValueU8Ptr;
404 
MyFunc2(void * Val)405 void MyFunc2(void* Val){}
406 // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for pointer parameter 'Val' [readability-identifier-naming]
407 // CHECK-FIXES: {{^}}void MyFunc2(void* pVal){}
408 
409 
410 //===----------------------------------------------------------------------===//
411 // Reference
412 //===----------------------------------------------------------------------===//
413 int iValueIndex = 1;
414 int &RefValueIndex = iValueIndex;
415 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'RefValueIndex' [readability-identifier-naming]
416 // CHECK-FIXES: {{^}}int &iRefValueIndex = iValueIndex;
417 
418 const int &ConstRefValue = iValueIndex;
419 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'ConstRefValue' [readability-identifier-naming]
420 // CHECK-FIXES: {{^}}const int &iConstRefValue = iValueIndex;
421 
422 long long llValueLongLong = 2;
423 long long &RefValueLongLong = llValueLongLong;
424 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'RefValueLongLong' [readability-identifier-naming]
425 // CHECK-FIXES: {{^}}long long &llRefValueLongLong = llValueLongLong;
426 
427 
428 //===----------------------------------------------------------------------===//
429 // Various types
430 //===----------------------------------------------------------------------===//
431 int8_t ValueI8;
432 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueI8' [readability-identifier-naming]
433 // CHECK-FIXES: {{^}}int8_t i8ValueI8;
434 
435 int16_t ValueI16 = 0;
436 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'ValueI16' [readability-identifier-naming]
437 // CHECK-FIXES: {{^}}int16_t i16ValueI16 = 0;
438 
439 int32_t ValueI32 = 0;
440 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'ValueI32' [readability-identifier-naming]
441 // CHECK-FIXES: {{^}}int32_t i32ValueI32 = 0;
442 
443 int64_t ValueI64 = 0;
444 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'ValueI64' [readability-identifier-naming]
445 // CHECK-FIXES: {{^}}int64_t i64ValueI64 = 0;
446 
447 uint8_t ValueU8 = 0;
448 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'ValueU8' [readability-identifier-naming]
449 // CHECK-FIXES: {{^}}uint8_t u8ValueU8 = 0;
450 
451 uint16_t ValueU16 = 0;
452 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueU16' [readability-identifier-naming]
453 // CHECK-FIXES: {{^}}uint16_t u16ValueU16 = 0;
454 
455 uint32_t ValueU32 = 0;
456 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueU32' [readability-identifier-naming]
457 // CHECK-FIXES: {{^}}uint32_t u32ValueU32 = 0;
458 
459 uint64_t ValueU64 = 0;
460 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueU64' [readability-identifier-naming]
461 // CHECK-FIXES: {{^}}uint64_t u64ValueU64 = 0;
462 
463 float ValueFloat = 0;
464 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'ValueFloat' [readability-identifier-naming]
465 // CHECK-FIXES: {{^}}float fValueFloat = 0;
466 
467 double ValueDouble = 0;
468 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueDouble' [readability-identifier-naming]
469 // CHECK-FIXES: {{^}}double dValueDouble = 0;
470 
471 char ValueChar = 'c';
472 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'ValueChar' [readability-identifier-naming]
473 // CHECK-FIXES: {{^}}char cValueChar = 'c';
474 
475 bool ValueBool = true;
476 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'ValueBool' [readability-identifier-naming]
477 // CHECK-FIXES: {{^}}bool bValueBool = true;
478 
479 int ValueInt = 0;
480 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'ValueInt' [readability-identifier-naming]
481 // CHECK-FIXES: {{^}}int iValueInt = 0;
482 
483 size_t ValueSize = 0;
484 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueSize' [readability-identifier-naming]
485 // CHECK-FIXES: {{^}}size_t nValueSize = 0;
486 
487 wchar_t ValueWchar = 'w';
488 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'ValueWchar' [readability-identifier-naming]
489 // CHECK-FIXES: {{^}}wchar_t wcValueWchar = 'w';
490 
491 short ValueShort = 0;
492 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'ValueShort' [readability-identifier-naming]
493 // CHECK-FIXES: {{^}}short sValueShort = 0;
494 
495 unsigned ValueUnsigned = 0;
496 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueUnsigned' [readability-identifier-naming]
497 // CHECK-FIXES: {{^}}unsigned uValueUnsigned = 0;
498 
499 signed ValueSigned = 0;
500 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueSigned' [readability-identifier-naming]
501 // CHECK-FIXES: {{^}}signed sValueSigned = 0;
502 
503 long ValueLong = 0;
504 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'ValueLong' [readability-identifier-naming]
505 // CHECK-FIXES: {{^}}long lValueLong = 0;
506 
507 long long ValueLongLong = 0;
508 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global variable 'ValueLongLong' [readability-identifier-naming]
509 // CHECK-FIXES: {{^}}long long llValueLongLong = 0;
510 
511 long long int ValueLongLongInt = 0;
512 // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global variable 'ValueLongLongInt' [readability-identifier-naming]
513 // CHECK-FIXES: {{^}}long long int lliValueLongLongInt = 0;
514 
515 long double ValueLongDouble = 0;
516 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global variable 'ValueLongDouble' [readability-identifier-naming]
517 // CHECK-FIXES: {{^}}long double ldValueLongDouble = 0;
518 
519 signed int ValueSignedInt = 0;
520 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'ValueSignedInt' [readability-identifier-naming]
521 // CHECK-FIXES: {{^}}signed int siValueSignedInt = 0;
522 
523 signed short ValueSignedShort = 0;
524 // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'ValueSignedShort' [readability-identifier-naming]
525 // CHECK-FIXES: {{^}}signed short ssValueSignedShort = 0;
526 
527 signed short int ValueSignedShortInt = 0;
528 // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global variable 'ValueSignedShortInt' [readability-identifier-naming]
529 // CHECK-FIXES: {{^}}signed short int ssiValueSignedShortInt = 0;
530 
531 signed long long ValueSignedLongLong = 0;
532 // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global variable 'ValueSignedLongLong' [readability-identifier-naming]
533 // CHECK-FIXES: {{^}}signed long long sllValueSignedLongLong = 0;
534 
535 signed long int ValueSignedLongInt = 0;
536 // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for global variable 'ValueSignedLongInt' [readability-identifier-naming]
537 // CHECK-FIXES: {{^}}signed long int sliValueSignedLongInt = 0;
538 
539 signed long ValueSignedLong = 0;
540 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global variable 'ValueSignedLong' [readability-identifier-naming]
541 // CHECK-FIXES: {{^}}signed long slValueSignedLong = 0;
542 
543 unsigned long long int ValueUnsignedLongLongInt = 0;
544 // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for global variable 'ValueUnsignedLongLongInt' [readability-identifier-naming]
545 // CHECK-FIXES: {{^}}unsigned long long int ulliValueUnsignedLongLongInt = 0;
546 
547 unsigned long long ValueUnsignedLongLong = 0;
548 // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for global variable 'ValueUnsignedLongLong' [readability-identifier-naming]
549 // CHECK-FIXES: {{^}}unsigned long long ullValueUnsignedLongLong = 0;
550 
551 unsigned long int ValueUnsignedLongInt = 0;
552 // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: invalid case style for global variable 'ValueUnsignedLongInt' [readability-identifier-naming]
553 // CHECK-FIXES: {{^}}unsigned long int uliValueUnsignedLongInt = 0;
554 
555 unsigned long ValueUnsignedLong = 0;
556 // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global variable 'ValueUnsignedLong' [readability-identifier-naming]
557 // CHECK-FIXES: {{^}}unsigned long ulValueUnsignedLong = 0;
558 
559 unsigned short int ValueUnsignedShortInt = 0;
560 // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for global variable 'ValueUnsignedShortInt' [readability-identifier-naming]
561 // CHECK-FIXES: {{^}}unsigned short int usiValueUnsignedShortInt = 0;
562 
563 unsigned short ValueUnsignedShort = 0;
564 // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global variable 'ValueUnsignedShort' [readability-identifier-naming]
565 // CHECK-FIXES: {{^}}unsigned short usValueUnsignedShort = 0;
566 
567 unsigned int ValueUnsignedInt = 0;
568 // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'ValueUnsignedInt' [readability-identifier-naming]
569 // CHECK-FIXES: {{^}}unsigned int uiValueUnsignedInt = 0;
570 
571 long int ValueLongInt = 0;
572 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueLongInt' [readability-identifier-naming]
573 // CHECK-FIXES: {{^}}long int liValueLongInt = 0;
574 
575 
576 //===----------------------------------------------------------------------===//
577 // Specifier, Qualifier, Other keywords
578 //===----------------------------------------------------------------------===//
579 volatile int VolatileInt = 0;
580 // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'VolatileInt' [readability-identifier-naming]
581 // CHECK-FIXES: {{^}}volatile int iVolatileInt = 0;
582 
583 thread_local int ThreadLocalValueInt = 0;
584 // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global variable 'ThreadLocalValueInt' [readability-identifier-naming]
585 // CHECK-FIXES: {{^}}thread_local int iThreadLocalValueInt = 0;
586 
587 extern int ExternValueInt;
588 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'ExternValueInt' [readability-identifier-naming]
589 // CHECK-FIXES: {{^}}extern int iExternValueInt;
590 
591 struct DataBuffer {
592     mutable size_t Size;
593 };
594 // CHECK-MESSAGES: :[[@LINE-2]]:20: warning: invalid case style for public member 'Size' [readability-identifier-naming]
595 // CHECK-FIXES: {{^}}    mutable size_t nSize;
596 
597 static constexpr int const &ConstExprInt = 42;
598 // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: invalid case style for constexpr variable 'ConstExprInt' [readability-identifier-naming]
599 // CHECK-FIXES: {{^}}static constexpr int const &iConstExprInt = 42;
600 
601 
602 //===----------------------------------------------------------------------===//
603 // Redefined types
604 //===----------------------------------------------------------------------===//
605 typedef int INDEX;
606 INDEX iIndex = 0;
607 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'iIndex' [readability-identifier-naming]
608 // CHECK-FIXES: {{^}}INDEX Index = 0;
609 
610 
611 //===----------------------------------------------------------------------===//
612 // Class
613 //===----------------------------------------------------------------------===//
614 class ClassCase { int Func(); };
615 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'ClassCase' [readability-identifier-naming]
616 // CHECK-FIXES: {{^}}class CClassCase { int Func(); };
617 
618 class AbstractClassCase { virtual int Func() = 0; };
619 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for abstract class 'AbstractClassCase' [readability-identifier-naming]
620 // CHECK-FIXES: {{^}}class IAbstractClassCase { virtual int Func() = 0; };
621 
622 class AbstractClassCase1 { virtual int Func1() = 0; int Func2(); };
623 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for abstract class 'AbstractClassCase1' [readability-identifier-naming]
624 // CHECK-FIXES: {{^}}class IAbstractClassCase1 { virtual int Func1() = 0; int Func2(); };
625 
626 class ClassConstantCase { public: static const int iConstantCase; };
627 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'ClassConstantCase' [readability-identifier-naming]
628 // CHECK-FIXES: {{^}}class CClassConstantCase { public: static const int iConstantCase; };
629 
630 //===----------------------------------------------------------------------===//
631 // Other Cases
632 //===----------------------------------------------------------------------===//
633 int lower_case = 0;
634 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'lower_case' [readability-identifier-naming]
635 // CHECK-FIXES: {{^}}int iLowerCase = 0;
636 
637 int lower_case1 = 0;
638 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'lower_case1' [readability-identifier-naming]
639 // CHECK-FIXES: {{^}}int iLowerCase1 = 0;
640 
641 int lower_case_2 = 0;
642 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'lower_case_2' [readability-identifier-naming]
643 // CHECK-FIXES: {{^}}int iLowerCase2 = 0;
644 
645 int UPPER_CASE = 0;
646 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'UPPER_CASE' [readability-identifier-naming]
647 // CHECK-FIXES: {{^}}int iUpperCase = 0;
648 
649 int UPPER_CASE_1 = 0;
650 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'UPPER_CASE_1' [readability-identifier-naming]
651 // CHECK-FIXES: {{^}}int iUpperCase1 = 0;
652 
653 int camelBack = 0;
654 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camelBack' [readability-identifier-naming]
655 // CHECK-FIXES: {{^}}int iCamelBack = 0;
656 
657 int camelBack_1 = 0;
658 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camelBack_1' [readability-identifier-naming]
659 // CHECK-FIXES: {{^}}int iCamelBack1 = 0;
660 
661 int camelBack2 = 0;
662 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camelBack2' [readability-identifier-naming]
663 // CHECK-FIXES: {{^}}int iCamelBack2 = 0;
664 
665 int CamelCase = 0;
666 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'CamelCase' [readability-identifier-naming]
667 // CHECK-FIXES: {{^}}int iCamelCase = 0;
668 
669 int CamelCase_1 = 0;
670 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'CamelCase_1' [readability-identifier-naming]
671 // CHECK-FIXES: {{^}}int iCamelCase1 = 0;
672 
673 int CamelCase2 = 0;
674 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'CamelCase2' [readability-identifier-naming]
675 // CHECK-FIXES: {{^}}int iCamelCase2 = 0;
676 
677 int camel_Snake_Back = 0;
678 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camel_Snake_Back' [readability-identifier-naming]
679 // CHECK-FIXES: {{^}}int iCamelSnakeBack = 0;
680 
681 int camel_Snake_Back_1 = 0;
682 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camel_Snake_Back_1' [readability-identifier-naming]
683 // CHECK-FIXES: {{^}}int iCamelSnakeBack1 = 0;
684 
685 int Camel_Snake_Case = 0;
686 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'Camel_Snake_Case' [readability-identifier-naming]
687 // CHECK-FIXES: {{^}}int iCamelSnakeCase = 0;
688 
689 int Camel_Snake_Case_1 = 0;
690 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'Camel_Snake_Case_1' [readability-identifier-naming]
691 // CHECK-FIXES: {{^}}int iCamelSnakeCase1 = 0;
692 
693 //===----------------------------------------------------------------------===//
694 // Enum
695 //===----------------------------------------------------------------------===//
696 enum REV_TYPE { RevValid };
697 // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for enum constant 'RevValid' [readability-identifier-naming]
698 // CHECK-FIXES: {{^}}enum REV_TYPE { rtRevValid };
699 
700 enum EnumConstantCase { OneByte, TwoByte };
701 // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: invalid case style for enum constant 'OneByte' [readability-identifier-naming]
702 // CHECK-MESSAGES: :[[@LINE-2]]:34: warning: invalid case style for enum constant 'TwoByte' [readability-identifier-naming]
703 // CHECK-FIXES: {{^}}enum EnumConstantCase { eccOneByte, eccTwoByte };
704 
705 enum class ScopedEnumConstantCase { Case1 };
706 // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: invalid case style for scoped enum constant 'Case1' [readability-identifier-naming]
707 // CHECK-FIXES: {{^}}enum class ScopedEnumConstantCase { seccCase1 };
708 // clang-format on
709