[llvm] r298987 - [MachineVerifier] Avoid reference to nullptr

Sven van Haastregt via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 02:08:26 PDT 2017


Author: svenvh
Date: Wed Mar 29 04:08:25 2017
New Revision: 298987

URL: http://llvm.org/viewvc/llvm-project?rev=298987&view=rev
Log:
[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


Modified:
    llvm/trunk/lib/CodeGen/MachineVerifier.cpp

Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineVerifier.cpp?rev=298987&r1=298986&r2=298987&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Wed Mar 29 04:08:25 2017
@@ -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());
       }
 




More information about the llvm-commits mailing list