For PR351:
* removeFile() -> sys::Path::destroyFile()
* remove extraneous toString() calls
* convert local variables representing path names from std::string to
  sys::Path
* Use sys::Path objects with FileRemove instead of std::string
* Use sys::Path methods for construction of path names


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19001 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp
index 545d767..7dd6db4 100644
--- a/tools/bugpoint/CrashDebugger.cpp
+++ b/tools/bugpoint/CrashDebugger.cpp
@@ -49,23 +49,25 @@
 ReducePassList::TestResult
 ReducePassList::doTest(std::vector<const PassInfo*> &Prefix,
                        std::vector<const PassInfo*> &Suffix) {
-  std::string PrefixOutput;
+  sys::Path PrefixOutput;
   Module *OrigProgram = 0;
   if (!Prefix.empty()) {
     std::cout << "Checking to see if these passes crash: "
               << getPassesString(Prefix) << ": ";
-    if (BD.runPasses(Prefix, PrefixOutput))
+    std::string PfxOutput;
+    if (BD.runPasses(Prefix, PfxOutput))
       return KeepPrefix;
 
+    PrefixOutput.setFile(PfxOutput);
     OrigProgram = BD.Program;
 
-    BD.Program = ParseInputFile(PrefixOutput);
+    BD.Program = ParseInputFile(PrefixOutput.toString());
     if (BD.Program == 0) {
       std::cerr << BD.getToolName() << ": Error reading bytecode file '"
                 << PrefixOutput << "'!\n";
       exit(1);
     }
-    removeFile(PrefixOutput);
+    PrefixOutput.destroyFile();
   }
 
   std::cout << "Checking to see if these passes crash: "