[PATCH] D31387: MachineVerifier: avoid reference to nullptr

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 08:05:32 PDT 2017


On Wed, Mar 29, 2017 at 2:20 AM Sven van Haastregt via Phabricator <
reviews at reviews.llvm.org> wrote:

> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL298987: [MachineVerifier] Avoid reference to nullptr
> (authored by svenvh).
>
> Changed prior to commit:
>   https://reviews.llvm.org/D31387?vs=93108&id=93350#toc
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D31387
>
> Files:
>   llvm/trunk/lib/CodeGen/MachineVerifier.cpp
>
>
> Index: llvm/trunk/lib/CodeGen/MachineVerifier.cpp
> ===================================================================
> --- llvm/trunk/lib/CodeGen/MachineVerifier.cpp
> +++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp
> @@ -260,8 +260,8 @@
>      static char ID; // Pass ID, replacement for typeid
>      const std::string Banner;
>
> -    MachineVerifierPass(const std::string &banner = nullptr)
> -      : MachineFunctionPass(ID), Banner(banner) {
> +    MachineVerifierPass(const std::string banner = std::string())
>

Now that this is a value, the 'const' here is incorrect/pessimizing and
will prevent the std::move from being effective (it's not possible to move
from a const object). Please remove it. :)

- Dave


> +      : MachineFunctionPass(ID), Banner(std::move(banner)) {
>
>  initializeMachineVerifierPassPass(*PassRegistry::getPassRegistry());
>        }
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170329/588a1cbc/attachment.html>


More information about the llvm-commits mailing list