summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2012-08-09 13:48:37 +0000
committerMorgan Deters <mdeters@gmail.com>2012-08-09 13:48:37 +0000
commitecdd09877ecc4c07a22cc27cd2dd5441134476ba (patch)
tree31360d8a02df358db3a15a2cb463dfee2fae4d98 /src
parent2a8c2250a4cf3cd2c5d806678c31a1c98f72323d (diff)
minor isConst()-related fixes to printing; also add some debugging stuff to see how isConst() operates: use -d isConst
Diffstat (limited to 'src')
-rw-r--r--src/expr/node.h6
-rw-r--r--src/printer/dagification_visitor.cpp4
-rw-r--r--src/printer/smt2/smt2_printer.cpp2
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 <bool ref_count>
inline bool
NodeTemplate<ref_count>::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<ref_count>::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<ref_count>* >(this)->setAttribute(IsConstAttr(), bval);
const_cast< NodeTemplate<ref_count>* >(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<TypeConstant>()) {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback