From 833de7329bc821aacf0ff63b053ae64f12f4bb12 Mon Sep 17 00:00:00 2001 From: Cristian Cadar Date: Mon, 11 Mar 2019 14:08:47 +0000 Subject: Documented options in ExprPPrinter.cpp and placed them into a new option category for building and printing expressions --- lib/Expr/Expr.cpp | 16 +++++++++++----- lib/Expr/ExprPPrinter.cpp | 48 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 44 insertions(+), 20 deletions(-) (limited to 'lib') diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp index 65e858c3..e6385136 100644 --- a/lib/Expr/Expr.cpp +++ b/lib/Expr/Expr.cpp @@ -8,22 +8,28 @@ //===----------------------------------------------------------------------===// #include "klee/Expr.h" -#include "klee/Config/Version.h" -#include "llvm/ADT/Hashing.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/raw_ostream.h" +#include "klee/Config/Version.h" // FIXME: We shouldn't need this once fast constant support moves into // Core. If we need to do arithmetic, we probably want to use APInt. #include "klee/Internal/Support/IntEvaluation.h" - #include "klee/util/ExprPPrinter.h" +#include "llvm/ADT/Hashing.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/raw_ostream.h" + #include using namespace klee; using namespace llvm; +namespace klee { +llvm::cl::OptionCategory + ExprCat("Expression building and printing options", + "These options impact the way expressions are build and printed."); +} + namespace { cl::opt ConstArrayOpt("const-array-opt", diff --git a/lib/Expr/ExprPPrinter.cpp b/lib/Expr/ExprPPrinter.cpp index 58b8de7c..114c46b4 100644 --- a/lib/Expr/ExprPPrinter.cpp +++ b/lib/Expr/ExprPPrinter.cpp @@ -7,10 +7,11 @@ // //===----------------------------------------------------------------------===// -#include "klee/util/PrintContext.h" #include "klee/util/ExprPPrinter.h" #include "klee/Constraints.h" +#include "klee/OptionCategories.h" +#include "klee/util/PrintContext.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/raw_ostream.h" @@ -21,21 +22,38 @@ using namespace klee; namespace { - llvm::cl::opt - PCWidthAsArg("pc-width-as-arg", llvm::cl::init(true)); - - llvm::cl::opt - PCAllWidths("pc-all-widths", llvm::cl::init(false)); - llvm::cl::opt - PCPrefixWidth("pc-prefix-width", llvm::cl::init(true)); - - llvm::cl::opt - PCMultibyteReads("pc-multibyte-reads", llvm::cl::init(true)); - - llvm::cl::opt - PCAllConstWidths("pc-all-const-widths", llvm::cl::init(false)); -} +llvm::cl::opt PCWidthAsArg( + "pc-width-as-arg", llvm::cl::init(true), + llvm::cl::desc( + "Print the width as a separate argument, as opposed to a prefix " + "to the operation (default=true)"), + llvm::cl::cat(klee::ExprCat)); + +llvm::cl::opt + PCAllWidths("pc-all-widths", llvm::cl::init(false), + llvm::cl::desc("Print the width of all operations, including " + "booleans (default=false)"), + llvm::cl::cat(klee::ExprCat)); + +llvm::cl::opt + PCPrefixWidth("pc-prefix-width", llvm::cl::init(true), + llvm::cl::desc("Print width with 'w' prefix (default=true)"), + llvm::cl::cat(klee::ExprCat)); + +llvm::cl::opt + PCMultibyteReads("pc-multibyte-reads", llvm::cl::init(true), + llvm::cl::desc("Print ReadLSB and ReadMSB expressions " + "when possible (default=true)"), + llvm::cl::cat(klee::ExprCat)); + +llvm::cl::opt PCAllConstWidths( + "pc-all-const-widths", llvm::cl::init(false), + llvm::cl::desc( + "Always print the width of constant expressions (default=false)"), + llvm::cl::cat(klee::ExprCat)); + +} // namespace class PPrinter : public ExprPPrinter { public: -- cgit 1.4.1