================
@@ -401,9 +411,11 @@ void UseAfterMoveFinder::getDeclRefs(
       }
     };
 
-    auto DeclRefMatcher = 
declRefExpr(hasDeclaration(equalsNode(MovedVariable)),
-                                      unless(inDecltypeOrTemplateArg()))
-                              .bind("declref");
+    auto DeclRefMatcher =
+        declRefExpr(hasDeclaration(equalsNode(MovedVariable)),
+                    unless(inDecltypeOrTemplateArg()),
+                    optionally(hasParent(memberExpr().bind("member-expr"))))
----------------
zeyi2 wrote:

I think there is a FP, repro:

```c++
#include <utility>
struct A { int a; };
struct B { int b; };
struct C : A, B {
  C(C&& other) : A(std::move(other)) { other.b; }
};
```

clang-tidy gives:
```
2 warnings generated.
/tmp/foo.cpp:5:40: warning: 'other' used after it was moved 
[bugprone-use-after-move]
    5 |   C(C&& other) : A(std::move(other)) { other.b; }
      |                                        ^
/tmp/foo.cpp:5:18: note: move occurred here
    5 |   C(C&& other) : A(std::move(other)) { other.b; }
      |                  ^
Suppressed 1 warnings (1 with check filters).
```


https://github.com/llvm/llvm-project/pull/189638
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to