[PATCH] D107900: [clang-tidy] Add a new clang-tidy check for trivially copyable types passed by const reference

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 16 00:09:37 PDT 2021


whisperity added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/PodConstRefToValueCheck.h:18-25
+/// The check detects when trivially_copyable types are passed by
+/// const-reference to a function and changes that to by value
+//
+//  RestrictToBuiltInTypes: if true (default false), restricts the check to the
+//  built-in types (int, double, etc)
+//
+//  MaxSize: int, default 16. Above this size, passing by const-reference makes
----------------



================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:78
+
+  Finds trivially_copyable types are passed by const-reference to a function
+  and changes that to by value
----------------



================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:79
+  Finds trivially_copyable types are passed by const-reference to a function
+  and changes that to by value
+
----------------



================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-pod-const-ref-to-value.rst:7
+This check detects when ``trivially_copyable`` types are passed by const-reference
+to a function and changes that to by value
+
----------------



================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-pod-const-ref-to-value.rst:9
+
+For example in the following code, it is replaced by ``void f(int i, double d)``
+
----------------



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

https://reviews.llvm.org/D107900



More information about the cfe-commits mailing list