Changes in src/SynTree/Visitor.cc [7f5566b:8688ce1]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Visitor.cc
r7f5566b r8688ce1 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 : Fri Jul 24 16:11:05 201513 // Update Count : 1512 // Last Modified On : Thu Aug 4 11:24:25 2016 13 // Update Count : 21 14 14 // 15 15 … … 39 39 } 40 40 41 void Visitor:: visit( AggregateDecl *aggregateDecl ) {41 void Visitor::handleAggregateDecl( 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 visit( static_cast< AggregateDecl* >( aggregateDecl ) );47 handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) ); 48 48 } 49 49 50 50 void Visitor::visit( UnionDecl *aggregateDecl ) { 51 visit( static_cast< AggregateDecl* >( aggregateDecl ) );51 handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) ); 52 52 } 53 53 54 54 void 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 58 void Visitor::visit( TraitDecl *aggregateDecl ) { 59 handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) ); 60 } 61 62 void Visitor::handleNamedTypeDecl( 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 visit( static_cast< NamedTypeDecl* >( typeDecl ) );69 handleNamedTypeDecl( static_cast< NamedTypeDecl* >( typeDecl ) ); 70 70 } 71 71 72 72 void Visitor::visit( TypedefDecl *typeDecl ) { 73 visit( static_cast< NamedTypeDecl* >( typeDecl ) );73 handleNamedTypeDecl( 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_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 } 120 113 121 114 void Visitor::visit( CaseStmt *caseStmt ) { … … 150 143 void Visitor::visit( DeclStmt *declStmt ) { 151 144 maybeAccept( declStmt->get_decl(), *this ); 145 } 146 147 void Visitor::visit( ImplicitCtorDtorStmt *impCtorDtorStmt ) { 148 maybeAccept( impCtorDtorStmt->get_callStmt(), *this ); 152 149 } 153 150 … … 210 207 } 211 208 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 212 234 void Visitor::visit( AttrExpr *attrExpr ) { 213 235 acceptAll( attrExpr->get_results(), *this ); … … 259 281 } 260 282 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 261 289 void Visitor::visit( UntypedValofExpr *valofExpr ) { 262 290 acceptAll( valofExpr->get_results(), *this ); 263 291 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 ); 264 303 } 265 304 … … 289 328 } 290 329 291 void Visitor:: visit( ReferenceToType *aggregateUseType ) {330 void Visitor::handleReferenceToType( ReferenceToType *aggregateUseType ) { 292 331 acceptAll( aggregateUseType->get_forall(), *this ); 293 332 acceptAll( aggregateUseType->get_parameters(), *this ); … … 295 334 296 335 void Visitor::visit( StructInstType *aggregateUseType ) { 297 visit( static_cast< ReferenceToType * >( aggregateUseType ) );336 handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) ); 298 337 } 299 338 300 339 void Visitor::visit( UnionInstType *aggregateUseType ) { 301 visit( static_cast< ReferenceToType * >( aggregateUseType ) );340 handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) ); 302 341 } 303 342 304 343 void 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 347 void Visitor::visit( TraitInstType *aggregateUseType ) { 348 handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) ); 310 349 acceptAll( aggregateUseType->get_members(), *this ); 311 350 } 312 351 313 352 void Visitor::visit( TypeInstType *aggregateUseType ) { 314 visit( static_cast< ReferenceToType * >( aggregateUseType ) );353 handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) ); 315 354 } 316 355 … … 335 374 } 336 375 376 void Visitor::visit( VarArgsType *varArgsType ) { 377 acceptAll( varArgsType->get_forall(), *this ); 378 } 379 337 380 void Visitor::visit( SingleInit *singleInit ) { 338 381 singleInit->get_value()->accept( *this ); … … 342 385 acceptAll( listInit->get_designators(), *this ); 343 386 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 ); 344 392 } 345 393
Note:
See TracChangeset
for help on using the changeset viewer.