1// RUN: %check_clang_tidy -check-suffix=REMOVE %s modernize-use-auto %t -- \
2// RUN: -config="{CheckOptions: {modernize-use-auto.RemoveStars: 'true', modernize-use-auto.MinTypeNameLength: '0'}}"
3// RUN: %check_clang_tidy %s modernize-use-auto %t -- \
4// RUN: -config="{CheckOptions: {modernize-use-auto.RemoveStars: 'false', modernize-use-auto.MinTypeNameLength: '0'}}"
5
6void pointerToFunction() {
7 void (*(*(f1)))() = static_cast<void (**)()>(nullptr);
8 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing
9 // CHECK-FIXES-REMOVE: auto f1 =
10 // CHECK-FIXES: auto *f1 =
11}
12
13void pointerToArray() {
14 int(*a1)[2] = new int[10][2];
15 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing
16 // CHECK-FIXES-REMOVE: auto a1 =
17 // CHECK-FIXES: auto *a1 =
18}
19
20void memberFunctionPointer() {
21 class A {
22 void f();
23 };
24 void(A::* a1)() = static_cast<void(A::*)()>(nullptr);
25 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing
26 // CHECK-FIXES-REMOVE: auto a1 =
27 // CHECK-FIXES: auto *a1 =
28}
29
30

source code of clang-tools-extra/test/clang-tidy/checkers/modernize/use-auto-for-pointer.cpp