Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Visitor.cc

    r7f5566b r8688ce1  
    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 : Fri Jul 24 16:11:05 2015
    13 // Update Count     : 15
     12// Last Modified On : Thu Aug  4 11:24:25 2016
     13// Update Count     : 21
    1414//
    1515
     
    3939}
    4040
    41 void Visitor::visit( AggregateDecl *aggregateDecl ) {
     41void Visitor::handleAggregateDecl( AggregateDecl *aggregateDecl ) {
    4242        acceptAll( aggregateDecl->get_parameters(), *this );
    4343        acceptAll( aggregateDecl->get_members(), *this );
     
    4545
    4646void Visitor::visit( StructDecl *aggregateDecl ) {
    47         visit( static_cast< AggregateDecl* >( aggregateDecl ) );
     47        handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) );
    4848}
    4949
    5050void Visitor::visit( UnionDecl *aggregateDecl ) {
    51         visit( static_cast< AggregateDecl* >( aggregateDecl ) );
     51        handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) );
    5252}
    5353
    5454void Visitor::visit( EnumDecl *aggregateDecl ) {
    55         visit( static_cast< AggregateDecl* >( aggregateDecl ) );
    56 }
    57 
    58 void Visitor::visit( ContextDecl *aggregateDecl ) {
    59         visit( static_cast< AggregateDecl* >( aggregateDecl ) );
    60 }
    61 
    62 void Visitor::visit( NamedTypeDecl *typeDecl ) {
     55        handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) );
     56}
     57
     58void Visitor::visit( TraitDecl *aggregateDecl ) {
     59        handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) );
     60}
     61
     62void Visitor::handleNamedTypeDecl( NamedTypeDecl *typeDecl ) {
    6363        acceptAll( typeDecl->get_parameters(), *this );
    6464        acceptAll( typeDecl->get_assertions(), *this );
     
    6767
    6868void Visitor::visit( TypeDecl *typeDecl ) {
    69         visit( static_cast< NamedTypeDecl* >( typeDecl ) );
     69        handleNamedTypeDecl( static_cast< NamedTypeDecl* >( typeDecl ) );
    7070}
    7171
    7272void Visitor::visit( TypedefDecl *typeDecl ) {
    73         visit( static_cast< NamedTypeDecl* >( typeDecl ) );
     73        handleNamedTypeDecl( static_cast< NamedTypeDecl* >( typeDecl ) );
    7474}
    7575
     
    109109void Visitor::visit( SwitchStmt *switchStmt ) {
    110110        maybeAccept( switchStmt->get_condition(), *this );
    111         acceptAll( switchStmt->get_branches(), *this );
    112 }
    113 
    114 void Visitor::visit( ChooseStmt *switchStmt ) {
    115         maybeAccept( switchStmt->get_condition(), *this );
    116         acceptAll( switchStmt->get_branches(), *this );
    117 }
    118 
    119 void Visitor::visit( FallthruStmt *fallthruStmt ) {}
     111        acceptAll( switchStmt->get_statements(), *this );
     112}
    120113
    121114void Visitor::visit( CaseStmt *caseStmt ) {
     
    150143void Visitor::visit( DeclStmt *declStmt ) {
    151144        maybeAccept( declStmt->get_decl(), *this );
     145}
     146
     147void Visitor::visit( ImplicitCtorDtorStmt *impCtorDtorStmt ) {
     148        maybeAccept( impCtorDtorStmt->get_callStmt(), *this );
    152149}
    153150
     
    210207}
    211208
     209void 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
     218void Visitor::visit( UntypedOffsetofExpr *offsetofExpr ) {
     219        acceptAll( offsetofExpr->get_results(), *this );
     220        maybeAccept( offsetofExpr->get_type(), *this );
     221}
     222
     223void Visitor::visit( OffsetofExpr *offsetofExpr ) {
     224        acceptAll( offsetofExpr->get_results(), *this );
     225        maybeAccept( offsetofExpr->get_type(), *this );
     226        maybeAccept( offsetofExpr->get_member(), *this );
     227}
     228
     229void Visitor::visit( OffsetPackExpr *offsetPackExpr ) {
     230        acceptAll( offsetPackExpr->get_results(), *this );
     231        maybeAccept( offsetPackExpr->get_type(), *this );
     232}
     233
    212234void Visitor::visit( AttrExpr *attrExpr ) {
    213235        acceptAll( attrExpr->get_results(), *this );
     
    259281}
    260282
     283void Visitor::visit( ImplicitCopyCtorExpr *impCpCtorExpr ) {
     284        maybeAccept( impCpCtorExpr->get_callExpr(), *this );
     285        acceptAll( impCpCtorExpr->get_tempDecls(), *this );
     286        acceptAll( impCpCtorExpr->get_returnDecls(), *this );
     287}
     288
    261289void Visitor::visit( UntypedValofExpr *valofExpr ) {
    262290        acceptAll( valofExpr->get_results(), *this );
    263291        maybeAccept( valofExpr->get_body(), *this );
     292}
     293
     294void Visitor::visit( CompoundLiteralExpr *compLitExpr ) {
     295        acceptAll( compLitExpr->get_results(), *this );
     296        maybeAccept( compLitExpr->get_type(), *this );
     297        maybeAccept( compLitExpr->get_initializer(), *this );
     298}
     299
     300void Visitor::visit( RangeExpr *rangeExpr ) {
     301        maybeAccept( rangeExpr->get_low(), *this );
     302        maybeAccept( rangeExpr->get_high(), *this );
    264303}
    265304
     
    289328}
    290329
    291 void Visitor::visit( ReferenceToType *aggregateUseType ) {
     330void Visitor::handleReferenceToType( ReferenceToType *aggregateUseType ) {
    292331        acceptAll( aggregateUseType->get_forall(), *this );
    293332        acceptAll( aggregateUseType->get_parameters(), *this );
     
    295334
    296335void Visitor::visit( StructInstType *aggregateUseType ) {
    297         visit( static_cast< ReferenceToType * >( aggregateUseType ) );
     336        handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );
    298337}
    299338
    300339void Visitor::visit( UnionInstType *aggregateUseType ) {
    301         visit( static_cast< ReferenceToType * >( aggregateUseType ) );
     340        handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );
    302341}
    303342
    304343void Visitor::visit( EnumInstType *aggregateUseType ) {
    305         visit( static_cast< ReferenceToType * >( aggregateUseType ) );
    306 }
    307 
    308 void Visitor::visit( ContextInstType *aggregateUseType ) {
    309         visit( static_cast< ReferenceToType * >( aggregateUseType ) );
     344        handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );
     345}
     346
     347void Visitor::visit( TraitInstType *aggregateUseType ) {
     348        handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );
    310349        acceptAll( aggregateUseType->get_members(), *this );
    311350}
    312351
    313352void Visitor::visit( TypeInstType *aggregateUseType ) {
    314         visit( static_cast< ReferenceToType * >( aggregateUseType ) );
     353        handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );
    315354}
    316355
     
    335374}
    336375
     376void Visitor::visit( VarArgsType *varArgsType ) {
     377        acceptAll( varArgsType->get_forall(), *this );
     378}
     379
    337380void Visitor::visit( SingleInit *singleInit ) {
    338381        singleInit->get_value()->accept( *this );
     
    342385        acceptAll( listInit->get_designators(), *this );
    343386        acceptAll( listInit->get_initializers(), *this );
     387}
     388
     389void Visitor::visit( ConstructorInit *ctorInit ) {
     390        maybeAccept( ctorInit->get_ctor(), *this );
     391        maybeAccept( ctorInit->get_init(), *this );
    344392}
    345393
Note: See TracChangeset for help on using the changeset viewer.