From 1af37be2fb7b874620a1f748e715ba4e75029ca0 Mon Sep 17 00:00:00 2001 From: Cristian Cadar Date: Tue, 25 Jul 2017 18:47:28 +0100 Subject: Added another variant of printFileLine in KInstruction that returns the location as a string. Also added const qualifier to the printFileLine functions --- lib/Module/KInstruction.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/Module') 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 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(); } -- cgit 1.4.1