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