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