[PATCH] D141569: [clang-tidy] Implement CppCoreGuideline F.18

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 23 09:29:21 PST 2023


PiotrZSL added a comment.

In D141569#4147268 <https://reviews.llvm.org/D141569#4147268>, @ccotter wrote:

> Trivial types should not be passed by rvalue reference, but by value per the diagram under http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#fcall-parameter-passing. I feel like adding an option to opt-out of this is missing the point of this check, and rvalue references of trivial type should just be fixed rather than adding an option to permit them.

Imaginate that such trivial type could be for example 200KB in size, copy to argument, and then from argument to for example class member could be costly. Using rvalue allows to pass non const object to some for example function.
I'm asking about option, just because other check also got such option, and if both will have one, then user can decide whatever he want to use std::move or not.
Still I agree that because we don't lose anything there, moving such trivial variable using std::move still would be fine, and at that point checking trivial variables in other check could be disabled, that's what I did in my project what I was fixing these issues.
So all is up to you.

If else, then maybe it would be good to deliver this check, if something happen then before end of release it still could be fixed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141569



More information about the cfe-commits mailing list