Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Visitor.cc

    r8688ce1 r7f5566b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Visitor.cc --
     7// Visitor.cc -- 
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug  4 11:24:25 2016
    13 // Update Count     : 21
     12// Last Modified On : Fri Jul 24 16:11:05 2015
     13// Update Count     : 15
    1414//
    1515
     
    3939}
    4040
    41 void Visitor::handleAggregateDecl( AggregateDecl *aggregateDecl ) {
     41void Visitor::visit( AggregateDecl *aggregateDecl ) {
    4242        acceptAll( aggregateDecl->get_parameters(), *this );
    4343        acceptAll( aggregateDecl->get_members(), *this );
     
    4545
    4646void Visitor::visit( StructDecl *aggregateDecl ) {
    47         handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) );
     47        visit( static_cast< AggregateDecl* >( aggregateDecl ) );
    4848}
    4949
    5050void Visitor::visit( UnionDecl *aggregateDecl ) {
    51         handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) );
     51        visit( static_cast< AggregateDecl* >( aggregateDecl ) );
    5252}
    5353
    5454void Visitor::visit( EnumDecl *aggregateDecl ) {
    55         handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) );
    56 }
    57 
    58 void Visitor::visit( TraitDecl *aggregateDecl ) {
    59         handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) );
    60 }
    61 
    62 void Visitor::handleNamedTypeDecl( NamedTypeDecl *typeDecl ) {
     55        visit( static_cast< AggregateDecl* >( aggregateDecl ) );
     56}
     57
     58void Visitor::visit( ContextDecl *aggregateDecl ) {
     59        visit( static_cast< AggregateDecl* >( aggregateDecl ) );
     60}
     61
     62void Visitor::visit( NamedTypeDecl *typeDecl ) {
    6363        acceptAll( typeDecl->get_parameters(), *this );
    6464        acceptAll( typeDecl->get_assertions(), *this );
     
    6767
    6868void Visitor::visit( TypeDecl *typeDecl ) {
    69         handleNamedTypeDecl( static_cast< NamedTypeDecl* >( typeDecl ) );
     69        visit( static_cast< NamedTypeDecl* >( typeDecl ) );
    7070}
    7171
    7272void Visitor::visit( TypedefDecl *typeDecl ) {
    73         handleNamedTypeDecl( static_cast< NamedTypeDecl* >( typeDecl ) );
     73        visit( static_cast< NamedTypeDecl* >( typeDecl ) );
    7474}
    7575
     
    109109void Visitor::visit( SwitchStmt *switchStmt ) {
    110110        maybeAccept( switchStmt->get_condition(), *this );
    111         acceptAll( switchStmt->get_statements(), *this );
    112 }
     111        acceptAll( switchStmt->get_branches(), *this );
     112}
     113
     114void Visitor::visit( ChooseStmt *switchStmt ) {
     115        maybeAccept( switchStmt->get_condition(), *this );
     116        acceptAll( switchStmt->get_branches(), *this );
     117}
     118
     119void Visitor::visit( FallthruStmt *fallthruStmt ) {}
    113120
    114121void Visitor::visit( CaseStmt *caseStmt ) {
     
    143150void Visitor::visit( DeclStmt *declStmt ) {
    144151        maybeAccept( declStmt->get_decl(), *this );
    145 }
    146 
    147 void Visitor::visit( ImplicitCtorDtorStmt *impCtorDtorStmt ) {
    148         maybeAccept( impCtorDtorStmt->get_callStmt(), *this );
    149152}
    150153
     
    207210}
    208211
    209 void Visitor::visit( AlignofExpr *alignofExpr ) {
    210         acceptAll( alignofExpr->get_results(), *this );
    211         if ( alignofExpr->get_isType() ) {
    212                 maybeAccept( alignofExpr->get_type(), *this );
    213         } else {
    214                 maybeAccept( alignofExpr->get_expr(), *this );
    215         }
    216 }
    217 
    218 void Visitor::visit( UntypedOffsetofExpr *offsetofExpr ) {
    219         acceptAll( offsetofExpr->get_results(), *this );
    220         maybeAccept( offsetofExpr->get_type(), *this );
    221 }
    222 
    223 void Visitor::visit( OffsetofExpr *offsetofExpr ) {
    224         acceptAll( offsetofExpr->get_results(), *this );
    225         maybeAccept( offsetofExpr->get_type(), *this );
    226         maybeAccept( offsetofExpr->get_member(), *this );
    227 }
    228 
    229 void Visitor::visit( OffsetPackExpr *offsetPackExpr ) {
    230         acceptAll( offsetPackExpr->get_results(), *this );
    231         maybeAccept( offsetPackExpr->get_type(), *this );
    232 }
    233 
    234212void Visitor::visit( AttrExpr *attrExpr ) {
    235213        acceptAll( attrExpr->get_results(), *this );
     
    281259}
    282260
    283 void Visitor::visit( ImplicitCopyCtorExpr *impCpCtorExpr ) {
    284         maybeAccept( impCpCtorExpr->get_callExpr(), *this );
    285         acceptAll( impCpCtorExpr->get_tempDecls(), *this );
    286         acceptAll( impCpCtorExpr->get_returnDecls(), *this );
    287 }
    288 
    289261void Visitor::visit( UntypedValofExpr *valofExpr ) {
    290262        acceptAll( valofExpr->get_results(), *this );
    291263        maybeAccept( valofExpr->get_body(), *this );
    292 }
    293 
    294 void Visitor::visit( CompoundLiteralExpr *compLitExpr ) {
    295         acceptAll( compLitExpr->get_results(), *this );
    296         maybeAccept( compLitExpr->get_type(), *this );
    297         maybeAccept( compLitExpr->get_initializer(), *this );
    298 }
    299 
    300 void Visitor::visit( RangeExpr *rangeExpr ) {
    301         maybeAccept( rangeExpr->get_low(), *this );
    302         maybeAccept( rangeExpr->get_high(), *this );
    303264}
    304265
     
    328289}
    329290
    330 void Visitor::handleReferenceToType( ReferenceToType *aggregateUseType ) {
     291void Visitor::visit( ReferenceToType *aggregateUseType ) {
    331292        acceptAll( aggregateUseType->get_forall(), *this );
    332293        acceptAll( aggregateUseType->get_parameters(), *this );
     
    334295
    335296void Visitor::visit( StructInstType *aggregateUseType ) {
    336         handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );
     297        visit( static_cast< ReferenceToType * >( aggregateUseType ) );
    337298}
    338299
    339300void Visitor::visit( UnionInstType *aggregateUseType ) {
    340         handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );
     301        visit( static_cast< ReferenceToType * >( aggregateUseType ) );
    341302}
    342303
    343304void Visitor::visit( EnumInstType *aggregateUseType ) {
    344         handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );
    345 }
    346 
    347 void Visitor::visit( TraitInstType *aggregateUseType ) {
    348         handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );
     305        visit( static_cast< ReferenceToType * >( aggregateUseType ) );
     306}
     307
     308void Visitor::visit( ContextInstType *aggregateUseType ) {
     309        visit( static_cast< ReferenceToType * >( aggregateUseType ) );
    349310        acceptAll( aggregateUseType->get_members(), *this );
    350311}
    351312
    352313void Visitor::visit( TypeInstType *aggregateUseType ) {
    353         handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );
     314        visit( static_cast< ReferenceToType * >( aggregateUseType ) );
    354315}
    355316
     
    374335}
    375336
    376 void Visitor::visit( VarArgsType *varArgsType ) {
    377         acceptAll( varArgsType->get_forall(), *this );
    378 }
    379 
    380337void Visitor::visit( SingleInit *singleInit ) {
    381338        singleInit->get_value()->accept( *this );
     
    385342        acceptAll( listInit->get_designators(), *this );
    386343        acceptAll( listInit->get_initializers(), *this );
    387 }
    388 
    389 void Visitor::visit( ConstructorInit *ctorInit ) {
    390         maybeAccept( ctorInit->get_ctor(), *this );
    391         maybeAccept( ctorInit->get_init(), *this );
    392344}
    393345
Note: See TracChangeset for help on using the changeset viewer.