about summary refs log tree commit diff
path: root/src/rustllvm/PassWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-26 21:16:36 -0800
committerbors <bors@rust-lang.org>2014-02-26 21:16:36 -0800
commit68a92c5ed58e676d6aa224681080f921b9e069a5 (patch)
tree4fea0f13c3296a129ca06ff71b4046579c38b00c /src/rustllvm/PassWrapper.cpp
parent780adfffc39bcb9d32685bd36e2f6b6e6a178dee (diff)
parentbbdaf01a5aa3ef55b693384465e61db1007a9a09 (diff)
downloadrust-68a92c5ed58e676d6aa224681080f921b9e069a5.tar.gz
rust-68a92c5ed58e676d6aa224681080f921b9e069a5.zip
auto merge of #12581 : alexcrichton/rust/older-llvm, r=brson
In doing so, revert travis to not using a 3.5 build because it seems to be changing enough that it's breaking our C++ glue frequently enough.
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
-rw-r--r--src/rustllvm/PassWrapper.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp
index c1655b3a415..2be7c84ab03 100644
--- a/src/rustllvm/PassWrapper.cpp
+++ b/src/rustllvm/PassWrapper.cpp
@@ -166,7 +166,11 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target,
   PassManager *PM = unwrap<PassManager>(PMR);
 
   std::string ErrorInfo;
+#if LLVM_VERSION_MINOR >= 4
   raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_None);
+#else
+  raw_fd_ostream OS(path, ErrorInfo, raw_fd_ostream::F_Binary);
+#endif
   if (ErrorInfo != "") {
     LLVMRustError = ErrorInfo.c_str();
     return false;
@@ -184,9 +188,21 @@ LLVMRustPrintModule(LLVMPassManagerRef PMR,
                     const char* path) {
   PassManager *PM = unwrap<PassManager>(PMR);
   std::string ErrorInfo;
+
+#if LLVM_VERSION_MINOR >= 4
   raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_None);
+#else
+  raw_fd_ostream OS(path, ErrorInfo, raw_fd_ostream::F_Binary);
+#endif
+
   formatted_raw_ostream FOS(OS);
+
+#if LLVM_VERSION_MINOR >= 5
   PM->add(createPrintModulePass(FOS));
+#else
+  PM->add(createPrintModulePass(&FOS));
+#endif
+
   PM->run(*unwrap(M));
 }