From ecdd09877ecc4c07a22cc27cd2dd5441134476ba Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Thu, 9 Aug 2012 13:48:37 +0000 Subject: [PATCH] minor isConst()-related fixes to printing; also add some debugging stuff to see how isConst() operates: use -d isConst --- src/expr/node.h | 6 +++--- src/printer/dagification_visitor.cpp | 4 ++-- src/printer/smt2/smt2_printer.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/expr/node.h b/src/expr/node.h index b5186f2ed..0ce042654 100644 --- a/src/expr/node.h +++ b/src/expr/node.h @@ -1271,7 +1271,7 @@ template inline bool NodeTemplate::isConst() const { assertTNodeNotExpired(); - Debug("isConst") << "Node::isConst() for " << getKind() << " with " << getNumChildren() << " children" << std::endl; + Debug("isConst") << "Node::isConst() for: " << *this << std::endl; if(isNull()) { return false; } @@ -1285,11 +1285,11 @@ NodeTemplate::isConst() const { default: if(getAttribute(IsConstComputedAttr())) { bool bval = getAttribute(IsConstAttr()); - Debug("isConst") << "Node::isConst() returning cached value " << bval << std::endl; + Debug("isConst") << "Node::isConst() returning cached value " << (bval ? "true" : "false") << " for: " << *this << std::endl; return bval; } else { bool bval = expr::TypeChecker::computeIsConst(NodeManager::currentNM(), *this); - Debug("isConst") << "Node::isConst() computed value " << bval << std::endl; + Debug("isConst") << "Node::isConst() computed value " << (bval ? "true" : "false") << " for: " << *this << std::endl; const_cast< NodeTemplate* >(this)->setAttribute(IsConstAttr(), bval); const_cast< NodeTemplate* >(this)->setAttribute(IsConstComputedAttr(), true); return bval; diff --git a/src/printer/dagification_visitor.cpp b/src/printer/dagification_visitor.cpp index 580bec63c..f22b35152 100644 --- a/src/printer/dagification_visitor.cpp +++ b/src/printer/dagification_visitor.cpp @@ -54,11 +54,11 @@ bool DagificationVisitor::alreadyVisited(TNode current, TNode parent) { // for all subexpressions, so it isn't useful to traverse and // increment again (they'll be dagified anyway). return current.isVar() || - current.isConst() || + current.getMetaKind() == kind::metakind::CONSTANT || ( ( current.getKind() == kind::NOT || current.getKind() == kind::UMINUS ) && ( current[0].isVar() || - current[0].isConst() ) ) || + current[0].getMetaKind() == kind::metakind::CONSTANT ) ) || current.getKind() == kind::SORT_TYPE || d_nodeCount[current] > d_threshold; } diff --git a/src/printer/smt2/smt2_printer.cpp b/src/printer/smt2/smt2_printer.cpp index dcb37d3d9..ef8c8fcbc 100644 --- a/src/printer/smt2/smt2_printer.cpp +++ b/src/printer/smt2/smt2_printer.cpp @@ -102,7 +102,7 @@ void Smt2Printer::toStream(std::ostream& out, TNode n, } // constant - if(n.isConst()) { + if(n.getMetaKind() == kind::metakind::CONSTANT) { switch(n.getKind()) { case kind::TYPE_CONSTANT: switch(n.getConst()) { -- 2.30.2