about summary refs log tree commit diff homepage
path: root/include
diff options
context:
space:
mode:
authorJulian Büning <julian.buening@rwth-aachen.de>2018-10-03 14:42:37 +0200
committerCristian Cadar <c.cadar@imperial.ac.uk>2018-10-23 18:57:53 +0300
commit2b34877c5dbf24eabf331a124b1e68d901a72cba (patch)
tree4d6f4a753d9d36a18c482cf0c8d4b8dc550bafb8 /include
parentd032742a963e7d8e83dad509dd1c95b4e1a34436 (diff)
downloadklee-2b34877c5dbf24eabf331a124b1e68d901a72cba.tar.gz
refactor klee_open_output_file to return std::unique_ptr
and introduce klee_open_compressed_output_file with similar behavior
along some other minor improvements
Diffstat (limited to 'include')
-rw-r--r--include/klee/Internal/Support/CompressionStream.h8
-rw-r--r--include/klee/Internal/Support/FileHandling.h18
-rw-r--r--include/klee/Interpreter.h10
3 files changed, 22 insertions, 14 deletions
diff --git a/include/klee/Internal/Support/CompressionStream.h b/include/klee/Internal/Support/CompressionStream.h
index fda68d89..bc9119dd 100644
--- a/include/klee/Internal/Support/CompressionStream.h
+++ b/include/klee/Internal/Support/CompressionStream.h
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef INCLUDE_KLEE_INTERNAL_SUPPORT_COMPRESSIONSTREAM_H_
-#define INCLUDE_KLEE_INTERNAL_SUPPORT_COMPRESSIONSTREAM_H_
+#ifndef KLEE_COMPRESSIONSTREAM_H
+#define KLEE_COMPRESSIONSTREAM_H
 
 #include "llvm/Support/raw_ostream.h"
 #include "zlib.h"
@@ -37,10 +37,10 @@ public:
   /// should be immediately destroyed; the string will be empty if no error
   /// occurred. This allows optional flags to control how the file will be
   /// opened.
-  compressed_fd_ostream(const char *Filename, std::string &ErrorInfo);
+  compressed_fd_ostream(const std::string &Filename, std::string &ErrorInfo);
 
   ~compressed_fd_ostream();
 };
 }
 
-#endif /* INCLUDE_KLEE_INTERNAL_SUPPORT_COMPRESSIONSTREAM_H_ */
+#endif /* KLEE_COMPRESSIONSTREAM_H */
diff --git a/include/klee/Internal/Support/FileHandling.h b/include/klee/Internal/Support/FileHandling.h
index bee06b9b..90ce20b3 100644
--- a/include/klee/Internal/Support/FileHandling.h
+++ b/include/klee/Internal/Support/FileHandling.h
@@ -6,14 +6,22 @@
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-#ifndef __KLEE_FILE_HANDLING_H__
-#define __KLEE_FILE_HANDLING_H__
+
+#ifndef KLEE_FILEHANDLING_H
+#define KLEE_FILEHANDLING_H
+
 #include "llvm/Support/raw_ostream.h"
+#include <memory>
 #include <string>
 
 namespace klee {
-llvm::raw_fd_ostream *klee_open_output_file(std::string &path,
-                                            std::string &error);
-}
+std::unique_ptr<llvm::raw_fd_ostream>
+klee_open_output_file(const std::string &path, std::string &error);
 
+#ifdef HAVE_ZLIB_H
+std::unique_ptr<llvm::raw_ostream>
+klee_open_compressed_output_file(const std::string &path, std::string &error);
 #endif
+} // namespace klee
+
+#endif /* KLEE_FILEHANDLING_H */
diff --git a/include/klee/Interpreter.h b/include/klee/Interpreter.h
index 4d8a580c..a88814c9 100644
--- a/include/klee/Interpreter.h
+++ b/include/klee/Interpreter.h
@@ -38,12 +38,12 @@ public:
   virtual llvm::raw_ostream &getInfoStream() const = 0;
 
   virtual std::string getOutputFilename(const std::string &filename) = 0;
-  virtual llvm::raw_fd_ostream *openOutputFile(const std::string &filename) = 0;
+  virtual std::unique_ptr<llvm::raw_fd_ostream> openOutputFile(const std::string &filename) = 0;
 
   virtual void incPathsExplored() = 0;
 
   virtual void processTestCase(const ExecutionState &state,
-                               const char *err, 
+                               const char *err,
                                const char *suffix) = 0;
 };
 
@@ -147,13 +147,13 @@ public:
   virtual unsigned getPathStreamID(const ExecutionState &state) = 0;
 
   virtual unsigned getSymbolicPathStreamID(const ExecutionState &state) = 0;
-  
+
   virtual void getConstraintLog(const ExecutionState &state,
                                 std::string &res,
                                 LogType logFormat = STP) = 0;
 
-  virtual bool getSymbolicSolution(const ExecutionState &state, 
-                                   std::vector< 
+  virtual bool getSymbolicSolution(const ExecutionState &state,
+                                   std::vector<
                                    std::pair<std::string,
                                    std::vector<unsigned char> > >
                                    &res) = 0;