Ignore:
Timestamp:
May 2, 2022, 3:19:03 AM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
12bb5ab1, 49a1684
Parents:
9e7236f4 (diff), 4b4f95f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    r9e7236f4 r24ceace  
    1010// Created On       : Sun May 17 12:17:01 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Mar 18 10:41:00 2022
    13 // Update Count     : 247
     12// Last Modified On : Wed Apr 20 10:41:00 2022
     13// Update Count     : 248
    1414//
    1515
     
    17221722                // Resolve all clauses first
    17231723                for ( unsigned i = 0; i < stmt->clauses.size(); ++i ) {
    1724                         const ast::WaitForStmt::Clause & clause = stmt->clauses[i];
     1724                        const ast::WaitForClause & clause = *stmt->clauses[i];
    17251725
    17261726                        ast::TypeEnvironment env;
     
    17281728
    17291729                        // Find all candidates for a function in canonical form
    1730                         funcFinder.find( clause.target.func, ResolvMode::withAdjustment() );
     1730                        funcFinder.find( clause.target_func, ResolvMode::withAdjustment() );
    17311731
    17321732                        if ( funcFinder.candidates.empty() ) {
    17331733                                stringstream ss;
    17341734                                ss << "Use of undeclared indentifier '";
    1735                                 ss << clause.target.func.strict_as< ast::NameExpr >()->name;
     1735                                ss << clause.target_func.strict_as< ast::NameExpr >()->name;
    17361736                                ss << "' in call to waitfor";
    17371737                                SemanticError( stmt->location, ss.str() );
    17381738                        }
    17391739
    1740                         if ( clause.target.args.empty() ) {
     1740                        if ( clause.target_args.empty() ) {
    17411741                                SemanticError( stmt->location,
    17421742                                        "Waitfor clause must have at least one mutex parameter");
     
    17451745                        // Find all alternatives for all arguments in canonical form
    17461746                        std::vector< CandidateFinder > argFinders =
    1747                                 funcFinder.findSubExprs( clause.target.args );
     1747                                funcFinder.findSubExprs( clause.target_args );
    17481748
    17491749                        // List all combinations of arguments
     
    19181918
    19191919                        // build new clause
    1920                         ast::WaitForStmt::Clause clause2;
    1921 
    1922                         clause2.target.func = funcCandidates.front()->expr;
    1923 
    1924                         clause2.target.args.reserve( clause.target.args.size() );
     1920                        auto clause2 = new ast::WaitForClause( clause.location );
     1921
     1922                        clause2->target_func = funcCandidates.front()->expr;
     1923
     1924                        clause2->target_args.reserve( clause.target_args.size() );
    19251925                        const ast::StructDecl * decl_monitor = symtab.lookupStruct( "monitor$" );
    19261926                        for ( auto arg : argsCandidates.front() ) {
     
    19391939                                );
    19401940
    1941                                 clause2.target.args.emplace_back( findSingleExpression( init, context ) );
     1941                                clause2->target_args.emplace_back( findSingleExpression( init, context ) );
    19421942                        }
    19431943
    19441944                        // Resolve the conditions as if it were an IfStmt, statements normally
    1945                         clause2.cond = findSingleExpression( clause.cond, context );
    1946                         clause2.stmt = clause.stmt->accept( *visitor );
     1945                        clause2->cond = findSingleExpression( clause.cond, context );
     1946                        clause2->stmt = clause.stmt->accept( *visitor );
    19471947
    19481948                        // set results into stmt
    19491949                        auto n = mutate( stmt );
    1950                         n->clauses[i] = std::move( clause2 );
     1950                        n->clauses[i] = clause2;
    19511951                        stmt = n;
    19521952                }
    19531953
    1954                 if ( stmt->timeout.stmt ) {
     1954                if ( stmt->timeout_stmt ) {
    19551955                        // resolve the timeout as a size_t, the conditions like IfStmt, and stmts normally
    1956                         ast::WaitForStmt::Timeout timeout2;
    1957 
    19581956                        ast::ptr< ast::Type > target =
    19591957                                new ast::BasicType{ ast::BasicType::LongLongUnsignedInt };
    1960                         timeout2.time = findSingleExpression( stmt->timeout.time, target, context );
    1961                         timeout2.cond = findSingleExpression( stmt->timeout.cond, context );
    1962                         timeout2.stmt = stmt->timeout.stmt->accept( *visitor );
     1958                        auto timeout_time = findSingleExpression( stmt->timeout_time, target, context );
     1959                        auto timeout_cond = findSingleExpression( stmt->timeout_cond, context );
     1960                        auto timeout_stmt = stmt->timeout_stmt->accept( *visitor );
    19631961
    19641962                        // set results into stmt
    19651963                        auto n = mutate( stmt );
    1966                         n->timeout = std::move( timeout2 );
     1964                        n->timeout_time = std::move( timeout_time );
     1965                        n->timeout_cond = std::move( timeout_cond );
     1966                        n->timeout_stmt = std::move( timeout_stmt );
    19671967                        stmt = n;
    19681968                }
    19691969
    1970                 if ( stmt->orElse.stmt ) {
     1970                if ( stmt->else_stmt ) {
    19711971                        // resolve the condition like IfStmt, stmts normally
    1972                         ast::WaitForStmt::OrElse orElse2;
    1973 
    1974                         orElse2.cond = findSingleExpression( stmt->orElse.cond, context );
    1975                         orElse2.stmt = stmt->orElse.stmt->accept( *visitor );
     1972                        auto else_cond = findSingleExpression( stmt->else_cond, context );
     1973                        auto else_stmt = stmt->else_stmt->accept( *visitor );
    19761974
    19771975                        // set results into stmt
    19781976                        auto n = mutate( stmt );
    1979                         n->orElse = std::move( orElse2 );
     1977                        n->else_cond = std::move( else_cond );
     1978                        n->else_stmt = std::move( else_stmt );
    19801979                        stmt = n;
    19811980                }
Note: See TracChangeset for help on using the changeset viewer.