[llvm] r325172 - Use std::unique_ptr. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 12:59:40 PST 2018


Author: rafael
Date: Wed Feb 14 12:59:39 2018
New Revision: 325172

URL: http://llvm.org/viewvc/llvm-project?rev=325172&view=rev
Log:
Use std::unique_ptr. NFC.

Modified:
    llvm/trunk/tools/bugpoint/CrashDebugger.cpp

Modified: llvm/trunk/tools/bugpoint/CrashDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CrashDebugger.cpp?rev=325172&r1=325171&r2=325172&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/CrashDebugger.cpp (original)
+++ llvm/trunk/tools/bugpoint/CrashDebugger.cpp Wed Feb 14 12:59:39 2018
@@ -854,7 +854,7 @@ bool ReduceCrashingNamedMDOps::TestNamed
     outs() << " named metadata operands: ";
 
   ValueToValueMapTy VMap;
-  Module *M = CloneModule(*BD.getProgram(), VMap).release();
+  std::unique_ptr<Module> M = CloneModule(*BD.getProgram(), VMap);
 
   // This is a little wasteful. In the future it might be good if we could have
   // these dropped during cloning.
@@ -874,17 +874,17 @@ bool ReduceCrashingNamedMDOps::TestNamed
   Passes.run(*M);
 
   // Try running on the hacked up program...
-  if (TestFn(BD, M)) {
+  if (TestFn(BD, M.get())) {
     // Make sure to use instruction pointers that point into the now-current
     // module, and that they don't include any deleted blocks.
     NamedMDOps.clear();
     for (const MDNode *Node : OldMDNodeOps)
       NamedMDOps.push_back(cast<MDNode>(*VMap.getMappedMD(Node)));
 
-    BD.setNewProgram(M); // It crashed, keep the trimmed version...
+    BD.setNewProgram(M.release()); // It crashed, keep the trimmed version...
     return true;
   }
-  delete M; // It didn't crash, try something else.
+  // It didn't crash, try something else.
   return false;
 }
 




More information about the llvm-commits mailing list