1 // Purpose:
2 // Ensure that the 'cppcoreguidelines-pro-type-vararg' check works with the
3 // built-in va_list on Windows systems.
4 
5 // RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-vararg %t -- --extra-arg=--target=x86_64-windows
6 
test_ms_va_list(int a,...)7 void test_ms_va_list(int a, ...) {
8   __builtin_ms_va_list ap;
9   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare variables of type va_list; use variadic templates instead
10   __builtin_ms_va_start(ap, a);
11   int b = __builtin_va_arg(ap, int);
12   // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: do not use va_arg to define c-style vararg functions; use variadic templates instead
13   __builtin_ms_va_end(ap);
14 }
15 
test_typedefs(int a,...)16 void test_typedefs(int a, ...) {
17   typedef __builtin_ms_va_list my_va_list1;
18   my_va_list1 ap1;
19   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare variables of type va_list; use variadic templates instead
20 
21   using my_va_list2 = __builtin_ms_va_list;
22   my_va_list2 ap2;
23   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare variables of type va_list; use variadic templates instead
24 }
25