For PR797:
Remove exceptions from the Path::create*OnDisk methods. Update their users
to handle error messages via arguments and result codes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29840 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp
index 679522f..53f04e6 100644
--- a/tools/llvm-ld/llvm-ld.cpp
+++ b/tools/llvm-ld/llvm-ld.cpp
@@ -492,16 +492,15 @@
           }
           // Get the program arguments
           sys::Path tmp_output("opt_result");
-          if (!tmp_output.createTemporaryFileOnDisk()) {
-            return PrintAndReturn(
-              "Can't create temporary file for post-link optimization");
+          std::string ErrMsg;
+          if (tmp_output.createTemporaryFileOnDisk(&ErrMsg)) {
+            return PrintAndReturn(ErrMsg);
           }
           const char* args[4];
           args[0] = I->c_str();
           args[1] = RealBytecodeOutput.c_str();
           args[2] = tmp_output.c_str();
           args[3] = 0;
-          std::string ErrMsg;
           if (0 == sys::Program::ExecuteAndWait(prog, args, 0,0,0, &ErrMsg)) {
             if (tmp_output.isBytecodeFile()) {
               sys::Path target(RealBytecodeOutput);