https://github.com/zwuis commented:

> - Do not implement this with usage of things like "getParents" - it will be 
> to slow, write RecursiveASTVisitor, in such case it will be easy to find out 
> about scope when entering lambdas, loops, exception handlers, in such case 
> also it will be easier to check all scope levels without need to build list 
> of usage, all you will need will be just to track variables.

+1. Another reason is that, if I read corrrectly, 
https://github.com/llvm/llvm-project/pull/175429#discussion_r2679611042 this 
case is not handled correctly.

> - In case of CPP you need also configuration options to exclude some Types 
> (RAII objects) and handling calls to members and operators.
> - At the last you may consider having option to exclude some types, like 
> builtin and const variables, as those most of the time will be optimized out.

+1. Consider cases like

```cpp
std::unique_lock L = AMutex;
// do something
{
  // do something
  L = std::unique_lock(AnotherMutex);
}
```

> - Current code looks too complicated

+1

> - You may need consider issues with examples like this:
> ```
> int var2 = 20;
> int var = var2;
> var2++;
> if (var3 > 100)
> {
>     // var cannot be moved here because it would hold different value, same 
> issues with side-effect functions that modify var2 and with std::move.
>      return var;
> }
> ```

+1. Ignore it if tests are already added.

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

Reply via email to