Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.impl.h

    rbc6f918 r73367a8  
    365365        maybeAccept_impl   ( node->attributes   , *this );
    366366
    367         indexerAddId( node );
     367        if ( node->name != "" ) {
     368                indexerAddId( node );
     369        }
    368370
    369371        VISIT_END( node );
     
    379381        maybeMutate_impl   ( node->attributes   , *this );
    380382
    381         indexerAddId( node );
     383        if ( node->name != "" ) {
     384                indexerAddId( node );
     385        }
    382386
    383387        MUTATE_END( DeclarationWithType, node );
     
    390394        VISIT_START( node );
    391395
    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                 }
     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 );
    414412        }
    415413
     
    421419        MUTATE_START( node );
    422420
    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                 }
     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 );
    444437        }
    445438
     
    737730template< typename pass_type >
    738731void PassVisitor< pass_type >::visit( AsmStmt * 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 );
     732        VISIT_BODY( node );
    747733}
    748734
    749735template< typename pass_type >
    750736Statement * PassVisitor< pass_type >::mutate( AsmStmt * 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 );
     737        MUTATE_BODY( Statement, node );
    759738}
    760739
     
    1017996                // catch statements introduce a level of scope (for the caught exception)
    1018997                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1019                 indexerAddWith( node->exprs );
     998                indexerAddWith( node );
    1020999                maybeAccept_impl( node->stmt, *this );
    10211000        }
     
    10301009                // catch statements introduce a level of scope (for the caught exception)
    10311010                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1032                 indexerAddWith( node->exprs );
     1011                indexerAddWith( node );
    10331012                maybeMutate_impl( node->stmt, *this );
    10341013        }
Note: See TracChangeset for help on using the changeset viewer.