================
@@ -279,7 +281,7 @@ void UseAfterMoveFinder::getDeclRefs(
         if (DeclRef && BlockMap->blockContainingStmt(DeclRef) == Block) {
           // Ignore uses of a standard smart pointer that don't dereference the
           // pointer.
-          if (Operator || !isStandardSmartPointer(DeclRef->getDecl())) {
+          if (Operator || !isStandardResettableOwner(DeclRef->getDecl())) {
----------------
5chmidti wrote:

I think the check should actually not be ignoring additional operations for 
`optional` and `any`.

E.g., `optional::has_value` or `optional::and_then` could be problematic.

For smart pointers, their state is well-defined and allows using the object 
with those other member functions. But in the case of `std::optional` and 
`std::any`, this is not the case and additional members need to be considered 
unsafe. E.g., if we move from an `optional` that had a value, then calling 
`and_then` on that optional would be considered safe right now, but it is 
unsafe from what I can tell (e.g., 
https://timsong-cpp.github.io/cppwp/n4861/optional#ctor-9).

https://github.com/llvm/llvm-project/pull/114255
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to