Skylion007 added a comment.

I am trying this in the wild and getting some false positives where it tries to 
call std::move inside loop conditions and in the boolean condition for an if 
statement. Stuff like:

  if (auto* new_ptr = steal_ptr(std::move(old_ptr))) {
    ...
  }
  else {
    return old_ptr; // Now it's moved from and invalid
  }

Also this can be happen for similar boolean conditionals in while, for, do 
while loops.

Interestingly, the logic in bugprone-use-after-move flags this error so maybe 
we can reuse some of that logic to detect bad std::move.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137205/new/

https://reviews.llvm.org/D137205

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to