[clang-tools-extra] r270472 - Commiting for http://reviews.llvm.org/D20365

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Mon May 23 11:51:34 PDT 2016


Next time, please use real commit messages: Describe what the change does,
and why it's being done. Include a link to the review link at the end of
the commit message. If every change just had a phab link as commit message,
people bisecting changes would have to click through for every change in
`svn log` output.

On Mon, May 23, 2016 at 2:15 PM, Mads Ravn via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: madsravn
> Date: Mon May 23 13:15:40 2016
> New Revision: 270472
>
> URL: http://llvm.org/viewvc/llvm-project?rev=270472&view=rev
> Log:
> Commiting for http://reviews.llvm.org/D20365
>
> Modified:
>     clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
>     clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value.cpp
>
> Modified: clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp?rev=270472&r1=270471&r2=270472&view=diff
>
> ==============================================================================
> --- clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
> (original)
> +++ clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp Mon
> May 23 13:15:40 2016
> @@ -181,6 +181,12 @@ void PassByValueCheck::check(const Match
>    if (!paramReferredExactlyOnce(Ctor, ParamDecl))
>      return;
>
> +
> +  // If the parameter is trivial to copy, don't move it. Moving a
> trivivally
> +  // copyable type will cause a problem with modernize-pass-by-value
> +  if (ParamDecl->getType().isTriviallyCopyableType(*Result.Context))
> +    return;
> +
>    auto Diag = diag(ParamDecl->getLocStart(), "pass by value and use
> std::move");
>
>    // Iterate over all declarations of the constructor.
>
> Modified:
> clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value.cpp?rev=270472&r1=270471&r2=270472&view=diff
>
> ==============================================================================
> --- clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value.cpp
> (original)
> +++ clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value.cpp
> Mon May 23 13:15:40 2016
> @@ -194,3 +194,9 @@ struct S {
>    Movable M;
>  };
>
> +// Test that types that are trivially copyable will not use std::move.
> This will
> +// cause problems with misc-move-const-arg, as it will revert it.
> +struct T {
> +  std::array<int, 10> a_;
> +  T(std::array<int, 10> a) : a_(a) {}
> +};
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160523/50931487/attachment-0001.html>


More information about the cfe-commits mailing list