[PATCH] D86293: [analyzer] Add modeling of Eq operator in smart ptr
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 21 17:53:53 PDT 2020
NoQ added a comment.
This looks outright correct to me. I have random suggestions on note text here and there.
================
Comment at: clang/test/Analysis/smart-ptr-text-output.cpp:132
+ std::unique_ptr<A> PToMove; // expected-note {{Default constructed smart pointer 'PToMove' is null}}
+ P = std::move(PToMove); // expected-note {{Smart pointer 'P' is null after a null value moved from 'PToMove'}}
+ P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}}
----------------
I suggest: `Null pointer value move-assigned to 'P'`.
================
Comment at: clang/test/Analysis/smart-ptr-text-output.cpp:139
+ std::unique_ptr<A> P;
+ P = std::move(PToMove); // expected-note {{Smart pointer 'PToMove' is null after moved and assigned to 'P'}}
+ PToMove->foo(); // expected-warning {{Dereference of null smart pointer 'PToMove' [alpha.cplusplus.SmartPtr]}}
----------------
I suggest: `Smart pointer 'PToMove' is null; previous value moved to 'P'`. Or maybe instead keep the note that the move-checker currently emits?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86293/new/
https://reviews.llvm.org/D86293
More information about the cfe-commits
mailing list