about summary refs log tree commit diff homepage
path: root/lib/Support/CompressionStream.cpp
diff options
context:
space:
mode:
authorRichard Trembecký <richardt@centrum.sk>2016-05-01 16:38:21 +0200
committerDan Liew <delcypher@gmail.com>2017-05-24 14:24:47 +0100
commitd3a467d8999e6e52892b13c2bc93ac829ee1b7c9 (patch)
tree99493da4b33f50eb0c27a237213c615520efbd95 /lib/Support/CompressionStream.cpp
parent92367dec2ee00cb708454e4c33ff34d80eddb878 (diff)
downloadklee-d3a467d8999e6e52892b13c2bc93ac829ee1b7c9.tar.gz
llvm: make KLEE compile against LLVM 3.5 and 3.6
Based on work by @ccadeptic23 and @delcypher.
Formatting fixed by @snf.
Fix compiler warning by @martijnthe.
Further fixes by @mchalupa.

Refactored, so that changes can be reviewed -- no massive changes in
whitespace and in the surrounding code.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'lib/Support/CompressionStream.cpp')
-rw-r--r--lib/Support/CompressionStream.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Support/CompressionStream.cpp b/lib/Support/CompressionStream.cpp
index eb208edf..36303878 100644
--- a/lib/Support/CompressionStream.cpp
+++ b/lib/Support/CompressionStream.cpp
@@ -10,9 +10,11 @@
 #include "klee/Config/Version.h"
 #ifdef HAVE_ZLIB_H
 #include "klee/Internal/Support/CompressionStream.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
+#if (LLVM_VERSION_CODE >= LLVM_VERSION(3, 3) \
+    && LLVM_VERSION_CODE <= LLVM_VERSION(3, 4))
 #include "llvm/Support/system_error.h"
 #else
+#include "llvm/Support/FileSystem.h"
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/types.h>
@@ -27,9 +29,13 @@ compressed_fd_ostream::compressed_fd_ostream(const char *Filename,
   ErrorInfo = "";
 #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
   // Open file in binary mode
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+  std::error_code EC =
+      llvm::sys::fs::openFileForWrite(Filename, FD, llvm::sys::fs::F_None);
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
   llvm::error_code EC =
       llvm::sys::fs::openFileForWrite(Filename, FD, llvm::sys::fs::F_Binary);
-
+#endif
   if (EC) {
     ErrorInfo = EC.message();
     FD = -1;