diff options
-rw-r--r-- | include/klee/Internal/Module/KInstruction.h | 3 | ||||
-rw-r--r-- | lib/Module/KInstruction.cpp | 14 |
2 files changed, 13 insertions, 4 deletions
diff --git a/include/klee/Internal/Module/KInstruction.h b/include/klee/Internal/Module/KInstruction.h index 1cad98fd..98e4e3d0 100644 --- a/include/klee/Internal/Module/KInstruction.h +++ b/include/klee/Internal/Module/KInstruction.h @@ -44,7 +44,8 @@ namespace klee { public: virtual ~KInstruction(); - void printFileLine(llvm::raw_ostream &); + void printFileLine(llvm::raw_ostream &) const; + std::string printFileLine() const; }; 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(); } |