ccotter added a comment.

> What happens with code like this
>
>   void foo(bar&& B) {
>     std::move(B);
>   }

My new check does not flag this function, although it looks like another check 
flagged the move expression: `ignoring return value of function declared with 
const attribute [clang-diagnostic-unused-value]`. Guideline F.18 only says to 
flag functions where "the function body uses them without std::move." I think 
this could be improved with something like "the function body does not move 
construct or move assign the parameter, and does not pass the result of move() 
to another function which accepts rvalue references". I can open an issue on 
the CppCoreGuidelines repo to discuss this. On a related note, I believe 
there's another clang-tidy check that flags `move` on const values, so I could 
see clang-tidy similarly checking other "nonsense" move expressions such as 
this one (separate check).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141569

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

Reply via email to