about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDan Liew <delcypher@gmail.com>2014-04-04 21:19:24 +0100
committerDan Liew <delcypher@gmail.com>2014-04-04 21:19:24 +0100
commit237899d2fe681e5ea70baef5104c43feba87dea2 (patch)
tree814de114097bf214bcb9e7683481c9fd2aafd9d2
parentb3d9f1469b66e5409b1b6e8cbaca91d16e802761 (diff)
parente3b58660760830e774eff283f957ac5abb8a9b47 (diff)
downloadklee-237899d2fe681e5ea70baef5104c43feba87dea2.tar.gz
Merge pull request #108 from pcc/pp
Add the ability to control whether the pretty printer uses line breaks
-rw-r--r--include/klee/util/ExprPPrinter.h1
-rw-r--r--lib/Expr/ExprPPrinter.cpp8
2 files changed, 8 insertions, 1 deletions
diff --git a/include/klee/util/ExprPPrinter.h b/include/klee/util/ExprPPrinter.h
index 4d1930d8..cf4ebb18 100644
--- a/include/klee/util/ExprPPrinter.h
+++ b/include/klee/util/ExprPPrinter.h
@@ -25,6 +25,7 @@ namespace klee {
     virtual ~ExprPPrinter() {}
 
     virtual void setNewline(const std::string &newline) = 0;
+    virtual void setForceNoLineBreaks(bool forceNoLineBreaks) = 0;
     virtual void reset() = 0;
     virtual void scan(const ref<Expr> &e) = 0;
     virtual void print(const ref<Expr> &e, unsigned indent=0) = 0;
diff --git a/lib/Expr/ExprPPrinter.cpp b/lib/Expr/ExprPPrinter.cpp
index ac1d1d01..d58358b5 100644
--- a/lib/Expr/ExprPPrinter.cpp
+++ b/lib/Expr/ExprPPrinter.cpp
@@ -51,6 +51,7 @@ private:
   unsigned counter;
   unsigned updateCounter;
   bool hasScan;
+  bool forceNoLineBreaks;
   std::string newline;
 
   /// shouldPrintWidth - Predicate for whether this expression should
@@ -307,10 +308,15 @@ public:
     newline = _newline;
   }
 
+  void setForceNoLineBreaks(bool _forceNoLineBreaks) {
+    forceNoLineBreaks = _forceNoLineBreaks;
+  }
+
   void reset() {
     counter = 0;
     updateCounter = 0;
     hasScan = false;
+    forceNoLineBreaks = false;
     bindings.clear();
     updateBindings.clear();
     couldPrint.clear();
@@ -412,7 +418,7 @@ public:
   /* Public utility functions */
 
   void printSeparator(PrintContext &PC, bool simple, unsigned indent) {
-    if (simple) {
+    if (simple || forceNoLineBreaks) {
       PC << ' ';
     } else {
       PC.breakLine(indent);