[PATCH] D86373: [analyzer] Add modeling for unique_ptr move constructor
Nithin VR via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 21 14:42:45 PDT 2020
vrnithinkumar added inline comments.
================
Comment at: clang/test/Analysis/smart-ptr.cpp:295
+ P->foo(); // No warning.
+}
----------------
I was trying to test the below code.
```
void foo_() {
std::unique_ptr<A> PToMove;
std::unique_ptr<A>&& AfterRValeRefCast = std::move(functionReturnsRValueRef());
std::unique_ptr<A> P(AfterRValeRefCast);
P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}}
}
```
But passing the local RValue reference variable to move constructor is always invoking the deleted copy constructor.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86373/new/
https://reviews.llvm.org/D86373
More information about the cfe-commits
mailing list