[clang-tools-extra] Extend bugprone-use-after-move check to handle std::optional::reset() and std::any::reset() (PR #114255)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 4 07:25:36 PST 2024


================
@@ -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())) {
----------------
higher-performance wrote:

But just to double check -- are you sure this doesn't actually negatively impact `std::optional`? I'm having a hard time verifying this by just reading the code.

https://github.com/llvm/llvm-project/pull/114255


More information about the cfe-commits mailing list