about summary refs log tree commit diff homepage
path: root/lib/Core/StatsTracker.cpp
diff options
context:
space:
mode:
authorMartinNowack <martin.nowack@gmail.com>2014-05-30 00:09:00 +0200
committerMartinNowack <martin.nowack@gmail.com>2014-05-30 00:09:00 +0200
commit15470d2661900bae90ac457dd60694a4f4f7ec3c (patch)
treea3b45da7700f765408b1236eeefd4d1ec01e22bb /lib/Core/StatsTracker.cpp
parentc2dec441f3f89916962175f0307b5c33473fa616 (diff)
parenteaac527a2821c41aa88c8767fd0305f9d610fb23 (diff)
downloadklee-15470d2661900bae90ac457dd60694a4f4f7ec3c.tar.gz
Merge pull request #117 from MartinNowack/llvm_raw_ostream
Refactor std::ostreams to llvm::raw_ostream and minor cleanups
Diffstat (limited to 'lib/Core/StatsTracker.cpp')
-rw-r--r--lib/Core/StatsTracker.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp
index 4709a5bc..0946d2ba 100644
--- a/lib/Core/StatsTracker.cpp
+++ b/lib/Core/StatsTracker.cpp
@@ -46,12 +46,10 @@
 #endif
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/CFG.h"
-#include "llvm/Support/raw_os_ostream.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/FileSystem.h"
 
-#include <iostream>
 #include <fstream>
 #include <unistd.h>
 
@@ -432,11 +430,12 @@ void StatsTracker::updateStateStatistics(uint64_t addend) {
 void StatsTracker::writeIStats() {
   Module *m = executor.kmodule->module;
   uint64_t istatsMask = 0;
-  std::ostream &of = *istatsFile;
+  llvm::raw_fd_ostream &of = *istatsFile;
   
-  of.seekp(0, std::ios::end);
-  unsigned istatsSize = of.tellp();
-  of.seekp(0);
+  // We assume that we didn't move the file pointer
+  unsigned istatsSize = of.tell();
+
+  of.seek(0);
 
   of << "version: 1\n";
   of << "creator: klee\n";
@@ -564,7 +563,7 @@ void StatsTracker::writeIStats() {
     updateStateStatistics((uint64_t)-1);
   
   // Clear then end of the file if necessary (no truncate op?).
-  unsigned pos = of.tellp();
+  unsigned pos = of.tell();
   for (unsigned i=pos; i<istatsSize; ++i)
     of << '\n';