about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorTim Chevalier <catamorphism@gmail.com>2012-07-19 19:01:22 -0700
committerTim Chevalier <catamorphism@gmail.com>2012-07-19 19:01:22 -0700
commitce46e113c59b5113d2ad2c1787d432697f064f2d (patch)
treea379cffbf5cbea455f12607620c83372975ce7ee /src/rustllvm/RustWrapper.cpp
parentac9cf98564cc394672cd9a96a02093569951027c (diff)
parent28c1f21433a927bf9e3b399ec293cd7f7b688af6 (diff)
downloadrust-ce46e113c59b5113d2ad2c1787d432697f064f2d.tar.gz
rust-ce46e113c59b5113d2ad2c1787d432697f064f2d.zip
Merge pull request #2910 from gwillen/bug-2360
Better error when rustc fails to write output.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index 6d99b0f4cb1..6c19a299757 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -75,7 +75,7 @@ extern "C" bool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src) {
   return true;
 }
 
-extern "C" void
+extern "C" bool
 LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
                         LLVMModuleRef M,
                         const char *triple,
@@ -107,6 +107,10 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
   std::string ErrorInfo;
   raw_fd_ostream OS(path, ErrorInfo,
                     raw_fd_ostream::F_Binary);
+  if (ErrorInfo != "") {
+    LLVMRustError = ErrorInfo.c_str();
+    return false;
+  }
   formatted_raw_ostream FOS(OS);
 
   bool foo = Target->addPassesToEmitFile(*PM, FOS, FileType, NoVerify);
@@ -114,6 +118,7 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
   (void)foo;
   PM->run(*unwrap(M));
   delete Target;
+  return true;
 }
 
 extern "C" LLVMModuleRef LLVMRustParseAssemblyFile(const char *Filename) {