Lines Matching refs:P

26   std::unique_ptr<A> P; // expected-note {{Default constructed smart pointer 'P' is null}}  in derefAfterDefaultCtr()  local
27 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterDefaultCtr()
33 …std::unique_ptr<A> P(NullInnerPtr); // expected-note {{Smart pointer 'P' is constructed using a nu… in derefAfterCtrWithNull() local
34 *P; // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterCtrWithNull()
40 …std::unique_ptr<A> P(NullInnerPtr); // expected-note {{Smart pointer 'P' is constructed using a nu… in derefAfterCtrWithNullVariable() local
41 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterCtrWithNullVariable()
46 std::unique_ptr<A> P(new A()); // expected-note {{Smart pointer 'P' is constructed}} in derefAfterRelease() local
48 P.release(); // expected-note {{Smart pointer 'P' is released and set to null}} in derefAfterRelease()
49 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterRelease()
54 std::unique_ptr<A> P(new A()); // expected-note {{Smart pointer 'P' is constructed}} in derefAfterReset() local
55 P.reset(); // expected-note {{Smart pointer 'P' reset using a null value}} in derefAfterReset()
56 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterReset()
62 std::unique_ptr<A> P(new A()); // expected-note {{Smart pointer 'P' is constructed}} in derefAfterResetWithNull() local
63 P.reset(NullInnerPtr); // expected-note {{Smart pointer 'P' reset using a null value}} in derefAfterResetWithNull()
64 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterResetWithNull()
71 std::unique_ptr<A> P; // FIXME: add note "Default constructed smart pointer 'P' is null" in derefOnReleasedNullRawPtr() local
72 A *AP = P.release(); // expected-note {{'AP' initialized to a null pointer value}} in derefOnReleasedNullRawPtr()
78 std::unique_ptr<A> P(new A()); // expected-note {{Smart pointer 'P' is constructed}} in derefOnSwappedNullPtr() local
80 P.swap(PNull); in derefOnSwappedNullPtr()
82 …(*P).foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]… in derefOnSwappedNullPtr()
87 std::unique_ptr<A> P; // expected-note {{Default constructed smart pointer 'P' is null}} in derefOnStdSwappedNullPtr() local
89 std::swap(P, PNull); in derefOnStdSwappedNullPtr()
90 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefOnStdSwappedNullPtr()
95 std::unique_ptr<A> P; member
101 …S.P->foo(); // expected-warning {{Dereference of null smart pointer 'S.P' [alpha.cplusplus.SmartPt… in derefAfterDefaultCtrInsideStruct()
106 std::unique_ptr<A> P; // expected-note {{Default constructed smart pointer 'P' is null}} in noNoteTagsForNonInterestingRegion() local
112 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in noNoteTagsForNonInterestingRegion()
117 std::unique_ptr<A> P; // FIXME: add note "Default constructed smart pointer 'P' is null" in derefOnRawPtrFromGetOnNullPtr() local
118 P.get()->foo(); // expected-warning {{Called C++ object pointer is null [core.CallAndMessage]}} in derefOnRawPtrFromGetOnNullPtr()
123 std::unique_ptr<A> P(new A()); in derefOnRawPtrFromGetOnValidPtr() local
124 P.get()->foo(); // No warning. in derefOnRawPtrFromGetOnValidPtr()
127 void derefOnRawPtrFromGetOnUnknownPtr(std::unique_ptr<A> P) { in derefOnRawPtrFromGetOnUnknownPtr() argument
128 P.get()->foo(); // No warning. in derefOnRawPtrFromGetOnUnknownPtr()
134 std::unique_ptr<A> P; in derefOnMovedFromValidPtr() local
135P = std::move(PToMove); // expected-note {{Smart pointer 'PToMove' is null after being moved to 'P… in derefOnMovedFromValidPtr()
142 std::unique_ptr<A> P; in derefOnMovedToNullPtr() local
143 P = std::move(PToMove); // No note. in derefOnMovedToNullPtr()
144 P->foo(); // No warning. in derefOnMovedToNullPtr()
148 std::unique_ptr<A> P(new A()); // expected-note {{Smart pointer 'P' is constructed}} in derefOnNullPtrGotMovedFromValidPtr() local
151 P = std::move(PToMove); // expected-note {{A null pointer value is moved to 'P'}} in derefOnNullPtrGotMovedFromValidPtr()
152 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefOnNullPtrGotMovedFromValidPtr()
157 std::unique_ptr<A> P; in derefOnMovedUnknownPtr() local
158P = std::move(PToMove); // expected-note {{Smart pointer 'PToMove' is null after; previous value m… in derefOnMovedUnknownPtr()
164 std::unique_ptr<A> P; // expected-note {{Default constructed smart pointer 'P' is null}} in derefOnAssignedNullPtrToNullSmartPtr() local
165 P = nullptr; // expected-note {{Smart pointer 'P' is assigned to null}} in derefOnAssignedNullPtrToNullSmartPtr()
166 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefOnAssignedNullPtrToNullSmartPtr()
171 std::unique_ptr<A> P(new A()); // expected-note {{Smart pointer 'P' is constructed}} in derefOnAssignedZeroToNullSmartPtr() local
173 P = 0; // expected-note {{Smart pointer 'P' is assigned to null}} in derefOnAssignedZeroToNullSmartPtr()
174 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefOnAssignedZeroToNullSmartPtr()
180 …std::unique_ptr<A> P(std::move(PToMove)); // expected-note {{A null pointer value is moved to 'P'}} in derefMoveConstructedWithNullPtr() local
181 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefMoveConstructedWithNullPtr()
188 …std::unique_ptr<A> P(std::move(PToMove)); // expected-note {{Smart pointer 'PToMove' is null after… in derefValidPtrMovedToConstruct() local
196 …std::unique_ptr<A> P(std::move(PToMove)); // expected-note {{Smart pointer 'PToMove' is null after… in derefNullPtrMovedToConstruct() local
202 …std::unique_ptr<A> P(std::move(PToMove)); // expected-note {{Smart pointer 'PToMove' is null after… in derefUnknownPtrMovedToConstruct() local
208 std::unique_ptr<A> P; // expected-note {{Default constructed smart pointer 'P' is null}} in derefConditionOnNullPtrFalseBranch() local
209 if (P) { // expected-note {{Taking false branch}} in derefConditionOnNullPtrFalseBranch()
210 P->foo(); // No warning. in derefConditionOnNullPtrFalseBranch()
212P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefConditionOnNullPtrFalseBranch()
218 std::unique_ptr<A> P; // expected-note {{Default constructed smart pointer 'P' is null}} in derefConditionOnNullPtrTrueBranch() local
219 if (!P) { // expected-note {{Taking true branch}} in derefConditionOnNullPtrTrueBranch()
220P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefConditionOnNullPtrTrueBranch()
226 std::unique_ptr<A> P(new A()); in derefConditionOnValidPtrTrueBranch() local
228 if (P) { // expected-note {{Taking true branch}} in derefConditionOnValidPtrTrueBranch()
237 std::unique_ptr<A> P(new A()); in derefConditionOnValidPtrFalseBranch() local
239 if (!P) { // expected-note {{Taking false branch}} in derefConditionOnValidPtrFalseBranch()
248 std::unique_ptr<A> P(new A()); in derefConditionOnNotValidPtr() local
250 if (!P) in derefConditionOnNotValidPtr()
254 void derefConditionOnUnKnownPtrAssumeNull(std::unique_ptr<A> P) { in derefConditionOnUnKnownPtrAssumeNull() argument
256 if (!P) { // expected-note {{Taking true branch}} in derefConditionOnUnKnownPtrAssumeNull()
263 void derefConditionOnUnKnownPtrAssumeNonNull(std::unique_ptr<A> P) { in derefConditionOnUnKnownPtrAssumeNonNull() argument
265 if (P) { // expected-note {{Taking true branch}} in derefConditionOnUnKnownPtrAssumeNonNull()
272 void derefOnValidPtrAfterReset(std::unique_ptr<A> P) { in derefOnValidPtrAfterReset() argument
273 P.reset(new A()); in derefOnValidPtrAfterReset()
274 if (!P) in derefOnValidPtrAfterReset()
275 P->foo(); // No warning. in derefOnValidPtrAfterReset()
277 P->foo(); // No warning. in derefOnValidPtrAfterReset()
281 std::unique_ptr<int> P; member
284 if (!P) { // No-note because foo() is pruned in foo()
291 P.reset(new int(0)); // expected-note {{Assigning 0}} in callingFooWithNullPointer()
292 return 1 / *(P.get()); // expected-warning {{Division by zero [core.DivideZero]}} in callingFooWithNullPointer()
297 P.reset(new int(0)); // expected-note {{Assigning 0}} in callingFooWithValidPointer()
299 return 1 / *(P.get()); // expected-warning {{Division by zero [core.DivideZero]}} in callingFooWithValidPointer()
304 P.swap(PUnknown); in callingFooWithUnknownPointer()
306 P.reset(new int(0)); // expected-note {{Assigning 0}} in callingFooWithUnknownPointer()
307 return 1 / *(P.get()); // expected-warning {{Division by zero [core.DivideZero]}} in callingFooWithUnknownPointer()
312 void derefAfterBranchingOnUnknownInnerPtr(std::unique_ptr<A> P) { in derefAfterBranchingOnUnknownInnerPtr() argument
313 A *RP = P.get(); in derefAfterBranchingOnUnknownInnerPtr()
316P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in derefAfterBranchingOnUnknownInnerPtr()
322 auto P = std::make_unique<A>(); in makeUniqueReturnsNonNullUniquePtr() local
323 if (!P) { // expected-note {{Taking false branch}} in makeUniqueReturnsNonNullUniquePtr()
324 P->foo(); // should have no warning here, path is impossible in makeUniqueReturnsNonNullUniquePtr()
326 P.reset(); // expected-note {{Smart pointer 'P' reset using a null value}} in makeUniqueReturnsNonNullUniquePtr()
328 if (!P) { in makeUniqueReturnsNonNullUniquePtr()
330P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in makeUniqueReturnsNonNullUniquePtr()
338 auto P = std::make_unique_for_overwrite<A>(); in makeUniqueForOverwriteReturnsNullUniquePtr() local
339 if (!P) { // expected-note {{Taking false branch}} in makeUniqueForOverwriteReturnsNullUniquePtr()
340 P->foo(); // should have no warning here, path is impossible in makeUniqueForOverwriteReturnsNullUniquePtr()
342 P.reset(); // expected-note {{Smart pointer 'P' reset using a null value}} in makeUniqueForOverwriteReturnsNullUniquePtr()
344 if (!P) { in makeUniqueForOverwriteReturnsNullUniquePtr()
346P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}} in makeUniqueForOverwriteReturnsNullUniquePtr()
362 auto P = std::make_unique<G>(&x); in foo() local
364 clang_analyzer_eval(*P->p == 1); // expected-warning {{TRUE}} in foo()