================
@@ -388,9 +397,10 @@ void UseAfterMoveFinder::getReinits(
   }
 }
 
-enum class MoveType {
-  Move,    // std::move
-  Forward, // std::forward
+enum MoveType {
+  Forward = 0,      // std::forward
+  Move = 1,         // std::move
+  Invalidation = 2, // other
 };
 
 static MoveType determineMoveType(const FunctionDecl *FuncDecl) {
----------------
zeyi2 wrote:

A tiny suggestion: IMO we need to distinguish `std::move` and user-defined 
`move` function.

If a user adds a custom function to `InvalidationFunctions` that happens to be 
named `move`, the current logic will hit the early return `if 
(FuncDecl->getName() == "move")` and treat it as `MoveType::Move`.

So the diagnostic will report: "variable used after it was moved", which might 
be misleading.

Can we add another if before checking "move" and "forward"?

```c++
if (FuncDecl->isInStdNamespace()) {
   if (FuncDecl->getName() == "move") return ...
   if (FuncDecl->getName() == "forward") return ...
}
```

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

Reply via email to