Ignore:
Timestamp:
Feb 1, 2018, 5:40:01 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
0188a0b
Parents:
d0a045c7 (diff), 33c0ce8 (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/Common/PassVisitor.impl.h

    rd0a045c7 r85521c7  
    365365        maybeAccept_impl   ( node->attributes   , *this );
    366366
    367         if ( node->name != "" ) {
    368                 indexerAddId( node );
    369         }
     367        indexerAddId( node );
    370368
    371369        VISIT_END( node );
     
    381379        maybeMutate_impl   ( node->attributes   , *this );
    382380
    383         if ( node->name != "" ) {
    384                 indexerAddId( node );
    385         }
     381        indexerAddId( node );
    386382
    387383        MUTATE_END( DeclarationWithType, node );
     
    394390        VISIT_START( node );
    395391
    396         if ( node->name != "" ) {
    397                 indexerAddId( node );
    398         }
    399 
    400         {
    401                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    402                 // implicit add __func__ identifier as specified in the C manual 6.4.2.2
    403                 static ObjectDecl func(
    404                         "__func__", noStorageClasses, LinkageSpec::C, nullptr,
    405                         new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
    406                         nullptr
    407                 );
    408                 indexerAddId( &func );
    409                 maybeAccept_impl( node->type, *this );
    410                 maybeAccept_impl( node->statements, *this );
    411                 maybeAccept_impl( node->attributes, *this );
     392        indexerAddId( node );
     393
     394        maybeAccept_impl( node->withExprs, *this );
     395        {
     396                // with clause introduces a level of scope (for the with expression members).
     397                // with clause exprs are added to the indexer before parameters so that parameters
     398                // shadow with exprs and not the other way around.
     399                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     400                indexerAddWith( node->withExprs );
     401                {
     402                        auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     403                        // implicit add __func__ identifier as specified in the C manual 6.4.2.2
     404                        static ObjectDecl func(
     405                                "__func__", noStorageClasses, LinkageSpec::C, nullptr,
     406                                new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
     407                                nullptr
     408                        );
     409                        indexerAddId( &func );
     410                        maybeAccept_impl( node->type, *this );
     411                        maybeAccept_impl( node->statements, *this );
     412                        maybeAccept_impl( node->attributes, *this );
     413                }
    412414        }
    413415
     
    419421        MUTATE_START( node );
    420422
    421         if ( node->name != "" ) {
    422                 indexerAddId( node );
    423         }
    424 
    425         {
    426                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    427                 // implicit add __func__ identifier as specified in the C manual 6.4.2.2
    428                 static ObjectDecl func(
    429                         "__func__", noStorageClasses, LinkageSpec::C, nullptr,
    430                         new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
    431                         nullptr
    432                 );
    433                 indexerAddId( &func );
    434                 maybeMutate_impl( node->type, *this );
    435                 maybeMutate_impl( node->statements, *this );
    436                 maybeMutate_impl( node->attributes, *this );
     423        indexerAddId( node );
     424
     425        {
     426                // with clause introduces a level of scope (for the with expression members).
     427                // with clause exprs are added to the indexer before parameters so that parameters
     428                // shadow with exprs and not the other way around.
     429                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     430                indexerAddWith( node->withExprs );
     431                {
     432                        auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     433                        // implicit add __func__ identifier as specified in the C manual 6.4.2.2
     434                        static ObjectDecl func(
     435                                "__func__", noStorageClasses, LinkageSpec::C, nullptr,
     436                                new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
     437                                nullptr
     438                        );
     439                        indexerAddId( &func );
     440                        maybeMutate_impl( node->type, *this );
     441                        maybeMutate_impl( node->statements, *this );
     442                        maybeMutate_impl( node->attributes, *this );
     443                }
    437444        }
    438445
     
    730737template< typename pass_type >
    731738void PassVisitor< pass_type >::visit( AsmStmt * node ) {
    732         VISIT_BODY( node );
     739        VISIT_START( node )
     740
     741        maybeAccept_impl( node->instruction, *this );
     742        maybeAccept_impl( node->output, *this );
     743        maybeAccept_impl( node->input, *this );
     744        maybeAccept_impl( node->clobber, *this );
     745
     746        VISIT_END( node );
    733747}
    734748
    735749template< typename pass_type >
    736750Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
    737         MUTATE_BODY( Statement, node );
     751        MUTATE_START( node );
     752
     753        maybeMutate_impl( node->instruction, *this );
     754        maybeMutate_impl( node->output, *this );
     755        maybeMutate_impl( node->input, *this );
     756        maybeMutate_impl( node->clobber, *this );
     757
     758        MUTATE_END( Statement, node );
    738759}
    739760
     
    868889template< typename pass_type >
    869890void PassVisitor< pass_type >::visit( BranchStmt * node ) {
    870         VISIT_BODY( node );
     891        VISIT_START( node );
     892        VISIT_END( node );
    871893}
    872894
    873895template< typename pass_type >
    874896Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
    875         MUTATE_BODY( Statement, node );
     897        MUTATE_START( node );
     898        MUTATE_END( Statement, node );
    876899}
    877900
     
    901924template< typename pass_type >
    902925void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
    903         VISIT_BODY( node );
     926        VISIT_START( node );
     927
     928        maybeAccept_impl( node->expr, *this );
     929        maybeAccept_impl( node->target, *this );
     930
     931        VISIT_END( node );
    904932}
    905933
    906934template< typename pass_type >
    907935Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) {
    908         MUTATE_BODY( Statement, node );
     936        MUTATE_START( node );
     937
     938        maybeMutate_impl( node->expr, *this );
     939        maybeMutate_impl( node->target, *this );
     940
     941        MUTATE_END( Statement, node );
    909942}
    910943
     
    9961029                // catch statements introduce a level of scope (for the caught exception)
    9971030                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    998                 indexerAddWith( node );
     1031                indexerAddWith( node->exprs );
    9991032                maybeAccept_impl( node->stmt, *this );
    10001033        }
     
    10091042                // catch statements introduce a level of scope (for the caught exception)
    10101043                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1011                 indexerAddWith( node );
     1044                indexerAddWith( node->exprs );
    10121045                maybeMutate_impl( node->stmt, *this );
    10131046        }
Note: See TracChangeset for help on using the changeset viewer.