void CompassAnalyses::DiscardAssignment::Traversal:: visit(SgNode* node) { if (isSgAssignOp(node)) { // simple case: the parent of a "real" assignment op must be an // expression statement if (!isSgExprStatement(node->get_parent())) { output->addOutput(new CheckerOutput(node)); } else { // not so simple case: the parent is an expression statement, but if // that statement is an if/loop condition, we still want to complain SgNode *assignment = node->get_parent(); SgNode *p = assignment->get_parent(); SgDoWhileStmt *dws; SgForStatement *fs; SgIfStmt *is; SgSwitchStatement *ss; SgWhileStmt *ws; if ((dws = isSgDoWhileStmt(p)) && dws->get_condition() == assignment) { output->addOutput(new CheckerOutput(node)); } else if ((fs = isSgForStatement(p)) && fs->get_test() == assignment) { output->addOutput(new CheckerOutput(node)); } else if ((is = isSgIfStmt(p)) && is->get_conditional() == assignment) { output->addOutput(new CheckerOutput(node)); } else if ((ss = isSgSwitchStatement(p)) && ss->get_item_selector() == assignment) { output->addOutput(new CheckerOutput(node)); } else if ((ws = isSgWhileStmt(p)) && ws->get_condition() == assignment) { output->addOutput(new CheckerOutput(node)); } } } else if (SgMemberFunctionRefExp *mf = isSgMemberFunctionRefExp(node)) { // not so simple case: call to operator= member function that is not an // expression statement by itself SgFunctionCallExp *call = isSgFunctionCallExp(mf->get_parent()->get_parent()); if (call && !isSgExprStatement(call->get_parent()) && mf->get_parent() == call->get_function() && std::strcmp(mf->get_symbol()->get_name().str(), "operator=") == 0) { output->addOutput(new CheckerOutput(call)); } } } //End of the visit function.
bool isAssignmentStmtOf (SgStatement* stmt, SgInitializedName* init_name) { bool rt = false; ROSE_ASSERT (stmt != NULL); ROSE_ASSERT ( init_name != NULL); if (SgExprStatement* exp_stmt = isSgExprStatement(stmt)) { if (SgAssignOp * assign_op = isSgAssignOp (exp_stmt->get_expression())) { if (SgVarRefExp* var_exp = isSgVarRefExp (assign_op->get_lhs_operand()) ) { if (var_exp->get_symbol()->get_declaration() == init_name) rt = true; } } } return rt; }
void DataFlow<Annotation, Language, Runtime>::createContextFromLoopTree( const LoopTrees<Annotation> & loop_trees, context_t & context ) const { assert(context.datas.empty()); assert(context.datas_in.empty()); assert(context.datas_out.empty()); assert(context.accesses_map.empty()); typename std::set<Data<Annotation> *>::iterator it_data; const std::vector<Data<Annotation> *> & data_vect = loop_trees.getDatas(); context.datas.insert(data_vect.begin(), data_vect.end()); for (it_data = context.datas.begin(); it_data != context.datas.end(); it_data++) { assert(*it_data != NULL); if ((*it_data)->isFlowIn()) context.datas_in.insert(*it_data); if ((*it_data)->isFlowOut()) context.datas_out.insert(*it_data); } const std::vector<typename LoopTrees<Annotation>::node_t *> & nodes = loop_trees.getNodes(); typename std::vector<typename LoopTrees<Annotation>::node_t *>::const_iterator it_node; for (it_node = nodes.begin(); it_node != nodes.end(); it_node++) { typename LoopTrees<Annotation>::cond_t * cond = dynamic_cast<typename LoopTrees<Annotation>::cond_t *>(*it_node); typename LoopTrees<Annotation>::stmt_t * stmt = dynamic_cast<typename LoopTrees<Annotation>::stmt_t *>(*it_node); if (cond == NULL && stmt == NULL) continue; typename std::map<typename LoopTrees<Annotation>::node_t *, accesses_list_t>::iterator it_access = context.accesses_map.insert(std::pair<typename LoopTrees<Annotation>::node_t *, accesses_list_t>(*it_node, accesses_list_t())).first; std::vector<data_access_t> & read = it_access->second.reads; std::vector<data_access_t> & write = it_access->second.writes; if (cond != NULL) { assert(false); /// \todo } else if (stmt != NULL) { SgExprStatement * expr_stmt = isSgExprStatement(stmt->statement); SgVariableDeclaration * var_decl = isSgVariableDeclaration(stmt->statement); if (expr_stmt != NULL) { SgExpression * exp = expr_stmt->get_expression(); assert(exp != NULL); SgBinaryOp * bin_op = isSgBinaryOp(exp); if (bin_op != NULL) { SgExpression * lhs_exp = bin_op->get_lhs_operand_i(); SgExpression * rhs_exp = bin_op->get_rhs_operand_i(); assert(lhs_exp != NULL && rhs_exp != NULL); SgAssignOp * assign_op = isSgAssignOp(exp); SgCompoundAssignOp * compound_assign_op = isSgCompoundAssignOp(exp); assert((assign_op != NULL) xor (compound_assign_op != NULL)); // FIXME expression statement are not always made of assignement if (assign_op != NULL || compound_assign_op != NULL) { append_access(lhs_exp, write, context); // add access in lhs to write set append_access(rhs_exp, read, context); // add access in rhs to read set } if (compound_assign_op != NULL) { append_access(lhs_exp, read, context); // add access in lhs to read set } } else assert(false); // FIXME expression statement are not always made of binary op } else if (var_decl != NULL) { assert(var_decl->get_variables().size() == 1); SgInitializedName * init_name = isSgInitializedName(var_decl->get_variables()[0]); assert(init_name != NULL); SgInitializer * init = isSgInitializer(init_name->get_initptr()); if (init != NULL) { SgAssignInitializer * assign_init = isSgAssignInitializer(init); if (assign_init != NULL) { SgExpression * exp = assign_init->get_operand_i(); assert(exp != NULL); append_access(exp, read, context); } else assert(false); } } else assert(false); } } }
void CompassAnalyses::VariableNameEqualsDatabaseName::Traversal:: visit(SgNode* node) { if( isSgAssignInitializer(node) != NULL ) assignExp = node; if( isSgAssignOp(node) != NULL ) assignExp = node; SgFunctionCallExp* funcCall = isSgFunctionCallExp(node); // See if we have a dot expression or arrow expression which // accesses the desired member function in the class we are looking for. if ( funcCall != NULL ) { SgExpression* funcExp = funcCall->get_function(); if ( ( isSgDotExp(funcExp) != NULL ) | ( isSgArrowExp(funcExp) != NULL ) ) { SgBinaryOp* binOp = isSgBinaryOp(funcExp); SgExpression* rhsOp = binOp->get_rhs_operand(); // SgExpression* lhsOp = binOp->get_lhs_operand(); if ( SgMemberFunctionRefExp* funcRef = isSgMemberFunctionRefExp(rhsOp) ) { // std::cout << "c1\n" ; SgMemberFunctionSymbol* funcSymbol = funcRef->get_symbol(); ROSE_ASSERT(funcSymbol->get_declaration() != NULL); // DQ (1/16/2008): Note that the defining declaration need not exist (see test2001_11.C) // ROSE_ASSERT(funcSymbol->get_declaration()->get_definingDeclaration() != NULL); if (funcSymbol->get_declaration()->get_definingDeclaration() != NULL) { SgMemberFunctionDeclaration* funcDecl = isSgMemberFunctionDeclaration(funcSymbol->get_declaration()->get_definingDeclaration()); ROSE_ASSERT( funcDecl != NULL ); SgClassDefinition* clDef = isSgClassDefinition(funcDecl->get_scope()); SgClassDeclaration* clDecl = isSgClassDeclaration(clDef->get_declaration()); // SgClassDeclaration* clDecl = funcDecl->get_associatedClassDeclaration(); ROSE_ASSERT( clDecl != NULL ); std::string className = clDecl->get_name().getString(); ROSE_ASSERT(funcDecl != NULL); std::string functionName = funcDecl->get_name().getString(); // If the class is the class we are looking for see if the member function // access is to the member function we are interested in. // std::cout << "className = " << className << std::endl; // std::cout << "functionName = " << functionName << std::endl; if ( (className == classToLookFor) && ( functionName == memberFunctionToLookFor ) ) { SgExprListExp* actualArgs = funcCall->get_args(); SgExpressionPtrList& actualExpArgs = actualArgs->get_expressions (); ROSE_ASSERT(actualExpArgs.size() == 1); Rose_STL_Container<SgNode*> nodeLst = NodeQuery::querySubTree(*actualExpArgs.begin(), V_SgStringVal); ROSE_ASSERT( nodeLst.size() > 0); SgStringVal* actualArg = isSgStringVal(*nodeLst.begin()); ROSE_ASSERT(actualArg != NULL); std::string stringArg = actualArg->get_value(); std::cout << "arg:" << stringArg << std::endl; std::string varName; // SgInitializedName* initName = NULL; if ( SgAssignInitializer* assignInit = isSgAssignInitializer(assignExp) ) { SgInitializedName* initName = isSgInitializedName(assignInit->get_parent()); ROSE_ASSERT(initName != NULL); varName = initName->get_name().getString(); } else { if ( SgAssignOp* assignOp = isSgAssignOp(assignExp) ) { SgExpression* lhsOp = assignOp->get_lhs_operand(); SgVarRefExp* varRef = isSgVarRefExp(lhsOp); ROSE_ASSERT(varRef!=NULL); SgVariableSymbol* varSymbol = varRef->get_symbol(); ROSE_ASSERT(varSymbol != NULL); SgInitializedName* initName = varSymbol->get_declaration(); varName = initName->get_name().getString(); } } if (varName != "") { // we are only interested in the part of the argument after the last ":" // Database scopes in ALE3D are separated by ":" size_t posCol = stringArg.find_last_of(':'); if (posCol != std::string::npos) stringArg = stringArg.substr(posCol+1); //Find violations to the rule if ( stringArg != varName) { output->addOutput(new CheckerOutput(assignExp)); std::cout << "violation" << varName << std::endl; } else { std::cout << "non=violation" << varName << std::endl; } } } } } } } } // End of the visit function.
// on other nodes lrRecord (lrRecord &parent, SgNode* n) { SgBinaryOp* binOp; SgUnaryOp* unOp; SgFunctionCallExp* funcCall; //SgPntrArrRefExp* arrRef; char typeStr[100]; // if this node is on the read, write or read-write side of an assignment operation, set its access appropriately if(parent.readSubtree == n) access = readAccess; else if(n == parent.writeSubtree) access = writeAccess; else if(n == parent.rwSubtree) access = rwAccess; else access = parent.access; if((binOp = isSgBinaryOp(n))) { // writeSubtree = readSubtree if(isSgAssignOp(binOp)) { writeSubtree = binOp->get_lhs_operand(); readSubtree = binOp->get_rhs_operand(); rwSubtree = (void*)NULL; strcpy(typeStr, "SgAssignOp"); } // rwSubtree op= readSubtree else if(isSgCompoundAssignOp(binOp)) { rwSubtree = binOp->get_lhs_operand(); readSubtree = binOp->get_rhs_operand(); writeSubtree = (void*)NULL; strcpy(typeStr, "Sg*AssignOp"); } else if(isSgPntrArrRefExp(binOp)) { // all the references involved in an array reference, whether they are used to compute the array name // or used in the argument, are read-only writeSubtree = (void*)NULL; readSubtree = (void*)NULL; readSubtree.wildMatch(); rwSubtree = (void*)NULL; strcpy(typeStr, "SgPntrArrRefExp"); } else { readSubtree = (void*)NULL; writeSubtree = (void*)NULL; rwSubtree = (void*)NULL; strcpy(typeStr, "???"); } //printf("SgBinaryNode 0x%x type %s access=%d: %s\n", binOp, typeStr, access, binOp->unparseToString().c_str()); } else if((unOp = isSgUnaryOp(n))) { // unary update operations have only one operand, which is read-write // writeSubtree if(isSgMinusMinusOp(unOp) || isSgPlusPlusOp(unOp)) { writeSubtree = (void*)NULL; readSubtree = (void*)NULL; rwSubtree = unOp->get_operand(); strcpy(typeStr, "Sg**Op"); } // dereference operations have a read-only operand else if(isSgPointerDerefExp(unOp)) { writeSubtree = (void*)NULL; readSubtree = unOp->get_operand(); rwSubtree = (void*)NULL; strcpy(typeStr, "isSgPointerDerefExp"); } else { readSubtree = (void*)NULL; writeSubtree = (void*)NULL; rwSubtree = (void*)NULL; strcpy(typeStr, "???"); } //printf("SgUnaryNode 0x%x %s access=%d: %s\n", unOp, typeStr, access, unOp->unparseToString().c_str()); } else if((funcCall = isSgFunctionCallExp(n))) { // all the references involved in a function call, whether they are used to compute the function pointer // or used in the argument, are read-only writeSubtree = (void*)NULL; readSubtree = (void*)NULL; readSubtree.wildMatch(); rwSubtree = (void*)NULL; //printf("SgFunctionCall 0x%x access=%d: %s\n", funcCall, access, funcCall->unparseToString().c_str()); } // else, if this is neither a binary, nor unary operation node else { // leave subtree fields of this record as NULL readSubtree = (void*)NULL; writeSubtree = (void*)NULL; rwSubtree = (void*)NULL; //printf("SgNode 0x%x access=%d: %s\n", n, access, n->unparseToString().c_str()); } }
/** * Const-qualify immutable objects * * \todo count assignments, if only one, report violation */ bool DCL00_C( const SgNode *node ) { const SgInitializedName *varName = isSgInitializedName(node); if (!varName) return false; /** * Ignore variables generated by macros */ if ((varName->get_name().getString().substr(0,2) == "__") || isCompilerGeneratedNode(node)) return false; /** * Ignore global variables */ if (isGlobalVar(varName)) return false; /** * Ignore variables that are already const, are function pointers, or are * declared inside of a struct, enum, or as an argument to a function */ SgType *varType = varName->get_type(); if (isConstType(varType) || isConstType(varType->dereference()) || isConstType(varType->dereference()->dereference()) || isSgFunctionType(varType) || isSgClassType(varType) || findParentOfType(varName, SgCtorInitializerList) || findParentOfType(varName, SgEnumDeclaration) || findParentOfType(varName, SgClassDeclaration)) return false; /** * DCL13-C is a subset of this rule, figure out which rule we are dealing * with here */ std::string ruleStr; std::string errStr; if (findParentOfType(varName, SgFunctionParameterList)) { /** ignore function prototypes, just worry about the definitions */ const SgFunctionDeclaration *fnDecl = findParentOfType(varName, SgFunctionDeclaration); /** * Disabling assertion due to C++ code */ if (!fnDecl) return false; // assert(fnDecl); if (!fnDecl->get_definition()) return false; if (isSgPointerType(varName->get_type()) || isSgArrayType(varName->get_type())) { ruleStr = "DCL13-C"; errStr = "Declare function parameters that are pointers to values not changed by the function as const: "; } else { return false; } } else { ruleStr = "DCL00-C"; errStr = "Const-qualify immutable objects: "; } /** * Ignore global variables or variables declared as extern */ const SgScopeStatement *varScope = varName->get_scope(); if (isSgGlobal(varScope) || isExternVar(varName)) return false; FOREACH_SUBNODE(varScope, nodes, i, V_SgVarRefExp) { const SgVarRefExp *iVar = isSgVarRefExp(*i); assert(iVar); if (getRefDecl(iVar) != varName) continue; const SgNode *parent = iVar->get_parent(); while(isSgCastExp(parent)) { parent = parent->get_parent(); } assert(parent); /** * If the variable is written to or it's address is taken, we can no * longer be sure it should be const, if it's a struct and gets * dereferenced, who knows what's getting written there :/ */ if (varWrittenTo(iVar) || isSgArrowExp(parent) || findParentOfType(iVar, SgAddressOfOp)) return false; /** * If the variable is a pointer or array, and we pass it to a function * or as an argument to pointer arithmetic, or assign it's value * somewhere, we can longer be sure it should be const */ if ((isSgPointerType(varType) || isSgArrayType(varType)) && (findParentOfType(iVar, SgFunctionCallExp) || isSgAddOp(parent) || isSgSubtractOp(parent) || isSgAssignOp(parent) || isSgPntrArrRefExp(parent) || isSgPointerDerefExp(parent) || isSgAssignInitializer(parent))) return false; } const std::string msg = errStr + varName->get_name().getString(); print_error(node, ruleStr.c_str(), msg.c_str(), true); return true; }
bool TaintAnalysis::transfer(const Function& func, const DataflowNode& node_, NodeState& state, const std::vector<Lattice*>& dfInfo) { static size_t ncalls = 0; if (debug) { *debug <<"TaintAnalysis::transfer-" <<++ncalls <<"(func=" <<func.get_name() <<",\n" <<" node={" <<StringUtility::makeOneLine(node_.toString()) <<"},\n" <<" state={" <<state.str(this, " ") <<",\n" <<" dfInfo[" <<dfInfo.size() <<"]={...})\n"; } SgNode *node = node_.getNode(); assert(!dfInfo.empty()); FiniteVarsExprsProductLattice *prodLat = dynamic_cast<FiniteVarsExprsProductLattice*>(dfInfo.front()); bool modified = magic_tainted(node, prodLat); // some values are automatically tainted based on their name // Process AST nodes that transfer taintedness. Most of these operations have one or more inputs from which a result // is always calculated the same way. So we just gather up the inputs and do the calculation at the very end of this // function. The other operations are handled individually within their "if" bodies. TaintLattice *result = NULL; // result pointer into the taint lattice std::vector<TaintLattice*> inputs; // input pointers into the taint lattice if (isSgAssignInitializer(node)) { // as in "int a = b" SgAssignInitializer *xop = isSgAssignInitializer(node); TaintLattice *in1 = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(SgExpr2Var(xop->get_operand()))); inputs.push_back(in1); } else if (isSgAggregateInitializer(node)) { // as in "int a[1] = {b}" SgAggregateInitializer *xop = isSgAggregateInitializer(node); const SgExpressionPtrList &exprs = xop->get_initializers()->get_expressions(); for (size_t i=0; i<exprs.size(); ++i) { varID in_id = SgExpr2Var(exprs[i]); TaintLattice *in = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(in_id)); inputs.push_back(in); } } else if (isSgInitializedName(node)) { SgInitializedName *xop = isSgInitializedName(node); if (xop->get_initializer()) { varID in1_id = SgExpr2Var(xop->get_initializer()); TaintLattice *in1 = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(in1_id)); inputs.push_back(in1); } } else if (isSgValueExp(node)) { // numeric and character constants SgValueExp *xop = isSgValueExp(node); result = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(SgExpr2Var(xop))); if (result) modified = result->set_vertex(TaintLattice::VERTEX_UNTAINTED); } else if (isSgAddressOfOp(node)) { // as in "&x". The result taintedness has nothing to do with the value in x. /*void*/ } else if (isSgBinaryOp(node)) { // as in "a + b" SgBinaryOp *xop = isSgBinaryOp(node); varID in1_id = SgExpr2Var(isSgExpression(xop->get_lhs_operand())); TaintLattice *in1 = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(in1_id)); inputs.push_back(in1); varID in2_id = SgExpr2Var(isSgExpression(xop->get_rhs_operand())); TaintLattice *in2 = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(in2_id)); inputs.push_back(in2); if (isSgAssignOp(node)) { // copy the rhs lattice to the lhs lattice (as well as the entire '=' expression result) assert(in1 && in2); modified = in1->meetUpdate(in2); } } else if (isSgUnaryOp(node)) { // as in "-a" SgUnaryOp *xop = isSgUnaryOp(node); varID in1_id = SgExpr2Var(xop->get_operand()); TaintLattice *in1 = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(in1_id)); inputs.push_back(in1); } else if (isSgReturnStmt(node)) { // as in "return a". The result will always be dead, so we're just doing this to get some debugging output. Most // of our test inputs are functions, and the test examines the function's returned taintedness. SgReturnStmt *xop = isSgReturnStmt(node); varID in1_id = SgExpr2Var(xop->get_expression()); TaintLattice *in1 = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(in1_id)); inputs.push_back(in1); } // Update the result lattice (unless dead) with the inputs (unless dead) by using the meedUpdate() method. All this // means is that the new result will be the maximum of the old result and all inputs, where "maximum" is defined such // that "tainted" is greater than "untainted" (and both of them are greater than bottom/unknown). for (size_t i=0; i<inputs.size(); ++i) if (debug) *debug <<"TaintAnalysis::transfer: input " <<(i+1) <<" is " <<lattice_info(inputs[i]) <<"\n"; if (!result && varID::isValidVarExp(node)) { varID result_id(node); // NOTE: constructor doesn't handle all SgExpression nodes, thus the next "if" result = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(result_id)); } if (!result && isSgExpression(node)) { varID result_id = SgExpr2Var(isSgExpression(node)); result = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(result_id)); } if (result) { for (size_t i=0; i<inputs.size(); ++i) { if (inputs[i]) modified = result->meetUpdate(inputs[i]) || modified; } } if (debug) *debug <<"TaintAnalysis::transfer: result is " <<lattice_info(result) <<(modified?" (modified)":" (not modified)") <<"\n"; return modified; }
std::string getSgExpressionString(SgExpression* expNode) { //bool returnString = false; std::string expString; bool set_to_expression_val = false; VariantT var = expNode->variantT(); if (isSgBinaryOp(expNode)) { SgBinaryOp* binOp = isSgBinaryOp(expNode); SgExpression* lhs_exp = binOp->get_lhs_operand(); SgExpression* rhs_exp = binOp->get_rhs_operand(); expString = writeSgBinaryOpZ3(binOp, lhs_exp, rhs_exp); if (isSgAssignOp(binOp) || isSgCompoundAssignOp(binOp)) { declarations.push_back(expString); expString = ""; } else if (isSgEqualityOp(binOp) || isSgGreaterThanOp(binOp) || isSgGreaterOrEqualOp(binOp) || isSgLessThanOp(binOp) || isSgLessOrEqualOp(binOp) || isSgNotEqualOp(binOp) || isSgAndOp(binOp) || isSgOrOp(binOp)) { //set_to_expression_val = true; } } else if (isSgUnaryOp(expNode)) { expString = getSgUnaryOp(isSgUnaryOp(expNode)); } else if (isSgValueExp(expNode)) { expString = getSgValueExp(isSgValueExp(expNode)); } else { switch (var) { case V_SgCallExpression: std::cout << "SgCallExpression not yet implemented" << std::endl; expString = ""; ROSE_ASSERT(false); break; case V_SgClassNameRefExp: std::cout << "SgClassNameRefExp not yet implemented" << std::endl; expString = ""; ROSE_ASSERT(false); break; case V_SgConditionalExp: std::cout << "SgConditionalExp (trinary A ? B : C) not yet implemented" << std::endl; expString = ""; ROSE_ASSERT(false); break; case V_SgExprListExp: std::cout << "SgExprListExp is not yet implemented" << std::endl; expString = ""; ROSE_ASSERT(false); break; case V_SgFunctionRefExp: std::cout << "SgFunctionRefExp is not yet implemented" << std::endl; expString = ""; ROSE_ASSERT(false); break; case V_SgDeleteExp: std::cout << "SgDeleteExp is not yet implemented" << std::endl; expString = ""; ROSE_ASSERT(false); break; case V_SgInitializer: std::cout << "SgInitializer is not yet implemented" << std::endl; expString = ""; ROSE_ASSERT(false); break; case V_SgNaryOp: std::cout << "SgNaryOp is not yet implemented" << std::endl; expString = ""; ROSE_ASSERT(false); break; case V_SgNewExp: std::cout << "SgNewExp is not yet implemented" << std::endl; expString = ""; ROSE_ASSERT(false); break; case V_SgNullExpression: expString = "; null expression"; break; case V_SgRefExp: std::cout << "SgRefExp is not yet implemented" << std::endl; expString = ""; ROSE_ASSERT(false); break; case V_SgSizeOfOp: std::cout << "SgSizeOfOp is not yet implemented" << std::endl; expString = ""; ROSE_ASSERT(false); break; case V_SgStatementExpression: std::cout << "SgStatementExpression is not yet implemented" << std::endl; expString = ""; ROSE_ASSERT(false); break; case V_SgValueExp: std::cout << "V_SgValueExp should never be encountered" << std::endl; ROSE_ASSERT(false); expString = ""; break; case V_SgVarRefExp: expString = getSgVarRefExp(isSgVarRefExp(expNode)); break; default: std::cout << expNode->class_name() << " is not being considered for implementation"; expString = ""; #ifndef VERBOSE_COMPLETE ROSE_ASSERT(false); #endif } } /*if (set_to_expression_val) { std::stringstream exp_var; exp_var << "e_" << expression_count; expression_count++; std::string exp_var_decl = "(declare-const " + exp_var.str() + " Bool)"; variables.push_back(exp_var_decl); std::string exp_var_val = "(assert (= " + exp_var.str() + " " + expString + "))"; expressions.push_back(exp_var_val); return exp_var.str(); } else { return expString; }*/ return expString; }