#include "FunctionChecker.h" #include "FunctionFixer.h" #include "SemanticError.h" #include #include #include namespace Tuples { using namespace std; void checkFunctions( std::list< Declaration * > translationUnit ) { FunctionChecker fchk(true); TupleDistrib td; FunctionFixer ff; mutateAll( translationUnit , fchk ); mutateAll( translationUnit , ff ); mutateAll( translationUnit , td ); return; } FunctionChecker::FunctionChecker( bool _topLevel, UniqueName *_nameGen ) : topLevel( _topLevel ), nameGen( _nameGen ) { if( topLevel) { assert( !nameGen ); nameGen = new UniqueName("_MVR_"); } else assert( nameGen ); } FunctionChecker::~FunctionChecker() { if( topLevel) { delete nameGen; nameGen = 0; } } Statement* FunctionChecker::mutate(ExprStmt *exprStmt) { exprStmt->set_expr( maybeMutate( exprStmt->get_expr(), *this ) ); if ( !tempExpr.empty() ) { assert ( !temporaries.empty() ); CompoundStmt *newBlock = new CompoundStmt( std::list< Label >() ); // declarations for( std::list< ObjectDecl *>::iterator d = temporaries.begin(); d != temporaries.end(); ++d ) newBlock->get_kids().push_back( new DeclStmt( std::list