Changes in src/SynTree/Visitor.cc [8688ce1:7f5566b]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Visitor.cc
r8688ce1 r7f5566b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Visitor.cc -- 7 // Visitor.cc -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 4 11:24:25 201613 // Update Count : 2112 // Last Modified On : Fri Jul 24 16:11:05 2015 13 // Update Count : 15 14 14 // 15 15 … … 39 39 } 40 40 41 void Visitor:: handleAggregateDecl( AggregateDecl *aggregateDecl ) {41 void Visitor::visit( AggregateDecl *aggregateDecl ) { 42 42 acceptAll( aggregateDecl->get_parameters(), *this ); 43 43 acceptAll( aggregateDecl->get_members(), *this ); … … 45 45 46 46 void Visitor::visit( StructDecl *aggregateDecl ) { 47 handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) );47 visit( static_cast< AggregateDecl* >( aggregateDecl ) ); 48 48 } 49 49 50 50 void Visitor::visit( UnionDecl *aggregateDecl ) { 51 handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) );51 visit( static_cast< AggregateDecl* >( aggregateDecl ) ); 52 52 } 53 53 54 54 void 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 58 void Visitor::visit( ContextDecl *aggregateDecl ) { 59 visit( static_cast< AggregateDecl* >( aggregateDecl ) ); 60 } 61 62 void Visitor::visit( NamedTypeDecl *typeDecl ) { 63 63 acceptAll( typeDecl->get_parameters(), *this ); 64 64 acceptAll( typeDecl->get_assertions(), *this ); … … 67 67 68 68 void Visitor::visit( TypeDecl *typeDecl ) { 69 handleNamedTypeDecl( static_cast< NamedTypeDecl* >( typeDecl ) );69 visit( static_cast< NamedTypeDecl* >( typeDecl ) ); 70 70 } 71 71 72 72 void Visitor::visit( TypedefDecl *typeDecl ) { 73 handleNamedTypeDecl( static_cast< NamedTypeDecl* >( typeDecl ) );73 visit( static_cast< NamedTypeDecl* >( typeDecl ) ); 74 74 } 75 75 … … 109 109 void Visitor::visit( SwitchStmt *switchStmt ) { 110 110 maybeAccept( switchStmt->get_condition(), *this ); 111 acceptAll( switchStmt->get_statements(), *this ); 112 } 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 ) {} 113 120 114 121 void Visitor::visit( CaseStmt *caseStmt ) { … … 143 150 void Visitor::visit( DeclStmt *declStmt ) { 144 151 maybeAccept( declStmt->get_decl(), *this ); 145 }146 147 void Visitor::visit( ImplicitCtorDtorStmt *impCtorDtorStmt ) {148 maybeAccept( impCtorDtorStmt->get_callStmt(), *this );149 152 } 150 153 … … 207 210 } 208 211 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 234 212 void Visitor::visit( AttrExpr *attrExpr ) { 235 213 acceptAll( attrExpr->get_results(), *this ); … … 281 259 } 282 260 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 289 261 void Visitor::visit( UntypedValofExpr *valofExpr ) { 290 262 acceptAll( valofExpr->get_results(), *this ); 291 263 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 );303 264 } 304 265 … … 328 289 } 329 290 330 void Visitor:: handleReferenceToType( ReferenceToType *aggregateUseType ) {291 void Visitor::visit( ReferenceToType *aggregateUseType ) { 331 292 acceptAll( aggregateUseType->get_forall(), *this ); 332 293 acceptAll( aggregateUseType->get_parameters(), *this ); … … 334 295 335 296 void Visitor::visit( StructInstType *aggregateUseType ) { 336 handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );297 visit( static_cast< ReferenceToType * >( aggregateUseType ) ); 337 298 } 338 299 339 300 void Visitor::visit( UnionInstType *aggregateUseType ) { 340 handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );301 visit( static_cast< ReferenceToType * >( aggregateUseType ) ); 341 302 } 342 303 343 304 void 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 308 void Visitor::visit( ContextInstType *aggregateUseType ) { 309 visit( static_cast< ReferenceToType * >( aggregateUseType ) ); 349 310 acceptAll( aggregateUseType->get_members(), *this ); 350 311 } 351 312 352 313 void Visitor::visit( TypeInstType *aggregateUseType ) { 353 handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) );314 visit( static_cast< ReferenceToType * >( aggregateUseType ) ); 354 315 } 355 316 … … 374 335 } 375 336 376 void Visitor::visit( VarArgsType *varArgsType ) {377 acceptAll( varArgsType->get_forall(), *this );378 }379 380 337 void Visitor::visit( SingleInit *singleInit ) { 381 338 singleInit->get_value()->accept( *this ); … … 385 342 acceptAll( listInit->get_designators(), *this ); 386 343 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 );392 344 } 393 345
Note:
See TracChangeset
for help on using the changeset viewer.