void CompassAnalyses::NonAssociativeRelationalOperators::Traversal:: visit(SgNode* node) { SgBinaryOp *relOperator = isSgBinaryOp(node); if( relOperator != NULL && isRelationalOperator(relOperator) ) { SgExpression *lhs = relOperator->get_lhs_operand(); SgExpression *rhs = relOperator->get_rhs_operand(); if( lhs != NULL && rhs != NULL ) { CompassAnalyses::NonAssociativeRelationalOperators::ExpressionTraversal expressionTraversal; if( expressionTraversal.run(lhs->get_parent()) > 1 ) { output->addOutput( new CheckerOutput(relOperator) ); } //if( expressionTraversal.run(lhs->get_parent()) > 1 ) } //if( lhs != NULL && rhs != NULL ) } //if( relOperator != NULL && isRelationalOperator(node) ) return; } //End of the visit function.
void CONDITION() { if(TOKEN == oddsym) { GETTOKEN(); EXPRESSION(); //OPR 0 6 printToFile(2,0,6); lines++; } else { EXPRESSION(); if(!isRelationalOperator(TOKEN)) { ERROR("Error number 20, relational operator expected."); } //In the enum, the tokens for logical operators are only +1 //from their corresponding OPR M value, so subtracting by one //should get the correct M value. int conditionValue = TOKEN-1; GETTOKEN(); EXPRESSION(); //OPR 0 M printToFile(2,0,conditionValue); lines++; } }
void CompassAnalyses::NonAssociativeRelationalOperators::ExpressionTraversal:: visit(SgNode *node) { if( isRelationalOperator(node) ) this->count++; return; } //ExpressionTraversal::visit(SgNode *node)