[0dd3a2f] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
[71f4e4f] | 7 | // Visitor.cc -- |
---|
[0dd3a2f] | 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Mon May 18 07:44:20 2015 |
---|
[4e06c1e] | 11 | // Last Modified By : Peter A. Buhr |
---|
[fbcde64] | 12 | // Last Modified On : Thu Mar 30 16:45:25 2017 |
---|
| 13 | // Update Count : 24 |
---|
[0dd3a2f] | 14 | // |
---|
| 15 | |
---|
[51b7345] | 16 | #include <cassert> |
---|
| 17 | #include "Visitor.h" |
---|
| 18 | #include "Initializer.h" |
---|
| 19 | #include "Statement.h" |
---|
| 20 | #include "Type.h" |
---|
| 21 | #include "Declaration.h" |
---|
| 22 | #include "Expression.h" |
---|
| 23 | #include "Constant.h" |
---|
| 24 | |
---|
[d9a0e76] | 25 | Visitor::Visitor() {} |
---|
[51b7345] | 26 | |
---|
[d9a0e76] | 27 | Visitor::~Visitor() {} |
---|
[51b7345] | 28 | |
---|
[0dd3a2f] | 29 | void Visitor::visit( ObjectDecl *objectDecl ) { |
---|
| 30 | maybeAccept( objectDecl->get_type(), *this ); |
---|
| 31 | maybeAccept( objectDecl->get_init(), *this ); |
---|
| 32 | maybeAccept( objectDecl->get_bitfieldWidth(), *this ); |
---|
[51b7345] | 33 | } |
---|
| 34 | |
---|
[0dd3a2f] | 35 | void Visitor::visit( FunctionDecl *functionDecl ) { |
---|
| 36 | maybeAccept( functionDecl->get_functionType(), *this ); |
---|
| 37 | maybeAccept( functionDecl->get_statements(), *this ); |
---|
[51b7345] | 38 | } |
---|
| 39 | |
---|
[1e1e15b] | 40 | void Visitor::handleAggregateDecl( AggregateDecl *aggregateDecl ) { |
---|
[0dd3a2f] | 41 | acceptAll( aggregateDecl->get_parameters(), *this ); |
---|
| 42 | acceptAll( aggregateDecl->get_members(), *this ); |
---|
[51b7345] | 43 | } |
---|
| 44 | |
---|
[0dd3a2f] | 45 | void Visitor::visit( StructDecl *aggregateDecl ) { |
---|
[1e1e15b] | 46 | handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) ); |
---|
[51b7345] | 47 | } |
---|
| 48 | |
---|
[0dd3a2f] | 49 | void Visitor::visit( UnionDecl *aggregateDecl ) { |
---|
[1e1e15b] | 50 | handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) ); |
---|
[51b7345] | 51 | } |
---|
| 52 | |
---|
[0dd3a2f] | 53 | void Visitor::visit( EnumDecl *aggregateDecl ) { |
---|
[1e1e15b] | 54 | handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) ); |
---|
[51b7345] | 55 | } |
---|
| 56 | |
---|
[4040425] | 57 | void Visitor::visit( TraitDecl *aggregateDecl ) { |
---|
[1e1e15b] | 58 | handleAggregateDecl( static_cast< AggregateDecl* >( aggregateDecl ) ); |
---|
[51b7345] | 59 | } |
---|
| 60 | |
---|
[1e1e15b] | 61 | void Visitor::handleNamedTypeDecl( NamedTypeDecl *typeDecl ) { |
---|
[0dd3a2f] | 62 | acceptAll( typeDecl->get_parameters(), *this ); |
---|
| 63 | acceptAll( typeDecl->get_assertions(), *this ); |
---|
| 64 | maybeAccept( typeDecl->get_base(), *this ); |
---|
[51b7345] | 65 | } |
---|
| 66 | |
---|
[0dd3a2f] | 67 | void Visitor::visit( TypeDecl *typeDecl ) { |
---|
[1e1e15b] | 68 | handleNamedTypeDecl( static_cast< NamedTypeDecl* >( typeDecl ) ); |
---|
[51b7345] | 69 | } |
---|
| 70 | |
---|
[0dd3a2f] | 71 | void Visitor::visit( TypedefDecl *typeDecl ) { |
---|
[1e1e15b] | 72 | handleNamedTypeDecl( static_cast< NamedTypeDecl* >( typeDecl ) ); |
---|
[51b7345] | 73 | } |
---|
| 74 | |
---|
[e994912] | 75 | void Visitor::visit( AsmDecl *asmDecl ) { |
---|
| 76 | maybeAccept( asmDecl->get_stmt(), *this ); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | |
---|
[0dd3a2f] | 80 | void Visitor::visit( CompoundStmt *compoundStmt ) { |
---|
| 81 | acceptAll( compoundStmt->get_kids(), *this ); |
---|
[51b7345] | 82 | } |
---|
| 83 | |
---|
[0dd3a2f] | 84 | void Visitor::visit( ExprStmt *exprStmt ) { |
---|
| 85 | maybeAccept( exprStmt->get_expr(), *this ); |
---|
[51b7345] | 86 | } |
---|
| 87 | |
---|
[7f5566b] | 88 | void Visitor::visit( AsmStmt *asmStmt ) { |
---|
| 89 | maybeAccept( asmStmt->get_instruction(), *this ); |
---|
| 90 | acceptAll( asmStmt->get_output(), *this ); |
---|
| 91 | acceptAll( asmStmt->get_input(), *this ); |
---|
| 92 | acceptAll( asmStmt->get_clobber(), *this ); |
---|
| 93 | } |
---|
| 94 | |
---|
[0dd3a2f] | 95 | void Visitor::visit( IfStmt *ifStmt ) { |
---|
| 96 | maybeAccept( ifStmt->get_condition(), *this ); |
---|
| 97 | maybeAccept( ifStmt->get_thenPart(), *this ); |
---|
| 98 | maybeAccept( ifStmt->get_elsePart(), *this ); |
---|
[51b7345] | 99 | } |
---|
| 100 | |
---|
[0dd3a2f] | 101 | void Visitor::visit( WhileStmt *whileStmt ) { |
---|
| 102 | maybeAccept( whileStmt->get_condition(), *this ); |
---|
| 103 | maybeAccept( whileStmt->get_body(), *this ); |
---|
[51b7345] | 104 | } |
---|
| 105 | |
---|
[0dd3a2f] | 106 | void Visitor::visit( ForStmt *forStmt ) { |
---|
[145f1fc] | 107 | acceptAll( forStmt->get_initialization(), *this ); |
---|
[0dd3a2f] | 108 | maybeAccept( forStmt->get_condition(), *this ); |
---|
| 109 | maybeAccept( forStmt->get_increment(), *this ); |
---|
| 110 | maybeAccept( forStmt->get_body(), *this ); |
---|
[51b7345] | 111 | } |
---|
| 112 | |
---|
[0dd3a2f] | 113 | void Visitor::visit( SwitchStmt *switchStmt ) { |
---|
| 114 | maybeAccept( switchStmt->get_condition(), *this ); |
---|
[8688ce1] | 115 | acceptAll( switchStmt->get_statements(), *this ); |
---|
[51b7345] | 116 | } |
---|
| 117 | |
---|
[0dd3a2f] | 118 | void Visitor::visit( CaseStmt *caseStmt ) { |
---|
| 119 | maybeAccept( caseStmt->get_condition(), *this ); |
---|
| 120 | acceptAll( caseStmt->get_statements(), *this ); |
---|
[51b7345] | 121 | } |
---|
| 122 | |
---|
[0dd3a2f] | 123 | void Visitor::visit( BranchStmt *branchStmt ) { |
---|
[51b7345] | 124 | } |
---|
| 125 | |
---|
[0dd3a2f] | 126 | void Visitor::visit( ReturnStmt *returnStmt ) { |
---|
| 127 | maybeAccept( returnStmt->get_expr(), *this ); |
---|
[51b7345] | 128 | } |
---|
| 129 | |
---|
[0dd3a2f] | 130 | void Visitor::visit( TryStmt *tryStmt ) { |
---|
| 131 | maybeAccept( tryStmt->get_block(), *this ); |
---|
| 132 | acceptAll( tryStmt->get_catchers(), *this ); |
---|
[51b7345] | 133 | } |
---|
| 134 | |
---|
[0dd3a2f] | 135 | void Visitor::visit( CatchStmt *catchStmt ) { |
---|
| 136 | maybeAccept( catchStmt->get_decl(), *this ); |
---|
| 137 | maybeAccept( catchStmt->get_body(), *this ); |
---|
[51b7345] | 138 | } |
---|
| 139 | |
---|
[0dd3a2f] | 140 | void Visitor::visit( FinallyStmt *finalStmt ) { |
---|
| 141 | maybeAccept( finalStmt->get_block(), *this ); |
---|
[51b7345] | 142 | } |
---|
| 143 | |
---|
[0dd3a2f] | 144 | void Visitor::visit( NullStmt *nullStmt ) { |
---|
[51b7345] | 145 | } |
---|
| 146 | |
---|
[0dd3a2f] | 147 | void Visitor::visit( DeclStmt *declStmt ) { |
---|
| 148 | maybeAccept( declStmt->get_decl(), *this ); |
---|
[51b7345] | 149 | } |
---|
| 150 | |
---|
[f1b1e4c] | 151 | void Visitor::visit( ImplicitCtorDtorStmt *impCtorDtorStmt ) { |
---|
| 152 | maybeAccept( impCtorDtorStmt->get_callStmt(), *this ); |
---|
| 153 | } |
---|
| 154 | |
---|
[e994912] | 155 | |
---|
[0dd3a2f] | 156 | void Visitor::visit( ApplicationExpr *applicationExpr ) { |
---|
[906e24d] | 157 | maybeAccept( applicationExpr->get_result(), *this ); |
---|
[0dd3a2f] | 158 | maybeAccept( applicationExpr->get_function(), *this ); |
---|
| 159 | acceptAll( applicationExpr->get_args(), *this ); |
---|
[51b7345] | 160 | } |
---|
| 161 | |
---|
[0dd3a2f] | 162 | void Visitor::visit( UntypedExpr *untypedExpr ) { |
---|
[906e24d] | 163 | maybeAccept( untypedExpr->get_result(), *this ); |
---|
[0dd3a2f] | 164 | acceptAll( untypedExpr->get_args(), *this ); |
---|
[51b7345] | 165 | } |
---|
| 166 | |
---|
[0dd3a2f] | 167 | void Visitor::visit( NameExpr *nameExpr ) { |
---|
[906e24d] | 168 | maybeAccept( nameExpr->get_result(), *this ); |
---|
[51b7345] | 169 | } |
---|
| 170 | |
---|
[0dd3a2f] | 171 | void Visitor::visit( AddressExpr *addressExpr ) { |
---|
[906e24d] | 172 | maybeAccept( addressExpr->get_result(), *this ); |
---|
[0dd3a2f] | 173 | maybeAccept( addressExpr->get_arg(), *this ); |
---|
[51b7345] | 174 | } |
---|
| 175 | |
---|
[0dd3a2f] | 176 | void Visitor::visit( LabelAddressExpr *labAddressExpr ) { |
---|
[906e24d] | 177 | maybeAccept( labAddressExpr->get_result(), *this ); |
---|
[0dd3a2f] | 178 | maybeAccept( labAddressExpr->get_arg(), *this ); |
---|
[51b7345] | 179 | } |
---|
| 180 | |
---|
[0dd3a2f] | 181 | void Visitor::visit( CastExpr *castExpr ) { |
---|
[906e24d] | 182 | maybeAccept( castExpr->get_result(), *this ); |
---|
[0dd3a2f] | 183 | maybeAccept( castExpr->get_arg(), *this ); |
---|
[51b7345] | 184 | } |
---|
| 185 | |
---|
[0dd3a2f] | 186 | void Visitor::visit( UntypedMemberExpr *memberExpr ) { |
---|
[906e24d] | 187 | maybeAccept( memberExpr->get_result(), *this ); |
---|
[0dd3a2f] | 188 | maybeAccept( memberExpr->get_aggregate(), *this ); |
---|
[3b58d91] | 189 | maybeAccept( memberExpr->get_member(), *this ); |
---|
[51b7345] | 190 | } |
---|
| 191 | |
---|
[0dd3a2f] | 192 | void Visitor::visit( MemberExpr *memberExpr ) { |
---|
[906e24d] | 193 | maybeAccept( memberExpr->get_result(), *this ); |
---|
[0dd3a2f] | 194 | maybeAccept( memberExpr->get_aggregate(), *this ); |
---|
[51b7345] | 195 | } |
---|
| 196 | |
---|
[0dd3a2f] | 197 | void Visitor::visit( VariableExpr *variableExpr ) { |
---|
[906e24d] | 198 | maybeAccept( variableExpr->get_result(), *this ); |
---|
[51b7345] | 199 | } |
---|
| 200 | |
---|
[0dd3a2f] | 201 | void Visitor::visit( ConstantExpr *constantExpr ) { |
---|
[906e24d] | 202 | maybeAccept( constantExpr->get_result(), *this ); |
---|
[0dd3a2f] | 203 | maybeAccept( constantExpr->get_constant(), *this ); |
---|
[51b7345] | 204 | } |
---|
| 205 | |
---|
[0dd3a2f] | 206 | void Visitor::visit( SizeofExpr *sizeofExpr ) { |
---|
[906e24d] | 207 | maybeAccept( sizeofExpr->get_result(), *this ); |
---|
[0dd3a2f] | 208 | if ( sizeofExpr->get_isType() ) { |
---|
| 209 | maybeAccept( sizeofExpr->get_type(), *this ); |
---|
| 210 | } else { |
---|
| 211 | maybeAccept( sizeofExpr->get_expr(), *this ); |
---|
| 212 | } |
---|
[51b7345] | 213 | } |
---|
| 214 | |
---|
[47534159] | 215 | void Visitor::visit( AlignofExpr *alignofExpr ) { |
---|
[906e24d] | 216 | maybeAccept( alignofExpr->get_result(), *this ); |
---|
[47534159] | 217 | if ( alignofExpr->get_isType() ) { |
---|
| 218 | maybeAccept( alignofExpr->get_type(), *this ); |
---|
| 219 | } else { |
---|
| 220 | maybeAccept( alignofExpr->get_expr(), *this ); |
---|
| 221 | } |
---|
| 222 | } |
---|
| 223 | |
---|
[2a4b088] | 224 | void Visitor::visit( UntypedOffsetofExpr *offsetofExpr ) { |
---|
[906e24d] | 225 | maybeAccept( offsetofExpr->get_result(), *this ); |
---|
[2a4b088] | 226 | maybeAccept( offsetofExpr->get_type(), *this ); |
---|
| 227 | } |
---|
| 228 | |
---|
[25a054f] | 229 | void Visitor::visit( OffsetofExpr *offsetofExpr ) { |
---|
[906e24d] | 230 | maybeAccept( offsetofExpr->get_result(), *this ); |
---|
[25a054f] | 231 | maybeAccept( offsetofExpr->get_type(), *this ); |
---|
| 232 | maybeAccept( offsetofExpr->get_member(), *this ); |
---|
| 233 | } |
---|
| 234 | |
---|
[afc1045] | 235 | void Visitor::visit( OffsetPackExpr *offsetPackExpr ) { |
---|
[906e24d] | 236 | maybeAccept( offsetPackExpr->get_result(), *this ); |
---|
[afc1045] | 237 | maybeAccept( offsetPackExpr->get_type(), *this ); |
---|
| 238 | } |
---|
| 239 | |
---|
[0dd3a2f] | 240 | void Visitor::visit( AttrExpr *attrExpr ) { |
---|
[906e24d] | 241 | maybeAccept( attrExpr->get_result(), *this ); |
---|
[0dd3a2f] | 242 | if ( attrExpr->get_isType() ) { |
---|
| 243 | maybeAccept( attrExpr->get_type(), *this ); |
---|
| 244 | } else { |
---|
| 245 | maybeAccept( attrExpr->get_expr(), *this ); |
---|
| 246 | } |
---|
[51b7345] | 247 | } |
---|
| 248 | |
---|
[0dd3a2f] | 249 | void Visitor::visit( LogicalExpr *logicalExpr ) { |
---|
[906e24d] | 250 | maybeAccept( logicalExpr->get_result(), *this ); |
---|
[0dd3a2f] | 251 | maybeAccept( logicalExpr->get_arg1(), *this ); |
---|
| 252 | maybeAccept( logicalExpr->get_arg2(), *this ); |
---|
[51b7345] | 253 | } |
---|
| 254 | |
---|
[0dd3a2f] | 255 | void Visitor::visit( ConditionalExpr *conditionalExpr ) { |
---|
[906e24d] | 256 | maybeAccept( conditionalExpr->get_result(), *this ); |
---|
[0dd3a2f] | 257 | maybeAccept( conditionalExpr->get_arg1(), *this ); |
---|
| 258 | maybeAccept( conditionalExpr->get_arg2(), *this ); |
---|
| 259 | maybeAccept( conditionalExpr->get_arg3(), *this ); |
---|
[51b7345] | 260 | } |
---|
| 261 | |
---|
[0dd3a2f] | 262 | void Visitor::visit( CommaExpr *commaExpr ) { |
---|
[906e24d] | 263 | maybeAccept( commaExpr->get_result(), *this ); |
---|
[0dd3a2f] | 264 | maybeAccept( commaExpr->get_arg1(), *this ); |
---|
| 265 | maybeAccept( commaExpr->get_arg2(), *this ); |
---|
[51b7345] | 266 | } |
---|
| 267 | |
---|
[0dd3a2f] | 268 | void Visitor::visit( TypeExpr *typeExpr ) { |
---|
[906e24d] | 269 | maybeAccept( typeExpr->get_result(), *this ); |
---|
[0dd3a2f] | 270 | maybeAccept( typeExpr->get_type(), *this ); |
---|
[51b7345] | 271 | } |
---|
| 272 | |
---|
[7f5566b] | 273 | void Visitor::visit( AsmExpr *asmExpr ) { |
---|
| 274 | maybeAccept( asmExpr->get_inout(), *this ); |
---|
| 275 | maybeAccept( asmExpr->get_constraint(), *this ); |
---|
| 276 | maybeAccept( asmExpr->get_operand(), *this ); |
---|
| 277 | } |
---|
| 278 | |
---|
[db4ecc5] | 279 | void Visitor::visit( ImplicitCopyCtorExpr *impCpCtorExpr ) { |
---|
[907eccb] | 280 | maybeAccept( impCpCtorExpr->get_result(), *this ); |
---|
[db4ecc5] | 281 | maybeAccept( impCpCtorExpr->get_callExpr(), *this ); |
---|
| 282 | acceptAll( impCpCtorExpr->get_tempDecls(), *this ); |
---|
[dc2e7e0] | 283 | acceptAll( impCpCtorExpr->get_returnDecls(), *this ); |
---|
[d5556a3] | 284 | acceptAll( impCpCtorExpr->get_dtors(), *this ); |
---|
[db4ecc5] | 285 | } |
---|
| 286 | |
---|
[b6fe7e6] | 287 | void Visitor::visit( ConstructorExpr * ctorExpr ) { |
---|
[906e24d] | 288 | maybeAccept( ctorExpr->get_result(), *this ); |
---|
[b6fe7e6] | 289 | maybeAccept( ctorExpr->get_callExpr(), *this ); |
---|
[51b7345] | 290 | } |
---|
| 291 | |
---|
[630a82a] | 292 | void Visitor::visit( CompoundLiteralExpr *compLitExpr ) { |
---|
[906e24d] | 293 | maybeAccept( compLitExpr->get_result(), *this ); |
---|
[630a82a] | 294 | maybeAccept( compLitExpr->get_initializer(), *this ); |
---|
| 295 | } |
---|
| 296 | |
---|
[b6fe7e6] | 297 | void Visitor::visit( UntypedValofExpr *valofExpr ) { |
---|
[906e24d] | 298 | maybeAccept( valofExpr->get_result(), *this ); |
---|
[b6fe7e6] | 299 | maybeAccept( valofExpr->get_body(), *this ); |
---|
| 300 | } |
---|
| 301 | |
---|
[8688ce1] | 302 | void Visitor::visit( RangeExpr *rangeExpr ) { |
---|
| 303 | maybeAccept( rangeExpr->get_low(), *this ); |
---|
| 304 | maybeAccept( rangeExpr->get_high(), *this ); |
---|
| 305 | } |
---|
| 306 | |
---|
[907eccb] | 307 | void Visitor::visit( UntypedTupleExpr *tupleExpr ) { |
---|
| 308 | maybeAccept( tupleExpr->get_result(), *this ); |
---|
| 309 | acceptAll( tupleExpr->get_exprs(), *this ); |
---|
| 310 | } |
---|
| 311 | |
---|
[6eb8948] | 312 | void Visitor::visit( TupleExpr *tupleExpr ) { |
---|
[aa8f9df] | 313 | maybeAccept( tupleExpr->get_result(), *this ); |
---|
[6eb8948] | 314 | acceptAll( tupleExpr->get_exprs(), *this ); |
---|
| 315 | } |
---|
| 316 | |
---|
[3b58d91] | 317 | void Visitor::visit( TupleIndexExpr *tupleExpr ) { |
---|
[aa8f9df] | 318 | maybeAccept( tupleExpr->get_result(), *this ); |
---|
[3b58d91] | 319 | maybeAccept( tupleExpr->get_tuple(), *this ); |
---|
| 320 | } |
---|
| 321 | |
---|
| 322 | void Visitor::visit( MemberTupleExpr *tupleExpr ) { |
---|
[aa8f9df] | 323 | maybeAccept( tupleExpr->get_result(), *this ); |
---|
[3b58d91] | 324 | maybeAccept( tupleExpr->get_member(), *this ); |
---|
| 325 | maybeAccept( tupleExpr->get_aggregate(), *this ); |
---|
| 326 | } |
---|
| 327 | |
---|
[6eb8948] | 328 | void Visitor::visit( TupleAssignExpr *assignExpr ) { |
---|
[aa8f9df] | 329 | maybeAccept( assignExpr->get_result(), *this ); |
---|
[d5556a3] | 330 | maybeAccept( assignExpr->get_stmtExpr(), *this ); |
---|
[3b58d91] | 331 | } |
---|
| 332 | |
---|
[6eb8948] | 333 | void Visitor::visit( StmtExpr *stmtExpr ) { |
---|
[aa8f9df] | 334 | maybeAccept( stmtExpr->get_result(), *this ); |
---|
[6eb8948] | 335 | maybeAccept( stmtExpr->get_statements(), *this ); |
---|
[d5556a3] | 336 | acceptAll( stmtExpr->get_returnDecls(), *this ); |
---|
| 337 | acceptAll( stmtExpr->get_dtors(), *this ); |
---|
[3b58d91] | 338 | } |
---|
| 339 | |
---|
[3c13c03] | 340 | void Visitor::visit( UniqueExpr *uniqueExpr ) { |
---|
| 341 | maybeAccept( uniqueExpr->get_result(), *this ); |
---|
| 342 | maybeAccept( uniqueExpr->get_expr(), *this ); |
---|
| 343 | } |
---|
| 344 | |
---|
[e994912] | 345 | |
---|
[0dd3a2f] | 346 | void Visitor::visit( VoidType *voidType ) { |
---|
| 347 | acceptAll( voidType->get_forall(), *this ); |
---|
[51b7345] | 348 | } |
---|
| 349 | |
---|
[0dd3a2f] | 350 | void Visitor::visit( BasicType *basicType ) { |
---|
| 351 | acceptAll( basicType->get_forall(), *this ); |
---|
[51b7345] | 352 | } |
---|
| 353 | |
---|
[0dd3a2f] | 354 | void Visitor::visit( PointerType *pointerType ) { |
---|
| 355 | acceptAll( pointerType->get_forall(), *this ); |
---|
| 356 | maybeAccept( pointerType->get_base(), *this ); |
---|
[51b7345] | 357 | } |
---|
| 358 | |
---|
[0dd3a2f] | 359 | void Visitor::visit( ArrayType *arrayType ) { |
---|
| 360 | acceptAll( arrayType->get_forall(), *this ); |
---|
| 361 | maybeAccept( arrayType->get_dimension(), *this ); |
---|
| 362 | maybeAccept( arrayType->get_base(), *this ); |
---|
[51b7345] | 363 | } |
---|
| 364 | |
---|
[0dd3a2f] | 365 | void Visitor::visit( FunctionType *functionType ) { |
---|
| 366 | acceptAll( functionType->get_forall(), *this ); |
---|
| 367 | acceptAll( functionType->get_returnVals(), *this ); |
---|
| 368 | acceptAll( functionType->get_parameters(), *this ); |
---|
[51b7345] | 369 | } |
---|
| 370 | |
---|
[1e1e15b] | 371 | void Visitor::handleReferenceToType( ReferenceToType *aggregateUseType ) { |
---|
[0dd3a2f] | 372 | acceptAll( aggregateUseType->get_forall(), *this ); |
---|
| 373 | acceptAll( aggregateUseType->get_parameters(), *this ); |
---|
[51b7345] | 374 | } |
---|
| 375 | |
---|
[0dd3a2f] | 376 | void Visitor::visit( StructInstType *aggregateUseType ) { |
---|
[1e1e15b] | 377 | handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) ); |
---|
[51b7345] | 378 | } |
---|
| 379 | |
---|
[0dd3a2f] | 380 | void Visitor::visit( UnionInstType *aggregateUseType ) { |
---|
[1e1e15b] | 381 | handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) ); |
---|
[51b7345] | 382 | } |
---|
| 383 | |
---|
[0dd3a2f] | 384 | void Visitor::visit( EnumInstType *aggregateUseType ) { |
---|
[1e1e15b] | 385 | handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) ); |
---|
[51b7345] | 386 | } |
---|
| 387 | |
---|
[4040425] | 388 | void Visitor::visit( TraitInstType *aggregateUseType ) { |
---|
[1e1e15b] | 389 | handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) ); |
---|
[0dd3a2f] | 390 | acceptAll( aggregateUseType->get_members(), *this ); |
---|
[51b7345] | 391 | } |
---|
| 392 | |
---|
[0dd3a2f] | 393 | void Visitor::visit( TypeInstType *aggregateUseType ) { |
---|
[1e1e15b] | 394 | handleReferenceToType( static_cast< ReferenceToType * >( aggregateUseType ) ); |
---|
[51b7345] | 395 | } |
---|
| 396 | |
---|
[0dd3a2f] | 397 | void Visitor::visit( TupleType *tupleType ) { |
---|
| 398 | acceptAll( tupleType->get_forall(), *this ); |
---|
| 399 | acceptAll( tupleType->get_types(), *this ); |
---|
[51b7345] | 400 | } |
---|
| 401 | |
---|
[0dd3a2f] | 402 | void Visitor::visit( TypeofType *typeofType ) { |
---|
| 403 | assert( typeofType->get_expr() ); |
---|
| 404 | typeofType->get_expr()->accept( *this ); |
---|
[51b7345] | 405 | } |
---|
| 406 | |
---|
[0dd3a2f] | 407 | void Visitor::visit( AttrType *attrType ) { |
---|
| 408 | if ( attrType->get_isType() ) { |
---|
| 409 | assert( attrType->get_type() ); |
---|
| 410 | attrType->get_type()->accept( *this ); |
---|
| 411 | } else { |
---|
| 412 | assert( attrType->get_expr() ); |
---|
| 413 | attrType->get_expr()->accept( *this ); |
---|
| 414 | } // if |
---|
[51b7345] | 415 | } |
---|
| 416 | |
---|
[44b7088] | 417 | void Visitor::visit( VarArgsType *varArgsType ) { |
---|
| 418 | acceptAll( varArgsType->get_forall(), *this ); |
---|
| 419 | } |
---|
| 420 | |
---|
[89e6ffc] | 421 | void Visitor::visit( ZeroType *zeroType ) { |
---|
| 422 | acceptAll( zeroType->get_forall(), *this ); |
---|
| 423 | } |
---|
| 424 | |
---|
| 425 | void Visitor::visit( OneType *oneType ) { |
---|
| 426 | acceptAll( oneType->get_forall(), *this ); |
---|
| 427 | } |
---|
| 428 | |
---|
[e994912] | 429 | |
---|
[0dd3a2f] | 430 | void Visitor::visit( SingleInit *singleInit ) { |
---|
| 431 | singleInit->get_value()->accept( *this ); |
---|
[51b7345] | 432 | } |
---|
| 433 | |
---|
[0dd3a2f] | 434 | void Visitor::visit( ListInit *listInit ) { |
---|
| 435 | acceptAll( listInit->get_designators(), *this ); |
---|
| 436 | acceptAll( listInit->get_initializers(), *this ); |
---|
[51b7345] | 437 | } |
---|
| 438 | |
---|
[71f4e4f] | 439 | void Visitor::visit( ConstructorInit *ctorInit ) { |
---|
| 440 | maybeAccept( ctorInit->get_ctor(), *this ); |
---|
[d5556a3] | 441 | maybeAccept( ctorInit->get_dtor(), *this ); |
---|
[71f4e4f] | 442 | maybeAccept( ctorInit->get_init(), *this ); |
---|
| 443 | } |
---|
| 444 | |
---|
[e994912] | 445 | |
---|
[0dd3a2f] | 446 | void Visitor::visit( Subrange *subrange ) {} |
---|
[51b7345] | 447 | |
---|
[e994912] | 448 | |
---|
[0dd3a2f] | 449 | void Visitor::visit( Constant *constant ) {} |
---|
| 450 | // Local Variables: // |
---|
| 451 | // tab-width: 4 // |
---|
| 452 | // mode: c++ // |
---|
| 453 | // compile-command: "make install" // |
---|
| 454 | // End: // |
---|