Changeset 2724b4e for src/ResolvExpr


Ignore:
Timestamp:
Sep 16, 2020, 1:48:17 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
673eb7a
Parents:
c402739f (diff), da9a27c (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

Location:
src/ResolvExpr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    rc402739f r2724b4e  
    816816                /// Adds aggregate member interpretations
    817817                void addAggMembers(
    818                         const ast::ReferenceToType * aggrInst, const ast::Expr * expr,
     818                        const ast::BaseInstType * aggrInst, const ast::Expr * expr,
    819819                        const Candidate & cand, const Cost & addedCost, const std::string & name
    820820                ) {
     
    12631263
    12641264                void postvisit( const ast::UntypedOffsetofExpr * offsetofExpr ) {
    1265                         const ast::ReferenceToType * aggInst;
     1265                        const ast::BaseInstType * aggInst;
    12661266                        if (( aggInst = offsetofExpr->type.as< ast::StructInstType >() )) ;
    12671267                        else if (( aggInst = offsetofExpr->type.as< ast::UnionInstType >() )) ;
  • src/ResolvExpr/CurrentObject.cc

    rc402739f r2724b4e  
    923923
    924924        MemberIterator * createMemberIterator( const CodeLocation & loc, const Type * type ) {
    925                 if ( auto aggr = dynamic_cast< const ReferenceToType * >( type ) ) {
     925                if ( auto aggr = dynamic_cast< const BaseInstType * >( type ) ) {
    926926                        if ( auto sit = dynamic_cast< const StructInstType * >( aggr ) ) {
    927927                                return new StructIterator{ loc, sit };
     
    932932                                        dynamic_cast< const EnumInstType * >( type )
    933933                                                || dynamic_cast< const TypeInstType * >( type ),
    934                                         "Encountered unhandled ReferenceToType in createMemberIterator: %s",
     934                                        "Encountered unhandled BaseInstType in createMemberIterator: %s",
    935935                                                toString( type ).c_str() );
    936936                                return new SimpleIterator{ loc, type };
     
    965965                                        DesignatorChain & d = *dit;
    966966                                        PRINT( std::cerr << "____actual: " << t << std::endl; )
    967                                         if ( auto refType = dynamic_cast< const ReferenceToType * >( t ) ) {
     967                                        if ( auto refType = dynamic_cast< const BaseInstType * >( t ) ) {
    968968                                                // concatenate identical field names
    969969                                                for ( const Decl * mem : refType->lookup( nexpr->name ) ) {
  • src/ResolvExpr/Resolver.cc

    rc402739f r2724b4e  
    12591259                const ast::ThrowStmt *       previsit( const ast::ThrowStmt * );
    12601260                const ast::CatchStmt *       previsit( const ast::CatchStmt * );
     1261                const ast::CatchStmt *       postvisit( const ast::CatchStmt * );
    12611262                const ast::WaitForStmt *     previsit( const ast::WaitForStmt * );
    12621263
     
    14911492
    14921493        const ast::CatchStmt * Resolver_new::previsit( const ast::CatchStmt * catchStmt ) {
    1493                 // TODO: This will need a fix for the decl/cond scoping problem.
     1494                // Until we are very sure this invarent (ifs that move between passes have thenPart)
     1495                // holds, check it. This allows a check for when to decode the mangling.
     1496                if ( auto ifStmt = catchStmt->body.as<ast::IfStmt>() ) {
     1497                        assert( ifStmt->thenPart );
     1498                }
     1499                // Encode the catchStmt so the condition can see the declaration.
    14941500                if ( catchStmt->cond ) {
    1495                         ast::ptr< ast::Type > boolType = new ast::BasicType{ ast::BasicType::Bool };
    1496                         catchStmt = ast::mutate_field(
    1497                                 catchStmt, &ast::CatchStmt::cond,
    1498                                 findSingleExpression( catchStmt->cond, boolType, symtab ) );
     1501                        ast::CatchStmt * stmt = mutate( catchStmt );
     1502                        stmt->body = new ast::IfStmt( stmt->location, stmt->cond, nullptr, stmt->body );
     1503                        stmt->cond = nullptr;
     1504                        return stmt;
     1505                }
     1506                return catchStmt;
     1507        }
     1508
     1509        const ast::CatchStmt * Resolver_new::postvisit( const ast::CatchStmt * catchStmt ) {
     1510                // Decode the catchStmt so everything is stored properly.
     1511                const ast::IfStmt * ifStmt = catchStmt->body.as<ast::IfStmt>();
     1512                if ( nullptr != ifStmt && nullptr == ifStmt->thenPart ) {
     1513                        assert( ifStmt->cond );
     1514                        assert( ifStmt->elsePart );
     1515                        ast::CatchStmt * stmt = ast::mutate( catchStmt );
     1516                        stmt->cond = ifStmt->cond;
     1517                        stmt->body = ifStmt->elsePart;
     1518                        // ifStmt should be implicately deleted here.
     1519                        return stmt;
    14991520                }
    15001521                return catchStmt;
Note: See TracChangeset for help on using the changeset viewer.