aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2017-07-25 18:47:28 +0100
committerDan Liew <delcypher@gmail.com>2017-07-29 12:54:14 +0100
commit1af37be2fb7b874620a1f748e715ba4e75029ca0 (patch)
tree05d50e7fe9ebb4676d01c396a562a3cebf210474 /lib
parent6dda95ed80dd9a91428eb8f8c7ae12c86627bccc (diff)
downloadklee-1af37be2fb7b874620a1f748e715ba4e75029ca0.tar.gz
Added another variant of printFileLine in KInstruction that returns the location as a string. Also added const qualifier to the printFileLine functions
Diffstat (limited to 'lib')
-rw-r--r--lib/Module/KInstruction.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Module/KInstruction.cpp b/lib/Module/KInstruction.cpp
index a32745b8..d1e6c470 100644
--- a/lib/Module/KInstruction.cpp
+++ b/lib/Module/KInstruction.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
#include "klee/Internal/Module/KInstruction.h"
+#include "llvm/Support/raw_ostream.h"
+#include <string>
using namespace llvm;
using namespace klee;
@@ -18,9 +20,15 @@ KInstruction::~KInstruction() {
delete[] operands;
}
-void KInstruction::printFileLine(llvm::raw_ostream &debugFile) {
+void KInstruction::printFileLine(llvm::raw_ostream &debugFile) const {
if (info->file != "")
debugFile << info->file << ":" << info->line;
- else
- debugFile << "[no debug info]";
+ else debugFile << "[no debug info]";
+}
+
+std::string KInstruction::printFileLine() const {
+ std::string str;
+ llvm::raw_string_ostream oss(str);
+ printFileLine(oss);
+ return oss.str();
}