[PATCH] D70390: [clang-tidy] new performance-no-automatic-move check.

Clement Courbet via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 18 06:48:57 PST 2019


courbet marked 3 inline comments as done.
courbet added a comment.

Thanks for the comments



================
Comment at: clang-tools-extra/docs/clang-tidy/checks/performance-no-automatic-move.rst:47
+    std::vector<int>&& obj = ...;
+    return std::move(obj);  // calls StatusOr::StatusOr(std::vector<int>&&)
+  }
----------------
JonasToth wrote:
> While checking this example it seems clang already has a warning for that case?
> 
> https://godbolt.org/z/q5zzh-
> 
> What parts of this check will be more then the warnings already do?
I was not aware of that, thanks for pointing that out. I don't think the check does more than the warning in that case. TBH I have not seen instances of this while running the check on our codebase (I'm only looking at a sample of the mistakes though, there are too many hits to look at all of them). All mistakes I have seen are of the `const` kind. 

The value we get from having this in the form of a check is more control over which types are allowed through the clang-tidy options.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/performance-no-automatic-move.rst:55
+
+## Semantics
+
----------------
JonasToth wrote:
> Does this syntax work in rst files?
Nope, this was migrated from our internal markdown syntax, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70390





More information about the cfe-commits mailing list