Commit b20d70d6 authored by Daniel Liew's avatar Daniel Liew
Browse files

Added support for printing ref<Expr> to llvm::raw_ostream

parent 3d2b9eab
......@@ -17,10 +17,12 @@
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/raw_ostream.h"
#include <set>
#include <vector>
#include <iosfwd> // FIXME: Remove this!!!
#include <sstream> // For llvm::raw_ostream hack
namespace llvm {
class Type;
......@@ -355,6 +357,24 @@ inline std::ostream &operator<<(std::ostream &os, const Expr::Kind kind) {
return os;
}
inline llvm::raw_ostream& operator<<(llvm::raw_ostream& ros, const Expr &e){
// This is a hack. I do not want to template Expr to support
// llvm::raw_ostream so this will have to do!
std::ostringstream ss;
ss << e;
ros << ss.str();
return ros;
}
inline llvm::raw_ostream& operator<<(llvm::raw_ostream& ros, const Expr::Kind kind){
// This is a hack. I do not want to template Expr to support
// llvm::raw_ostream so this will have to do!
std::ostringstream ss;
ss << kind;
ros << ss.str();
return ros;
}
// Terminal Exprs
class ConstantExpr : public Expr {
......
......@@ -11,6 +11,7 @@
#define KLEE_REF_H
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
using llvm::isa;
using llvm::cast;
using llvm::cast_or_null;
......@@ -113,6 +114,12 @@ inline std::ostream &operator<<(std::ostream &os, const ref<T> &e) {
return os;
}
template<class T>
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const ref<T> &e) {
os << *e;
return os;
}
} // end namespace klee
namespace llvm {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment