summaryrefslogtreecommitdiff
path: root/src/expr/node_manager.cpp
diff options
context:
space:
mode:
authorKshitij Bansal <kshitij@cs.nyu.edu>2014-04-17 13:03:30 -0400
committerKshitij Bansal <kshitij@cs.nyu.edu>2014-04-17 13:40:15 -0400
commitf26477575d4328104ee6882c5d7d55740964543d (patch)
tree8dc248031d8cc213762f0fa30ff13a7b8f851984 /src/expr/node_manager.cpp
parent4b02944c70522de78713f9870d2eccbf348bfcf6 (diff)
simplify mkSkolem naming system: don't use $$
Short summary: By default NODEID is appeneded, just continue doing what you were, just don't add the _$$ at the end. Long summary: Before this commit there were four (yes!) ways to specify the names for new skolems, which result in names as given below 1) mkSkolem("name", ..., SKOLEM_FLAG_DEFAULT) -> "name_NODEID" 2) mkSkolem("name", ..., SKOLEM_EXACT_NAME) -> "name" 3) mkSkolem("name_$$", ..., SKOLEM_FLAG_DEFAULT) -> "name_NODEID" 4) mkSkolem("na_$$_me", ..., SKOLEM_FLAG_DEFAULT) -> "na_NODEID_me" After this commit, only 1) and 2) stay. 90% usage is of 1) or 3), which results in exact same behavior (and looking at the source code it doesn't look like everyone realized that the _$$ is just redundant). Almost no one used 4), which is the only reason to even have $$. Post this commit if you really want a number in the middle, manually construct the name and use the SKOLEM_EXACT_NAME flag.
Diffstat (limited to 'src/expr/node_manager.cpp')
-rw-r--r--src/expr/node_manager.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/expr/node_manager.cpp b/src/expr/node_manager.cpp
index 22c47da59..ecd3df084 100644
--- a/src/expr/node_manager.cpp
+++ b/src/expr/node_manager.cpp
@@ -304,26 +304,16 @@ TypeNode NodeManager::getType(TNode n, bool check)
return typeNode;
}
-Node NodeManager::mkSkolem(const std::string& name, const TypeNode& type, const std::string& comment, int flags) {
+Node NodeManager::mkSkolem(const std::string& prefix, const TypeNode& type, const std::string& comment, int flags) {
Node n = NodeBuilder<0>(this, kind::SKOLEM);
setAttribute(n, TypeAttr(), type);
setAttribute(n, TypeCheckedAttr(), true);
if((flags & SKOLEM_EXACT_NAME) == 0) {
- size_t pos = name.find("$$");
- if(pos != string::npos) {
- // replace a "$$" with the node ID
- stringstream id;
- id << n.getId();
- string newName = name;
- newName.replace(pos, 2, id.str());
- setAttribute(n, expr::VarNameAttr(), newName);
- } else {
- stringstream newName;
- newName << name << '_' << n.getId();
- setAttribute(n, expr::VarNameAttr(), newName.str());
- }
+ stringstream name;
+ name << prefix << '_' << n.getId();
+ setAttribute(n, expr::VarNameAttr(), name.str());
} else {
- setAttribute(n, expr::VarNameAttr(), name);
+ setAttribute(n, expr::VarNameAttr(), prefix);
}
if((flags & SKOLEM_NO_NOTIFY) == 0) {
for(vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback