From: Sven van Haastregt Date: Wed, 29 Mar 2017 09:08:25 +0000 (+0000) Subject: [MachineVerifier] Avoid reference to nullptr X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=64532cd1e1bcd280dfa9605baad762d08c1a76cd;p=llvm [MachineVerifier] Avoid reference to nullptr Instantiation of the MachineVerifierPass through PassInfo::getNormalCtor would yield a segfault since the default constructor of the MachineVerifierPass takes a reference to nullptr. Patch by Simone Pellegrini. Differential Revision: https://reviews.llvm.org/D31387 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298987 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/MachineVerifier.cpp b/lib/CodeGen/MachineVerifier.cpp index 15694cb481f..5c263b3021f 100644 --- a/lib/CodeGen/MachineVerifier.cpp +++ b/lib/CodeGen/MachineVerifier.cpp @@ -260,8 +260,8 @@ namespace { 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()) + : MachineFunctionPass(ID), Banner(std::move(banner)) { initializeMachineVerifierPassPass(*PassRegistry::getPassRegistry()); }