Lines Matching full:auto
1 // RUN: %check_clang_tidy %s modernize-use-auto %t -- \
2 // RUN: -config="{CheckOptions: {modernize-use-auto.MinTypeNameLength: '0'}}" \
3 // RUN: -- -I %S/Inputs/use-auto -frtti
16 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_static_cast()
17 // CHECK-FIXES: auto i1 = static_cast<int>(l); in f_static_cast()
20 …// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a cast to avoid duplic… in f_static_cast()
21 // CHECK-FIXES: const auto i2 = static_cast<int>(l); in f_static_cast()
24 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_static_cast()
25 // CHECK-FIXES: auto ll = static_cast<long long>(l); in f_static_cast()
27 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_static_cast()
28 // CHECK-FIXES: auto ull = static_cast<unsigned long long>(l); in f_static_cast()
30 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_static_cast()
31 // CHECK-FIXES: auto ui = static_cast<unsigned int>(l); in f_static_cast()
33 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_static_cast()
34 // CHECK-FIXES: auto ld = static_cast<long double>(l); in f_static_cast()
38 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_static_cast()
39 // CHECK-FIXES: auto *b1 = static_cast<B *>(a); in f_static_cast()
42 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_static_cast()
43 // CHECK-FIXES: auto *const b2 = static_cast<B *>(a); in f_static_cast()
46 …// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a cast to avoid duplic… in f_static_cast()
47 // CHECK-FIXES: const auto *b3 = static_cast<const B *>(a); in f_static_cast()
50 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_static_cast()
51 // CHECK-FIXES: auto &b4 = static_cast<B &>(*a); in f_static_cast()
54 …// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a cast to avoid duplic… in f_static_cast()
55 // CHECK-FIXES: const auto &b5 = static_cast<const B &>(*a); in f_static_cast()
58 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_static_cast()
59 // CHECK-FIXES: auto &b6 = static_cast<B &>(*a), &b7 = static_cast<B &>(*a); in f_static_cast()
64 // Don't warn when auto is already being used. in f_static_cast()
65 auto i3 = static_cast<int>(l); in f_static_cast()
66 auto *b8 = static_cast<B *>(a); in f_static_cast()
67 auto &b9 = static_cast<B &>(*a); in f_static_cast()
73 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_dynamic_cast()
74 // CHECK-FIXES: auto *b1 = dynamic_cast<B *>(a); in f_dynamic_cast()
77 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_dynamic_cast()
78 // CHECK-FIXES: auto &b2 = dynamic_cast<B &>(*a); in f_dynamic_cast()
82 auto *a = new A(); in f_reinterpret_cast()
84 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_reinterpret_cast()
85 // CHECK-FIXES: auto *c1 = reinterpret_cast<C *>(a); in f_reinterpret_cast()
88 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_reinterpret_cast()
89 // CHECK-FIXES: auto &c2 = reinterpret_cast<C &>(*a); in f_reinterpret_cast()
95 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_const_cast()
96 // CHECK-FIXES: auto *a2 = const_cast<A *>(a1); in f_const_cast()
98 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_const_cast()
99 // CHECK-FIXES: auto &a3 = const_cast<A &>(*a1); in f_const_cast()
114 auto *a = new A(); in f_cstyle_cast()
116 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_cstyle_cast()
117 // CHECK-FIXES: auto *c1 = (C *)a; in f_cstyle_cast()
120 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_cstyle_cast()
121 // CHECK-FIXES: auto &c2 = (C &)*a; in f_cstyle_cast()
124 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_cstyle_cast()
125 // CHECK-FIXES: auto *s = BAD_CAST "xml"; in f_cstyle_cast()
127 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_cstyle_cast()
128 // CHECK-FIXES: auto *t = XMLCHAR_CAST("xml"); in f_cstyle_cast()
130 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_cstyle_cast()
136 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplic… in f_functional_cast()
137 // CHECK-FIXES: auto i1 = int(l); in f_functional_cast()
181 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a template cast to avo… in f_template_cast()
182 // CHECK-FIXES: auto i1 = template_value_cast<int>(d); in f_template_cast()
186 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a template cast to avo… in f_template_cast()
187 // CHECK-FIXES: auto *b1 = template_value_cast<B *>(a); in f_template_cast()
189 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a template cast to avo… in f_template_cast()
190 // CHECK-FIXES: auto &b2 = template_value_cast<B &>(*a); in f_template_cast()
192 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a template cast to avo… in f_template_cast()
193 // CHECK-FIXES: auto *b3 = template_pointer_cast<B>(a); in f_template_cast()
195 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a template cast to avo… in f_template_cast()
196 // CHECK-FIXES: auto &b4 = template_reference_cast<B>(*a); in f_template_cast()
198 …// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a template cast to avo… in f_template_cast()
199 // CHECK-FIXES: const auto *b5 = template_const_pointer_cast<B>(a); in f_template_cast()
201 …// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a template cast to avo… in f_template_cast()
202 // CHECK-FIXES: const auto &b6 = template_const_reference_cast<B>(*a); in f_template_cast()
204 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a template cast to avo… in f_template_cast()
205 // CHECK-FIXES: auto *b7 = template_value_get<B *>("foo"); in f_template_cast()
207 …// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a template cast to avo… in f_template_cast()
208 // CHECK-FIXES: auto *b8 = template_value_get<B *>("foo"), *b9 = template_value_get<B *>("bar"); in f_template_cast()
212 …// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a template cast to avo… in f_template_cast()
213 // CHECK-FIXES: const auto *b10 = s.template_member_get<B>(); in f_template_cast()
215 // Don't warn when auto is already being used. in f_template_cast()
216 auto i2 = template_value_cast<int>(d); in f_template_cast()
217 auto *i3 = template_value_cast<int *>(d); in f_template_cast()
218 auto **i4 = template_value_cast<int **>(d); in f_template_cast()
219 auto &i5 = template_reference_cast<int>(d); in f_template_cast()
231 for (auto &c : template_reference_cast<StringRef>(*a)) { in f_template_cast()