Lines Matching refs:P
13 void derefAfterMove(std::unique_ptr<int> P) { in derefAfterMove() argument
14 std::unique_ptr<int> Q = std::move(P); in derefAfterMove()
18 if (P) in derefAfterMove()
21 *P.get() = 1; // expected-warning {{Method called on moved-from object 'P' [cplusplus.Move]}} in derefAfterMove()
46 std::unique_ptr<A> P(new A()); in derefAfterValidCtr() local
48 P->foo(); // No warning. in derefAfterValidCtr()
51 void derefOfUnknown(std::unique_ptr<A> P) { in derefOfUnknown() argument
52 P->foo(); // No warning. in derefOfUnknown()
56 std::unique_ptr<A> P; in derefAfterDefaultCtr() local
58 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterDefaultCtr()
62 std::unique_ptr<A> P(nullptr); in derefAfterCtrWithNull() local
64 *P; // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterCtrWithNull()
69 std::unique_ptr<A> P(InnerPtr); in derefAfterCtrWithNullVariable() local
71 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterCtrWithNullVariable()
75 std::unique_ptr<A> P(new A()); in derefAfterRelease() local
76 P.release(); in derefAfterRelease()
78 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterRelease()
82 std::unique_ptr<A> P(new A()); in derefAfterReset() local
83 P.reset(); in derefAfterReset()
85 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterReset()
89 std::unique_ptr<A> P(new A()); in derefAfterResetWithNull() local
90 P.reset(nullptr); in derefAfterResetWithNull()
91 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterResetWithNull()
95 std::unique_ptr<A> P; in derefAfterResetWithNonNull() local
96 P.reset(new A()); in derefAfterResetWithNonNull()
98 P->foo(); // No warning. in derefAfterResetWithNonNull()
102 std::unique_ptr<A> P(new A()); in derefAfterReleaseAndResetWithNonNull() local
103 P.release(); in derefAfterReleaseAndResetWithNonNull()
104 P.reset(new A()); in derefAfterReleaseAndResetWithNonNull()
105 P->foo(); // No warning. in derefAfterReleaseAndResetWithNonNull()
109 std::unique_ptr<A> P; in derefOnReleasedNullRawPtr() local
110 A *AP = P.release(); in derefOnReleasedNullRawPtr()
115 std::unique_ptr<A> P(new A()); in derefOnReleasedValidRawPtr() local
116 A *AP = P.release(); in derefOnReleasedValidRawPtr()
128 std::unique_ptr<A> P; in regioninvalidationWithPassByRef() local
129 pass_smart_ptr_by_ref(P); in regioninvalidationWithPassByRef()
130 P->foo(); // no-warning in regioninvalidationWithPassByRef()
134 std::unique_ptr<A> P; in regioninvalidationWithPassByCostRef() local
135 pass_smart_ptr_by_const_ref(P); in regioninvalidationWithPassByCostRef()
136 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in regioninvalidationWithPassByCostRef()
140 std::unique_ptr<A> P; in regioninvalidationWithPassByRValueRef() local
141 pass_smart_ptr_by_rvalue_ref(std::move(P)); in regioninvalidationWithPassByRValueRef()
142 P->foo(); // no-warning in regioninvalidationWithPassByRValueRef()
146 std::unique_ptr<A> P; in regioninvalidationWithPassByConstRValueRef() local
147 pass_smart_ptr_by_const_rvalue_ref(std::move(P)); in regioninvalidationWithPassByConstRValueRef()
148 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in regioninvalidationWithPassByConstRValueRef()
152 std::unique_ptr<A> P; in regioninvalidationWithPassByPtr() local
153 pass_smart_ptr_by_ptr(&P); in regioninvalidationWithPassByPtr()
154 P->foo(); in regioninvalidationWithPassByPtr()
158 std::unique_ptr<A> P; in regioninvalidationWithPassByConstPtr() local
159 pass_smart_ptr_by_const_ptr(&P); in regioninvalidationWithPassByConstPtr()
160 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in regioninvalidationWithPassByConstPtr()
164 std::unique_ptr<A> P; member
177 S.P->foo(); // no-warning in regioninvalidationWithinStructPassByRef()
183 …S.P->foo(); // expected-warning {{Dereference of null smart pointer 'S.P' [alpha.cplusplus.SmartPt… in regioninvalidationWithinStructPassByConstRef()
189 S.P->foo(); // no-warning in regioninvalidationWithinStructPassByRValueRef()
195 …S.P->foo(); // expected-warning {{Dereference of null smart pointer 'S.P' [alpha.cplusplus.SmartPt… in regioninvalidationWithinStructPassByConstRValueRef()
201 S.P->foo(); // no-warning in regioninvalidationWithinStructPassByPtr()
207 …S.P->foo(); // expected-warning {{Dereference of null smart pointer 'S.P' [alpha.cplusplus.SmartPt… in regioninvalidationWithinStructPassByConstPtr()
212 std::unique_ptr<A> P(new A()); in derefAfterAssignment() local
214 Q = std::move(P); in derefAfterAssignment()
218 std::unique_ptr<A> P; in derefAfterAssignment() local
220 Q = std::move(P); in derefAfterAssignment()
226 std::unique_ptr<A> P(new A()); in derefOnSwappedNullPtr() local
228 P.swap(PNull); in derefOnSwappedNullPtr()
230 …(*P).foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]… in derefOnSwappedNullPtr()
234 std::unique_ptr<A> P; in derefOnFirstStdSwappedNullPtr() local
236 std::swap(P, PNull); in derefOnFirstStdSwappedNullPtr()
237 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefOnFirstStdSwappedNullPtr()
241 std::unique_ptr<A> P; in derefOnSecondStdSwappedNullPtr() local
243 std::swap(P, PNull); in derefOnSecondStdSwappedNullPtr()
248 std::unique_ptr<A> P(new A()); in derefOnSwappedValidPtr() local
250 P.swap(PValid); in derefOnSwappedValidPtr()
251 (*P).foo(); // No warning. in derefOnSwappedValidPtr()
253 std::swap(P, PValid); in derefOnSwappedValidPtr()
254 P->foo(); // No warning. in derefOnSwappedValidPtr()
259 std::unique_ptr<A> P; in derefOnRawPtrFromGetOnNullPtr() local
260 P.get()->foo(); // expected-warning {{Called C++ object pointer is null [core.CallAndMessage]}} in derefOnRawPtrFromGetOnNullPtr()
264 std::unique_ptr<A> P(new A()); in derefOnRawPtrFromGetOnValidPtr() local
265 P.get()->foo(); // No warning. in derefOnRawPtrFromGetOnValidPtr()
268 void derefOnRawPtrFromGetOnUnknownPtr(std::unique_ptr<A> P) { in derefOnRawPtrFromGetOnUnknownPtr() argument
269 P.get()->foo(); // No warning. in derefOnRawPtrFromGetOnUnknownPtr()
272 void derefOnRawPtrFromMultipleGetOnUnknownPtr(std::unique_ptr<A> P) { in derefOnRawPtrFromMultipleGetOnUnknownPtr() argument
273 A *X = P.get(); in derefOnRawPtrFromMultipleGetOnUnknownPtr()
274 A *Y = P.get(); in derefOnRawPtrFromMultipleGetOnUnknownPtr()
283 std::unique_ptr<A> P; in derefOnMovedFromValidPtr() local
284 P = std::move(PToMove); in derefOnMovedFromValidPtr()
290 std::unique_ptr<A> P; in derefOnMovedToNullPtr() local
291 P = std::move(PToMove); // No note. in derefOnMovedToNullPtr()
292 P->foo(); // No warning. in derefOnMovedToNullPtr()
296 std::unique_ptr<A> P(new A()); in derefOnNullPtrGotMovedFromValidPtr() local
298 P = std::move(PToMove); in derefOnNullPtrGotMovedFromValidPtr()
299 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefOnNullPtrGotMovedFromValidPtr()
303 std::unique_ptr<A> P; in derefOnMovedFromUnknownPtr() local
304 P = std::move(PToMove); in derefOnMovedFromUnknownPtr()
305 P->foo(); // No warning. in derefOnMovedFromUnknownPtr()
309 std::unique_ptr<A> P; in derefOnMovedUnknownPtr() local
310 P = std::move(PToMove); in derefOnMovedUnknownPtr()
315 std::unique_ptr<A> P; in derefOnAssignedNullPtrToNullSmartPtr() local
316 P = nullptr; in derefOnAssignedNullPtrToNullSmartPtr()
317 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefOnAssignedNullPtrToNullSmartPtr()
321 std::unique_ptr<A> P(new A()); in derefOnAssignedZeroToNullSmartPtr() local
322 P = 0; in derefOnAssignedZeroToNullSmartPtr()
323 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefOnAssignedZeroToNullSmartPtr()
326 void derefOnAssignedNullToUnknowSmartPtr(std::unique_ptr<A> P) { in derefOnAssignedNullToUnknowSmartPtr() argument
327 P = nullptr; in derefOnAssignedNullToUnknowSmartPtr()
328 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefOnAssignedNullToUnknowSmartPtr()
334 std::unique_ptr<A> P(new A()); in drefOnAssignedNullFromMethodPtrValidSmartPtr() local
335 P = returnRValRefOfUniquePtr(); in drefOnAssignedNullFromMethodPtrValidSmartPtr()
336 P->foo(); // No warning. in drefOnAssignedNullFromMethodPtrValidSmartPtr()
341 std::unique_ptr<A> P(std::move(PToMove)); in derefMoveConstructedWithValidPtr() local
342 P->foo(); // No warning. in derefMoveConstructedWithValidPtr()
347 std::unique_ptr<A> P(std::move(PToMove)); in derefMoveConstructedWithNullPtr() local
348 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefMoveConstructedWithNullPtr()
352 std::unique_ptr<A> P(std::move(PToMove)); in derefMoveConstructedWithUnknownPtr() local
353 P->foo(); // No warning. in derefMoveConstructedWithUnknownPtr()
358 std::unique_ptr<A> P(std::move(PToMove)); in derefValidPtrMovedToConstruct() local
364 std::unique_ptr<A> P(std::move(PToMove)); in derefNullPtrMovedToConstruct() local
369 std::unique_ptr<A> P(std::move(PToMove)); in derefUnknownPtrMovedToConstruct() local
376 std::unique_ptr<A> P(functionReturnsRValueRef()); in derefMoveConstructedWithRValueRefReturn() local
377 P->foo(); // No warning. in derefMoveConstructedWithRValueRefReturn()
381 std::unique_ptr<A> P; in derefConditionOnNullPtr() local
382 if (P) in derefConditionOnNullPtr()
383 P->foo(); // No warning. in derefConditionOnNullPtr()
385 … P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefConditionOnNullPtr()
389 std::unique_ptr<A> P; in derefConditionOnNotNullPtr() local
390 if (!P) in derefConditionOnNotNullPtr()
391 … P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefConditionOnNotNullPtr()
395 std::unique_ptr<A> P(new A()); in derefConditionOnValidPtr() local
397 if (P) in derefConditionOnValidPtr()
402 std::unique_ptr<A> P(new A()); in derefConditionOnNotValidPtr() local
404 if (!P) in derefConditionOnNotValidPtr()
408 void derefConditionOnUnKnownPtr(std::unique_ptr<A> P) { in derefConditionOnUnKnownPtr() argument
409 if (P) in derefConditionOnUnKnownPtr()
410 P->foo(); // No warning. in derefConditionOnUnKnownPtr()
412 … P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefConditionOnUnKnownPtr()
415 void derefOnValidPtrAfterReset(std::unique_ptr<A> P) { in derefOnValidPtrAfterReset() argument
416 P.reset(new A()); in derefOnValidPtrAfterReset()
417 if (!P) in derefOnValidPtrAfterReset()
418 P->foo(); // No warning. in derefOnValidPtrAfterReset()
420 P->foo(); // No warning. in derefOnValidPtrAfterReset()
424 std::unique_ptr<int> P(new int()); in innerPointerSymbolLiveness() local
425 clang_analyzer_warnOnDeadSymbol(P.get()); in innerPointerSymbolLiveness()
426 int *RP = P.release(); in innerPointerSymbolLiveness()
429 void boolOpCreatedConjuredSymbolLiveness(std::unique_ptr<int> P) { in boolOpCreatedConjuredSymbolLiveness() argument
430 if (P) { in boolOpCreatedConjuredSymbolLiveness()
431 int *X = P.get(); in boolOpCreatedConjuredSymbolLiveness()
436 void getCreatedConjuredSymbolLiveness(std::unique_ptr<int> P) { in getCreatedConjuredSymbolLiveness() argument
437 int *X = P.get(); in getCreatedConjuredSymbolLiveness()
440 if (!P) { in getCreatedConjuredSymbolLiveness()
441 Y = *P.get(); // expected-warning {{Dereference of null pointer [core.NullDereference]}} in getCreatedConjuredSymbolLiveness()
447 std::unique_ptr<int> P(q); in derefConditionOnUnKnownPtr() local
448 if (P) in derefConditionOnUnKnownPtr()
449 return *P; // No warning. in derefConditionOnUnKnownPtr()
451 …return *P; // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefConditionOnUnKnownPtr()
454 void derefAfterBranchingOnUnknownInnerPtr(std::unique_ptr<A> P) { in derefAfterBranchingOnUnknownInnerPtr() argument
455 A *RP = P.get(); in derefAfterBranchingOnUnknownInnerPtr()
457 … P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterBranchingOnUnknownInnerPtr()