about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorGlenn Willen <gwillen@nerdnet.org>2012-07-13 17:06:30 -0400
committerGlenn Willen <gwillen@nerdnet.org>2012-07-13 17:06:30 -0400
commit28c1f21433a927bf9e3b399ec293cd7f7b688af6 (patch)
tree604cef26118332653a28747d18247793298cb142 /src/rustllvm/RustWrapper.cpp
parent05ff4f416b2fb2ac8ea19e0076d5af39b4590e05 (diff)
downloadrust-28c1f21433a927bf9e3b399ec293cd7f7b688af6.tar.gz
rust-28c1f21433a927bf9e3b399ec293cd7f7b688af6.zip
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) {