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