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

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 6 23:30:00 PST 2023


PiotrZSL added a comment.

I was thinking... In theory fix for this check should be one of: use const &, use value, move rvalue.
But const & is not always in an option, in utils we got 2 functions: isOnlyUsedAsConst, isExpensiveToCopy.
So in theory if variable can be used as const, then const & can be used, if var cannot be used as const and is cheap to copy, then in theory value can be used, otherwise we deal with something intended (like partial move, or write to variable), and such cases could be +- ignored in relaxed mode.

Still, this is just something to thing, not necessarily to implement.


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