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