From d934d983692c8952cdb887cbcd59f2df0001b9c0 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Thu, 29 May 2014 23:15:59 +0200 Subject: Refactoring from std::ostream to llvm::raw_ostream According to LLVM: lightweight and simpler implementation of streams. --- include/klee/ExecutionState.h | 4 ++-- include/klee/Expr.h | 30 ++++++++++++++++++++++++------ include/klee/Interpreter.h | 6 ++++-- include/klee/util/ExprPPrinter.h | 13 ++++++++----- include/klee/util/ExprSMTLIBPrinter.h | 11 +++++++---- include/klee/util/PrintContext.h | 16 ++++++++-------- include/klee/util/Ref.h | 12 +++++++++++- 7 files changed, 64 insertions(+), 28 deletions(-) (limited to 'include') diff --git a/include/klee/ExecutionState.h b/include/klee/ExecutionState.h index 720488cc..824fbed5 100644 --- a/include/klee/ExecutionState.h +++ b/include/klee/ExecutionState.h @@ -32,7 +32,7 @@ namespace klee { class PTreeNode; struct InstructionInfo; -std::ostream &operator<<(std::ostream &os, const MemoryMap &mm); +llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const MemoryMap &mm); struct StackFrame { KInstIterator caller; @@ -137,7 +137,7 @@ public: } bool merge(const ExecutionState &b); - void dumpStack(std::ostream &out) const; + void dumpStack(llvm::raw_ostream &out) const; }; } diff --git a/include/klee/Expr.h b/include/klee/Expr.h index a302591a..ae5bfd2b 100644 --- a/include/klee/Expr.h +++ b/include/klee/Expr.h @@ -17,13 +17,15 @@ #include "llvm/ADT/APFloat.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Support/raw_ostream.h" +#include #include #include -#include // FIXME: Remove this!!! namespace llvm { class Type; + class raw_ostream; } namespace klee { @@ -181,7 +183,7 @@ public: virtual unsigned getNumKids() const = 0; virtual ref getKid(unsigned i) const = 0; - virtual void print(std::ostream &os) const; + virtual void print(llvm::raw_ostream &os) const; /// dump - Print the expression to stderr. void dump() const; @@ -221,8 +223,8 @@ public: /* Static utility methods */ - static void printKind(std::ostream &os, Kind k); - static void printWidth(std::ostream &os, Expr::Width w); + static void printKind(llvm::raw_ostream &os, Kind k); + static void printWidth(llvm::raw_ostream &os, Expr::Width w); /// returns the smallest number of bytes in which the given width fits static inline unsigned getMinBytesForWidth(Width w) { @@ -291,16 +293,32 @@ inline bool operator>=(const Expr &lhs, const Expr &rhs) { // Printing operators -inline std::ostream &operator<<(std::ostream &os, const Expr &e) { +inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Expr &e) { e.print(os); return os; } -inline std::ostream &operator<<(std::ostream &os, const Expr::Kind kind) { +inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Expr::Kind kind) { Expr::printKind(os, kind); return os; } +inline std::stringstream &operator<<(std::stringstream &os, const Expr &e) { + std::string str; + llvm::raw_string_ostream TmpStr(str); + e.print(TmpStr); + os << TmpStr.str(); + return os; +} + +inline std::stringstream &operator<<(std::stringstream &os, const Expr::Kind kind) { + std::string str; + llvm::raw_string_ostream TmpStr(str); + Expr::printKind(TmpStr, kind); + os << TmpStr.str(); + return os; +} + // Terminal Exprs class ConstantExpr : public Expr { diff --git a/include/klee/Interpreter.h b/include/klee/Interpreter.h index e93284d6..abd454b1 100644 --- a/include/klee/Interpreter.h +++ b/include/klee/Interpreter.h @@ -19,6 +19,8 @@ struct KTest; namespace llvm { class Function; class Module; +class raw_ostream; +class raw_fd_ostream; } namespace klee { @@ -31,10 +33,10 @@ public: InterpreterHandler() {} virtual ~InterpreterHandler() {} - virtual std::ostream &getInfoStream() const = 0; + virtual llvm::raw_ostream &getInfoStream() const = 0; virtual std::string getOutputFilename(const std::string &filename) = 0; - virtual std::ostream *openOutputFile(const std::string &filename) = 0; + virtual llvm::raw_fd_ostream *openOutputFile(const std::string &filename) = 0; virtual void incPathsExplored() = 0; diff --git a/include/klee/util/ExprPPrinter.h b/include/klee/util/ExprPPrinter.h index cf4ebb18..622b0e80 100644 --- a/include/klee/util/ExprPPrinter.h +++ b/include/klee/util/ExprPPrinter.h @@ -12,6 +12,9 @@ #include "klee/Expr.h" +namespace llvm { + class raw_ostream; +} namespace klee { class ConstraintManager; @@ -20,7 +23,7 @@ namespace klee { ExprPPrinter() {} public: - static ExprPPrinter *create(std::ostream &os); + static ExprPPrinter *create(llvm::raw_ostream &os); virtual ~ExprPPrinter() {} @@ -45,7 +48,7 @@ namespace klee { /// printOne - Pretty print a single expression prefixed by a /// message and followed by a line break. - static void printOne(std::ostream &os, const char *message, + static void printOne(llvm::raw_ostream &os, const char *message, const ref &e); /// printSingleExpr - Pretty print a single expression. @@ -55,12 +58,12 @@ namespace klee { /// Note that if the output stream is not positioned at the /// beginning of a line then printing will not resume at the /// correct position following any output line breaks. - static void printSingleExpr(std::ostream &os, const ref &e); + static void printSingleExpr(llvm::raw_ostream &os, const ref &e); - static void printConstraints(std::ostream &os, + static void printConstraints(llvm::raw_ostream &os, const ConstraintManager &constraints); - static void printQuery(std::ostream &os, + static void printQuery(llvm::raw_ostream &os, const ConstraintManager &constraints, const ref &q, const ref *evalExprsBegin = 0, diff --git a/include/klee/util/ExprSMTLIBPrinter.h b/include/klee/util/ExprSMTLIBPrinter.h index 42f38007..8b072242 100644 --- a/include/klee/util/ExprSMTLIBPrinter.h +++ b/include/klee/util/ExprSMTLIBPrinter.h @@ -11,7 +11,6 @@ #ifndef KLEE_EXPRSMTLIBPRINTER_H #define KLEE_EXPRSMTLIBPRINTER_H -#include #include #include #include @@ -20,6 +19,10 @@ #include #include +namespace llvm { +class raw_ostream; +} + namespace klee { /// Base Class for SMTLIBv2 printer for KLEE Queries. It uses the QF_ABV logic. @@ -121,7 +124,7 @@ public: /// Set the output stream that will be printed to. /// This call is persistent across queries. - void setOutput(std::ostream &output); + void setOutput(llvm::raw_ostream &output); /// Set the query to print. This will setArrayValuesToGet() /// to none (i.e. no array values will be requested using @@ -130,7 +133,7 @@ public: virtual ~ExprSMTLIBPrinter(); - /// Print the query to the std::ostream + /// Print the query to the llvm::raw_ostream /// setOutput() and setQuery() must be called before calling this. /// /// All options should be set before calling this. @@ -202,7 +205,7 @@ protected: std::set usedArrays; /// Output stream to write to - std::ostream *o; + llvm::raw_ostream *o; /// The query to print const Query *query; diff --git a/include/klee/util/PrintContext.h b/include/klee/util/PrintContext.h index a9e91925..6b1ef77a 100644 --- a/include/klee/util/PrintContext.h +++ b/include/klee/util/PrintContext.h @@ -1,14 +1,14 @@ #ifndef PRINTCONTEXT_H_ #define PRINTCONTEXT_H_ -#include +#include "klee/Expr.h" +#include "llvm/Support/raw_ostream.h" #include #include #include -#include /// PrintContext - Helper class for pretty printing. -/// It provides a basic wrapper around std::ostream that keeps track of +/// It provides a basic wrapper around llvm::raw_ostream that keeps track of /// how many characters have been used on the current line. /// /// It also provides an optional way keeping track of the various levels of indentation @@ -16,8 +16,7 @@ /// \sa breakLineI() , \sa pushIndent(), \sa popIndent() class PrintContext { private: - std::ostream &os; - std::stringstream ss; + llvm::raw_ostream &os; std::string newline; ///This is used to keep track of the stack of indentations used by @@ -30,7 +29,7 @@ public: /// Number of characters on the current line. unsigned pos; - PrintContext(std::ostream &_os) : os(_os), newline("\n"), indentStack(), pos() + PrintContext(llvm::raw_ostream &_os) : os(_os), newline("\n"), indentStack(), pos() { indentStack.push(pos); } @@ -42,7 +41,7 @@ public: void breakLine(unsigned indent=0) { os << newline; if (indent) - os << std::setw(indent) << ' '; + os.indent(indent) << ' '; pos = indent; } @@ -79,7 +78,8 @@ public: template PrintContext &operator<<(T elt) { - ss.str(""); + std::string str; + llvm::raw_string_ostream ss(str); ss << elt; write(ss.str()); return *this; diff --git a/include/klee/util/Ref.h b/include/klee/util/Ref.h index d14de471..c77149aa 100644 --- a/include/klee/util/Ref.h +++ b/include/klee/util/Ref.h @@ -20,6 +20,10 @@ using llvm::dyn_cast_or_null; #include #include // FIXME: Remove this!!! +namespace llvm { + class raw_ostream; +} + namespace klee { template @@ -107,7 +111,13 @@ public: }; template -inline std::ostream &operator<<(std::ostream &os, const ref &e) { +inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const ref &e) { + os << *e; + return os; +} + +template +inline std::stringstream &operator<<(std::stringstream &os, const ref &e) { os << *e; return os; } -- cgit 1.4.1 From 3b35ffed89405e7ba3059664dfbdc165b5d8625d Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Thu, 29 May 2014 23:21:33 +0200 Subject: Remove #include to avoid static constructors iostream injects static constructor function into every compilation unit. Remove this to avoid it. --- include/klee/Internal/ADT/TreeStream.h | 1 - lib/Core/ExecutorUtil.cpp | 1 - lib/Core/ExternalDispatcher.cpp | 1 - lib/Core/ImpliedValue.cpp | 1 - lib/Core/Memory.cpp | 1 - lib/Core/PTree.cpp | 1 - lib/Core/PTree.h | 4 ---- lib/Core/Searcher.h | 4 +--- lib/Core/SpecialFunctionHandler.cpp | 5 +++-- lib/Core/StatsTracker.cpp | 2 -- lib/Core/StatsTracker.h | 1 - lib/Expr/Constraints.cpp | 1 - lib/Expr/Expr.cpp | 1 - lib/Expr/ExprPPrinter.cpp | 3 --- lib/Expr/ExprSMTLIBLetPrinter.cpp | 2 +- lib/Expr/ExprSMTLIBPrinter.cpp | 2 -- lib/Expr/Lexer.cpp | 1 - lib/Expr/Parser.cpp | 1 - lib/Module/Checks.cpp | 1 - lib/Module/ModuleUtil.cpp | 2 -- lib/Module/Optimize.cpp | 1 - lib/SMT/SMTParser.cpp | 1 - lib/SMT/SMTParser.h | 2 -- lib/SMT/main.cpp | 1 - lib/Solver/FastCexSolver.cpp | 1 - lib/Solver/IndependentSolver.cpp | 1 - lib/Solver/STPBuilder.cpp | 1 - lib/Solver/Solver.cpp | 1 - lib/Support/TreeStream.cpp | 1 - tools/kleaver/main.cpp | 2 -- tools/klee/Debug.cpp | 1 - tools/klee/main.cpp | 1 - 32 files changed, 5 insertions(+), 45 deletions(-) (limited to 'include') diff --git a/include/klee/Internal/ADT/TreeStream.h b/include/klee/Internal/ADT/TreeStream.h index 63e49dbb..1494aa76 100644 --- a/include/klee/Internal/ADT/TreeStream.h +++ b/include/klee/Internal/ADT/TreeStream.h @@ -11,7 +11,6 @@ #define __UTIL_TREESTREAM_H__ #include -#include #include namespace klee { diff --git a/lib/Core/ExecutorUtil.cpp b/lib/Core/ExecutorUtil.cpp index 79d1707e..f6b3dd5e 100644 --- a/lib/Core/ExecutorUtil.cpp +++ b/lib/Core/ExecutorUtil.cpp @@ -41,7 +41,6 @@ #include "llvm/Support/CallSite.h" -#include #include using namespace klee; diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp index bbe1c42e..4c1e2b86 100644 --- a/lib/Core/ExternalDispatcher.cpp +++ b/lib/Core/ExternalDispatcher.cpp @@ -42,7 +42,6 @@ #endif #include #include -#include using namespace llvm; using namespace klee; diff --git a/lib/Core/ImpliedValue.cpp b/lib/Core/ImpliedValue.cpp index f20259fb..c8342df1 100644 --- a/lib/Core/ImpliedValue.cpp +++ b/lib/Core/ImpliedValue.cpp @@ -18,7 +18,6 @@ #include "klee/util/ExprUtil.h" -#include #include #include diff --git a/lib/Core/Memory.cpp b/lib/Core/Memory.cpp index 7f5d024e..b6f225d1 100644 --- a/lib/Core/Memory.cpp +++ b/lib/Core/Memory.cpp @@ -32,7 +32,6 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/raw_ostream.h" -#include #include #include diff --git a/lib/Core/PTree.cpp b/lib/Core/PTree.cpp index a435cd5e..f0e7ab51 100644 --- a/lib/Core/PTree.cpp +++ b/lib/Core/PTree.cpp @@ -13,7 +13,6 @@ #include #include -#include using namespace klee; diff --git a/lib/Core/PTree.h b/lib/Core/PTree.h index 2ac688bd..11d3f48c 100644 --- a/lib/Core/PTree.h +++ b/lib/Core/PTree.h @@ -12,10 +12,6 @@ #include -#include -#include -#include - namespace klee { class ExecutionState; diff --git a/lib/Core/Searcher.h b/lib/Core/Searcher.h index 3c077636..d866f521 100644 --- a/lib/Core/Searcher.h +++ b/lib/Core/Searcher.h @@ -10,14 +10,12 @@ #ifndef KLEE_SEARCHER_H #define KLEE_SEARCHER_H +#include "llvm/Support/raw_ostream.h" #include #include #include #include -// FIXME: Move out of header, use llvm streams. -#include - namespace llvm { class BasicBlock; class Function; diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp index dcba5436..a7a1b32e 100644 --- a/lib/Core/SpecialFunctionHandler.cpp +++ b/lib/Core/SpecialFunctionHandler.cpp @@ -27,6 +27,7 @@ #include "llvm/Module.h" #endif #include "llvm/ADT/Twine.h" +#include "llvm/Support/Debug.h" #include @@ -279,8 +280,8 @@ void SpecialFunctionHandler::handleAliasFunction(ExecutionState &state, "invalid number of arguments to klee_alias_function"); std::string old_fn = readStringAtAddress(state, arguments[0]); std::string new_fn = readStringAtAddress(state, arguments[1]); - DEBUG_WITH_TYPE("alias_handling", errs() << "Replacing " << old_fn - << "() with " << new_fn << "()\n";); + DEBUG_WITH_TYPE("alias_handling", llvm::errs() << "Replacing " << old_fn + << "() with " << new_fn << "()\n"); if (old_fn == new_fn) state.removeFnAlias(old_fn); else state.addFnAlias(old_fn, new_fn); diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp index 4f4552e7..0946d2ba 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp @@ -46,12 +46,10 @@ #endif #include "llvm/Support/CommandLine.h" #include "llvm/Support/CFG.h" -#include "llvm/Support/raw_os_ostream.h" #include "llvm/Support/Process.h" #include "llvm/Support/Path.h" #include "llvm/Support/FileSystem.h" -#include #include #include diff --git a/lib/Core/StatsTracker.h b/lib/Core/StatsTracker.h index f06decdc..629a723d 100644 --- a/lib/Core/StatsTracker.h +++ b/lib/Core/StatsTracker.h @@ -12,7 +12,6 @@ #include "CallPathManager.h" -#include #include namespace llvm { diff --git a/lib/Expr/Constraints.cpp b/lib/Expr/Constraints.cpp index 90d9bcd4..ae4563f4 100644 --- a/lib/Expr/Constraints.cpp +++ b/lib/Expr/Constraints.cpp @@ -19,7 +19,6 @@ #include "llvm/Support/CommandLine.h" #include "klee/Internal/Module/KModule.h" -#include #include using namespace klee; diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp index 14737e8c..d54b8f4d 100644 --- a/lib/Expr/Expr.cpp +++ b/lib/Expr/Expr.cpp @@ -21,7 +21,6 @@ #include "klee/util/ExprPPrinter.h" -#include #include using namespace klee; diff --git a/lib/Expr/ExprPPrinter.cpp b/lib/Expr/ExprPPrinter.cpp index a7ad5ddc..ddcc57a1 100644 --- a/lib/Expr/ExprPPrinter.cpp +++ b/lib/Expr/ExprPPrinter.cpp @@ -17,9 +17,6 @@ #include #include -#include -#include -#include using namespace klee; diff --git a/lib/Expr/ExprSMTLIBLetPrinter.cpp b/lib/Expr/ExprSMTLIBLetPrinter.cpp index 2ea5c4e0..bcdaab32 100644 --- a/lib/Expr/ExprSMTLIBLetPrinter.cpp +++ b/lib/Expr/ExprSMTLIBLetPrinter.cpp @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -#include +#include "llvm/Support/raw_ostream.h" #include "llvm/Support/CommandLine.h" #include "klee/util/ExprSMTLIBLetPrinter.h" diff --git a/lib/Expr/ExprSMTLIBPrinter.cpp b/lib/Expr/ExprSMTLIBPrinter.cpp index 2dbf3634..1cdab762 100644 --- a/lib/Expr/ExprSMTLIBPrinter.cpp +++ b/lib/Expr/ExprSMTLIBPrinter.cpp @@ -7,8 +7,6 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#include - #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" #include "klee/util/ExprSMTLIBPrinter.h" diff --git a/lib/Expr/Lexer.cpp b/lib/Expr/Lexer.cpp index 9859ff36..e250a968 100644 --- a/lib/Expr/Lexer.cpp +++ b/lib/Expr/Lexer.cpp @@ -13,7 +13,6 @@ #include "llvm/Support/raw_ostream.h" #include -#include #include using namespace llvm; diff --git a/lib/Expr/Parser.cpp b/lib/Expr/Parser.cpp index 6b346648..aebce666 100644 --- a/lib/Expr/Parser.cpp +++ b/lib/Expr/Parser.cpp @@ -22,7 +22,6 @@ #include "llvm/Support/raw_ostream.h" #include -#include #include #include diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp index 80b6b245..e1076d43 100644 --- a/lib/Module/Checks.cpp +++ b/lib/Module/Checks.cpp @@ -46,7 +46,6 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Support/CallSite.h" -#include using namespace llvm; using namespace klee; diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp index 4f65d0e7..d00cf574 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp @@ -28,7 +28,6 @@ #include "llvm/Object/ObjectFile.h" #include "llvm/Object/Error.h" #include "llvm/Support/FileSystem.h" -#include "llvm/Support/raw_os_ostream.h" #include "llvm/IR/ValueSymbolTable.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/DataStream.h" @@ -51,7 +50,6 @@ #include #include -#include #include #include #include diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp index 6f060edd..ed1e0e34 100644 --- a/lib/Module/Optimize.cpp +++ b/lib/Module/Optimize.cpp @@ -40,7 +40,6 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Support/PassNameParser.h" #include "llvm/Support/PluginLoader.h" -#include using namespace llvm; #if 0 diff --git a/lib/SMT/SMTParser.cpp b/lib/SMT/SMTParser.cpp index d16e1edb..5622f048 100644 --- a/lib/SMT/SMTParser.cpp +++ b/lib/SMT/SMTParser.cpp @@ -14,7 +14,6 @@ #include "klee/Constraints.h" #include "expr/Parser.h" -#include #include #include #include diff --git a/lib/SMT/SMTParser.h b/lib/SMT/SMTParser.h index fd1ec044..ac84e74c 100644 --- a/lib/SMT/SMTParser.h +++ b/lib/SMT/SMTParser.h @@ -13,8 +13,6 @@ #include "expr/Parser.h" -#include -#include #include #include #include diff --git a/lib/SMT/main.cpp b/lib/SMT/main.cpp index 034c4ce4..6b66e279 100644 --- a/lib/SMT/main.cpp +++ b/lib/SMT/main.cpp @@ -2,7 +2,6 @@ #include "klee/ExprBuilder.h" -#include using namespace std; using namespace klee; diff --git a/lib/Solver/FastCexSolver.cpp b/lib/Solver/FastCexSolver.cpp index a488db2a..5c0cf8d0 100644 --- a/lib/Solver/FastCexSolver.cpp +++ b/lib/Solver/FastCexSolver.cpp @@ -19,7 +19,6 @@ #include "klee/Internal/Support/IntEvaluation.h" #include "llvm/Support/raw_ostream.h" -#include #include #include #include diff --git a/lib/Solver/IndependentSolver.cpp b/lib/Solver/IndependentSolver.cpp index 3c0b9b26..2cb4b2c6 100644 --- a/lib/Solver/IndependentSolver.cpp +++ b/lib/Solver/IndependentSolver.cpp @@ -19,7 +19,6 @@ #include #include #include -#include using namespace klee; using namespace llvm; diff --git a/lib/Solver/STPBuilder.cpp b/lib/Solver/STPBuilder.cpp index e4a21f74..34ce0ede 100644 --- a/lib/Solver/STPBuilder.cpp +++ b/lib/Solver/STPBuilder.cpp @@ -34,7 +34,6 @@ #include // max, min #include -#include #include #include #include diff --git a/lib/Solver/Solver.cpp b/lib/Solver/Solver.cpp index 025c70f2..229fa234 100644 --- a/lib/Solver/Solver.cpp +++ b/lib/Solver/Solver.cpp @@ -771,7 +771,6 @@ static SolverImpl::SolverRunStatus runAndGetCexForked(::VC vc, } } } -#include bool STPSolverImpl::computeInitialValues(const Query &query, const std::vector diff --git a/lib/Support/TreeStream.cpp b/lib/Support/TreeStream.cpp index e95fc582..0d5e4568 100644 --- a/lib/Support/TreeStream.cpp +++ b/lib/Support/TreeStream.cpp @@ -10,7 +10,6 @@ #include "klee/Internal/ADT/TreeStream.h" #include -#include #include #include #include diff --git a/tools/kleaver/main.cpp b/tools/kleaver/main.cpp index e31140e8..b19e2ea6 100644 --- a/tools/kleaver/main.cpp +++ b/tools/kleaver/main.cpp @@ -1,5 +1,3 @@ -#include - #include "expr/Lexer.h" #include "expr/Parser.h" diff --git a/tools/klee/Debug.cpp b/tools/klee/Debug.cpp index ad264045..fbabed9d 100644 --- a/tools/klee/Debug.cpp +++ b/tools/klee/Debug.cpp @@ -1,5 +1,4 @@ #include -#include void kdb_printExpr(klee::Expr *e) { llvm::errs() << "expr: " << e << " -- "; diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp index 6abb1569..0292376c 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -62,7 +62,6 @@ #include #include #include -#include #include #include -- cgit 1.4.1 From eaac527a2821c41aa88c8767fd0305f9d610fb23 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Wed, 28 May 2014 22:35:45 +0200 Subject: Fix ExprTest under LLVM 2.9 --- include/klee/Expr.h | 3 +++ unittests/Expr/Makefile | 1 + 2 files changed, 4 insertions(+) (limited to 'include') diff --git a/include/klee/Expr.h b/include/klee/Expr.h index ae5bfd2b..c78cd690 100644 --- a/include/klee/Expr.h +++ b/include/klee/Expr.h @@ -298,10 +298,13 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Expr &e) { return os; } +// XXX the following macro is to work around the ExprTest unit test compile error +#ifndef LLVM_29_UNITTEST inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Expr::Kind kind) { Expr::printKind(os, kind); return os; } +#endif inline std::stringstream &operator<<(std::stringstream &os, const Expr &e) { std::string str; diff --git a/unittests/Expr/Makefile b/unittests/Expr/Makefile index f1cd4ec4..a9bfeda1 100644 --- a/unittests/Expr/Makefile +++ b/unittests/Expr/Makefile @@ -9,4 +9,5 @@ LINK_COMPONENTS := support include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest +CXXFLAGS += -DLLVM_29_UNITTEST LIBS += -lstp -- cgit 1.4.1