For PR797:
Change the Path::make*OnDisk methods exception free and adjust their usage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29836 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp
index a9df06d..c8ecde5 100644
--- a/tools/gccld/gccld.cpp
+++ b/tools/gccld/gccld.cpp
@@ -385,13 +385,23 @@
       EmitShellScript(argv);
 
       // Make the bytecode file readable and directly executable in LLEE
-      sys::Path(RealBytecodeOutput).makeExecutableOnDisk();
-      sys::Path(RealBytecodeOutput).makeReadableOnDisk();
+      std::string ErrMsg;
+      if (sys::Path(RealBytecodeOutput).makeExecutableOnDisk(&ErrMsg)) {
+        std::cerr << argv[0] << ": " << ErrMsg << "\n";
+        return 1;
+      }
+      if (sys::Path(RealBytecodeOutput).makeReadableOnDisk(&ErrMsg)) {
+        std::cerr << argv[0] << ": " << ErrMsg << "\n";
+        return 1;
+      }
     }
 
     // Make the output, whether native or script, executable as well...
-    sys::Path(OutputFilename).makeExecutableOnDisk();
-
+    std::string ErrMsg;
+    if (sys::Path(OutputFilename).makeExecutableOnDisk(&ErrMsg)) {
+      std::cerr << argv[0] << ": " << ErrMsg << "\n";
+      return 1;
+    }
   } catch (const char*msg) {
     std::cerr << argv[0] << ": " << msg << "\n";
     exitCode = 1;
diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp
index c8e505c..679522f 100644
--- a/tools/llvm-ld/llvm-ld.cpp
+++ b/tools/llvm-ld/llvm-ld.cpp
@@ -598,11 +598,21 @@
       }
 
       // Make the script executable...
-      sys::Path(OutputFilename).makeExecutableOnDisk();
+      std::string ErrMsg;
+      if (sys::Path(OutputFilename).makeExecutableOnDisk(&ErrMsg)) {
+        std::cerr << argv[0] << ": " << ErrMsg << "\n";
+        return 1;
+      }
 
       // Make the bytecode file readable and directly executable in LLEE as well
-      sys::Path(RealBytecodeOutput).makeExecutableOnDisk();
-      sys::Path(RealBytecodeOutput).makeReadableOnDisk();
+      if (sys::Path(RealBytecodeOutput).makeExecutableOnDisk(&ErrMsg)) {
+        std::cerr << argv[0] << ": " << ErrMsg << "\n";
+        return 1;
+      }
+      if (sys::Path(RealBytecodeOutput).makeReadableOnDisk(&ErrMsg)) {
+        std::cerr << argv[0] << ": " << ErrMsg << "\n";
+        return 1;
+      }
     }
 
     return 0;