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