1// RUN: %check_clang_tidy %s readability-ambiguous-smartptr-reset-call %t --fix-notes -- -I %S/../modernize/Inputs/smart-ptr
2
3#include "unique_ptr.h"
4#include "shared_ptr.h"
5
6template <typename T>
7struct non_default_reset_ptr {
8 T& operator*() const;
9 T* operator->() const;
10 void reset(T* p);
11};
12
13struct Resettable {
14 void reset();
15 void doSomething();
16};
17
18struct ResettableWithParam {
19 void reset(int a);
20 void doSomething();
21};
22
23struct ResettableWithDefaultParams {
24 void reset(int a = 0, double b = 0.0);
25 void doSomething();
26};
27
28struct NonResettable {
29 void doSomething();
30};
31
32void Positive() {
33 std::unique_ptr<Resettable> u;
34 u.reset();
35 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
36 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
37 // CHECK-FIXES: u = nullptr;
38 u->reset();
39 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
40 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
41 // CHECK-FIXES: (*u).reset();
42
43 std::shared_ptr<Resettable> s;
44 s.reset();
45 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
46 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
47 // CHECK-FIXES: s = nullptr;
48 s->reset();
49 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
50 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
51 // CHECK-FIXES: (*s).reset();
52
53 std::unique_ptr<std::unique_ptr<int>> uu_ptr;
54 uu_ptr.reset();
55 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
56 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
57 // CHECK-FIXES: uu_ptr = nullptr;
58 uu_ptr->reset();
59 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
60 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
61 // CHECK-FIXES: (*uu_ptr).reset();
62
63 std::unique_ptr<std::shared_ptr<int>> su_ptr;
64 su_ptr.reset();
65 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
66 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
67 // CHECK-FIXES: su_ptr = nullptr;
68 su_ptr->reset();
69 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
70 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
71 // CHECK-FIXES: (*su_ptr).reset();
72
73 std::unique_ptr<ResettableWithDefaultParams> rd;
74 rd.reset();
75 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
76 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
77 // CHECK-FIXES: rd = nullptr;
78 rd->reset();
79 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
80 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
81 // CHECK-FIXES: (*rd).reset();
82
83 std::unique_ptr<std::shared_ptr<std::unique_ptr<Resettable>>> nested_ptr;
84 nested_ptr.reset();
85 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
86 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
87 // CHECK-FIXES: nested_ptr = nullptr;
88 nested_ptr->reset();
89 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
90 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
91 // CHECK-FIXES: (*nested_ptr).reset();
92 (*nested_ptr).reset();
93 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
94 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
95 // CHECK-FIXES: (*nested_ptr) = nullptr;
96 (*nested_ptr)->reset();
97 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
98 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
99 // CHECK-FIXES: (*(*nested_ptr)).reset();
100 (**nested_ptr).reset();
101 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
102 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
103 // CHECK-FIXES: (**nested_ptr) = nullptr;
104 (**nested_ptr)->reset();
105 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
106 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
107 // CHECK-FIXES: (*(**nested_ptr)).reset();
108}
109
110void Negative() {
111 std::unique_ptr<Resettable> u_ptr;
112 u_ptr.reset(nullptr);
113 u_ptr->doSomething();
114
115 std::shared_ptr<Resettable> s_ptr;
116 s_ptr.reset(nullptr);
117 s_ptr->doSomething();
118
119 Resettable* raw_ptr;
120 raw_ptr->reset();
121 raw_ptr->doSomething();
122
123 Resettable resettable;
124 resettable.reset();
125 resettable.doSomething();
126
127 std::unique_ptr<ResettableWithParam> u_ptr_param;
128 u_ptr_param.reset();
129 u_ptr_param.reset(nullptr);
130 u_ptr_param->reset(0);
131
132 std::unique_ptr<NonResettable> u_ptr_no_reset;
133 u_ptr_no_reset.reset();
134
135 std::shared_ptr<ResettableWithParam> s_ptr_param;
136 s_ptr_param.reset();
137 s_ptr_param->reset(0);
138 s_ptr_param->doSomething();
139
140 std::shared_ptr<NonResettable> s_ptr_no_reset;
141 s_ptr_no_reset.reset();
142
143 std::unique_ptr<ResettableWithDefaultParams> u_ptr_default_params;
144 u_ptr_default_params.reset(nullptr);
145 u_ptr_default_params->reset(1);
146 u_ptr_default_params->reset(1, 2.0);
147
148 non_default_reset_ptr<Resettable> non_default_reset_ptr;
149 non_default_reset_ptr.reset(p: new Resettable);
150 non_default_reset_ptr->reset();
151}
152
153template <typename T>
154void TemplatePositiveTest() {
155 std::unique_ptr<T> u_ptr;
156
157 u_ptr.reset();
158 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
159 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
160 // CHECK-FIXES: u_ptr = nullptr;
161 u_ptr->reset();
162 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
163 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
164 // CHECK-FIXES: (*u_ptr).reset();
165
166 std::shared_ptr<T> s_ptr;
167 s_ptr.reset();
168 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
169 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
170 // CHECK-FIXES: s_ptr = nullptr;
171 s_ptr->reset();
172 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
173 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
174 // CHECK-FIXES: (*s_ptr).reset();
175}
176
177template <typename T>
178void TemplatNegativeTestTypeWithReset() {
179 std::unique_ptr<T> u_ptr;
180 u_ptr.reset();
181 u_ptr->reset(0);
182
183 std::shared_ptr<T> s_ptr;
184 s_ptr.reset();
185 s_ptr->reset(0);
186}
187
188template <typename T>
189void TemplatNegativeTestTypeWithoutReset() {
190 std::unique_ptr<T> u_ptr;
191 u_ptr.reset();
192
193 std::unique_ptr<T> s_ptr;
194 s_ptr.reset();
195}
196
197void instantiate() {
198 TemplatePositiveTest<Resettable>();
199 TemplatePositiveTest<std::unique_ptr<int>>();
200 TemplatePositiveTest<std::shared_ptr<int>>();
201 TemplatNegativeTestTypeWithReset<ResettableWithParam>();
202 TemplatNegativeTestTypeWithoutReset<NonResettable>();
203}
204
205struct S {
206 void foo() {
207 u_ptr.reset();
208 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
209 // CHECK-MESSAGES: :[[@LINE-2]]:5: note: consider assigning the pointer to 'nullptr' here
210 // CHECK-FIXES: u_ptr = nullptr;
211 u_ptr->reset();
212 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
213 // CHECK-MESSAGES: :[[@LINE-2]]:5: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
214 // CHECK-FIXES: (*u_ptr).reset();
215 u_ptr.reset(nullptr);
216 u_ptr->doSomething();
217
218 s_ptr.reset();
219 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
220 // CHECK-MESSAGES: :[[@LINE-2]]:5: note: consider assigning the pointer to 'nullptr' here
221 // CHECK-FIXES: s_ptr = nullptr;
222 s_ptr->reset();
223 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
224 // CHECK-MESSAGES: :[[@LINE-2]]:5: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
225 // CHECK-FIXES: (*s_ptr).reset();
226 s_ptr.reset(nullptr);
227
228 ptr.reset();
229 }
230
231 std::unique_ptr<Resettable> u_ptr;
232 std::unique_ptr<std::shared_ptr<int>> s_ptr;
233 std::unique_ptr<NonResettable> ptr;
234};
235
236
237typedef std::unique_ptr<Resettable> TypedefResettableUniquePtr;
238typedef std::shared_ptr<Resettable> TypedefResettableSharedPtr;
239
240void TypedefPositive() {
241 TypedefResettableUniquePtr u_ptr;
242 u_ptr.reset();
243 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
244 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
245 // CHECK-FIXES: u_ptr = nullptr;
246 u_ptr->reset();
247 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
248 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
249 // CHECK-FIXES: (*u_ptr).reset();
250
251 TypedefResettableSharedPtr s_ptr;
252 s_ptr.reset();
253 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
254 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
255 // CHECK-FIXES: s_ptr = nullptr;
256
257 s_ptr->reset();
258 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
259 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
260 // CHECK-FIXES: (*s_ptr).reset();
261}
262
263using UsingResettableUniquePtr = std::unique_ptr<Resettable>;
264using UsingResettableSharedPtr = std::shared_ptr<Resettable>;
265
266void UsingPositive() {
267 UsingResettableUniquePtr u_ptr;
268 u_ptr.reset();
269 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
270 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
271 // CHECK-FIXES: u_ptr = nullptr;
272 u_ptr->reset();
273 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
274 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
275 // CHECK-FIXES: (*u_ptr).reset();
276
277 UsingResettableSharedPtr s_ptr;
278 s_ptr.reset();
279 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
280 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
281 // CHECK-FIXES: s_ptr = nullptr;
282
283 s_ptr->reset();
284 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
285 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
286 // CHECK-FIXES: (*s_ptr).reset();
287}
288
289template<typename T>
290using UsingUniquePtr = std::unique_ptr<T>;
291template<typename T>
292using UsingSharedPtr = std::shared_ptr<T>;
293
294void UsingTemplatePositive() {
295 UsingUniquePtr<Resettable> u_ptr;
296 u_ptr.reset();
297 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
298 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
299 // CHECK-FIXES: u_ptr = nullptr;
300 u_ptr->reset();
301 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
302 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
303 // CHECK-FIXES: (*u_ptr).reset();
304
305 UsingSharedPtr<Resettable> s_ptr;
306 s_ptr.reset();
307 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
308 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
309 // CHECK-FIXES: s_ptr = nullptr;
310
311 s_ptr->reset();
312 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
313 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
314 // CHECK-FIXES: (*s_ptr).reset();
315}
316
317template<typename T>
318void UsingByTemplatePositive() {
319 UsingUniquePtr<T> u_ptr;
320 u_ptr.reset();
321 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
322 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
323 // CHECK-FIXES: u_ptr = nullptr;
324 u_ptr->reset();
325 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
326 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
327 // CHECK-FIXES: (*u_ptr).reset();
328
329 UsingSharedPtr<T> s_ptr;
330 s_ptr.reset();
331 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
332 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
333 // CHECK-FIXES: s_ptr = nullptr;
334
335 s_ptr->reset();
336 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
337 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
338 // CHECK-FIXES: (*s_ptr).reset();
339}
340
341void instantiate2() {
342 UsingByTemplatePositive<Resettable>();
343}
344
345void NestedUsingPositive() {
346 UsingUniquePtr<UsingSharedPtr<TypedefResettableUniquePtr>> nested_ptr;
347 nested_ptr.reset();
348 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
349 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
350 // CHECK-FIXES: nested_ptr = nullptr;
351 nested_ptr->reset();
352 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
353 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
354 // CHECK-FIXES: (*nested_ptr).reset();
355 (*nested_ptr).reset();
356 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
357 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
358 // CHECK-FIXES: (*nested_ptr) = nullptr;
359 (*nested_ptr)->reset();
360 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
361 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
362 // CHECK-FIXES: (*(*nested_ptr)).reset();
363 (**nested_ptr).reset();
364 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
365 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
366 // CHECK-FIXES: (**nested_ptr) = nullptr;
367 (**nested_ptr)->reset();
368 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
369 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
370 // CHECK-FIXES: (*(**nested_ptr)).reset();
371}
372
373// Check other default pointers and classes.
374namespace boost {
375
376template <typename T>
377struct shared_ptr {
378 T& operator*() const;
379 T* operator->() const;
380 void reset();
381 void reset(T*);
382};
383
384} // namespace boost
385
386void PositiveOtherClasses() {
387 boost::shared_ptr<Resettable> sh;
388 sh.reset();
389 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a smart pointer with pointee that also has a 'reset()' method, prefer more explicit approach
390 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider assigning the pointer to 'nullptr' here
391 // CHECK-FIXES: sh = nullptr;
392 sh->reset();
393 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: ambiguous call to 'reset()' on a pointee of a smart pointer, prefer more explicit approach
394 // CHECK-MESSAGES: :[[@LINE-2]]:3: note: consider dereferencing smart pointer to call 'reset' method of the pointee here
395 // CHECK-FIXES: (*sh).reset();
396}
397
398

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of clang-tools-extra/test/clang-tidy/checkers/readability/ambiguous-smartptr-reset-call.cpp