zinovy.nis added a comment.

In D74692#1884054 <https://reviews.llvm.org/D74692#1884054>, @Quuxplusone wrote:

> (I sent this to the mailing list, but I guess it doesn't show up here unless 
> I do it through Phab. Quoting myself—)
>
> I see your point about how users who care should always be passing this check 
> alongside "performance-move-const-arg"; but IMHO it still makes sense for 
> clang-tidy to warn unconditionally about code of the form
>
>   x = std::move(y);
>   use(y);
>   
>
> regardless of the incidental type of `y`. Sure, it's //technically// not 
> wrong if `y` is const... or if `y` is a primitive type, such as `Widget*`... 
> or if `y` is a well-defined library type, such as 
> `std::shared_ptr<Widget>`... or if `y` is a library type that works in 
> practice 
> <https://stackoverflow.com/questions/60175782/is-stdlistint-listreturn-stdmovelistlist-guaranteed-to-leave/60186200#comment106478458_60186200>,
>  such as `std::list<int>`... but regardless of its technical merits, the code 
> is still //logically semantically// wrong, and I think that's what the 
> clang-tidy check should be trying to diagnose.


Ok, maybe it worth just adding an additional text into the warning, like "Use 
of potentially moved value detected. But value is const so no actual move 
occurrs"?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74692



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

Reply via email to