// // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // FunctionChecker.cc -- // // Author : Rodolfo G. Esteves // Created On : Mon May 18 07:44:20 2015 // Last Modified By : Peter A. Buhr // Last Modified On : Mon May 18 11:59:55 2015 // Update Count : 3 // #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