[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 | // |
---|
| 7 | // Mutator.cc -- |
---|
| 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Mon May 18 07:44:20 2015 |
---|
[1db21619] | 11 | // Last Modified By : Peter A. Buhr |
---|
[7f5566b] | 12 | // Last Modified On : Sat Jul 25 19:21:33 2015 |
---|
| 13 | // Update Count : 11 |
---|
[0dd3a2f] | 14 | // |
---|
| 15 | |
---|
[51b7345] | 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" |
---|
| 24 | #include "utility.h" |
---|
| 25 | |
---|
[d9a0e76] | 26 | Mutator::Mutator() {} |
---|
[51b7345] | 27 | |
---|
[d9a0e76] | 28 | Mutator::~Mutator() {} |
---|
[51b7345] | 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; |
---|
[51b7345] | 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; |
---|
[51b7345] | 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; |
---|
[51b7345] | 48 | } |
---|
| 49 | |
---|
[d9a0e76] | 50 | Declaration *Mutator::mutate( StructDecl *aggregateDecl ) { |
---|
[0dd3a2f] | 51 | handleAggregateDecl( aggregateDecl ); |
---|
| 52 | return aggregateDecl; |
---|
[51b7345] | 53 | } |
---|
| 54 | |
---|
[d9a0e76] | 55 | Declaration *Mutator::mutate( UnionDecl *aggregateDecl ) { |
---|
[0dd3a2f] | 56 | handleAggregateDecl( aggregateDecl ); |
---|
| 57 | return aggregateDecl; |
---|
[51b7345] | 58 | } |
---|
| 59 | |
---|
[d9a0e76] | 60 | Declaration *Mutator::mutate( EnumDecl *aggregateDecl ) { |
---|
[0dd3a2f] | 61 | handleAggregateDecl( aggregateDecl ); |
---|
| 62 | return aggregateDecl; |
---|
[51b7345] | 63 | } |
---|
| 64 | |
---|
[d9a0e76] | 65 | Declaration *Mutator::mutate( ContextDecl *aggregateDecl ) { |
---|
[0dd3a2f] | 66 | handleAggregateDecl( aggregateDecl ); |
---|
| 67 | return aggregateDecl; |
---|
[51b7345] | 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; |
---|
[51b7345] | 75 | } |
---|
| 76 | |
---|
[d9a0e76] | 77 | TypeDecl *Mutator::mutate( TypeDecl *typeDecl ) { |
---|
[0dd3a2f] | 78 | handleNamedTypeDecl( typeDecl ); |
---|
| 79 | return typeDecl; |
---|
[51b7345] | 80 | } |
---|
| 81 | |
---|
[d9a0e76] | 82 | Declaration *Mutator::mutate( TypedefDecl *typeDecl ) { |
---|
[0dd3a2f] | 83 | handleNamedTypeDecl( typeDecl ); |
---|
| 84 | return typeDecl; |
---|
[51b7345] | 85 | } |
---|
| 86 | |
---|
[d9a0e76] | 87 | CompoundStmt *Mutator::mutate( CompoundStmt *compoundStmt ) { |
---|
[0dd3a2f] | 88 | mutateAll( compoundStmt->get_kids(), *this ); |
---|
| 89 | return compoundStmt; |
---|
[51b7345] | 90 | } |
---|
| 91 | |
---|
[d9a0e76] | 92 | Statement *Mutator::mutate( ExprStmt *exprStmt ) { |
---|
[0dd3a2f] | 93 | exprStmt->set_expr( maybeMutate( exprStmt->get_expr(), *this ) ); |
---|
| 94 | return exprStmt; |
---|
[51b7345] | 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; |
---|
[51b7345] | 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; |
---|
[51b7345] | 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; |
---|
[51b7345] | 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; |
---|
[51b7345] | 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; |
---|
[51b7345] | 136 | } |
---|
| 137 | |
---|
[d9a0e76] | 138 | Statement *Mutator::mutate( FallthruStmt *fallthruStmt ) { |
---|
[0dd3a2f] | 139 | return fallthruStmt; |
---|
[51b7345] | 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 ); |
---|
[51b7345] | 145 | |
---|
[0dd3a2f] | 146 | return caseStmt; |
---|
[51b7345] | 147 | } |
---|
| 148 | |
---|
[d9a0e76] | 149 | Statement *Mutator::mutate( BranchStmt *branchStmt ) { |
---|
[0dd3a2f] | 150 | return branchStmt; |
---|
[51b7345] | 151 | } |
---|
| 152 | |
---|
[d9a0e76] | 153 | Statement *Mutator::mutate( ReturnStmt *returnStmt ) { |
---|
[0dd3a2f] | 154 | returnStmt->set_expr( maybeMutate( returnStmt->get_expr(), *this ) ); |
---|
| 155 | return returnStmt; |
---|
[51b7345] | 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; |
---|
[51b7345] | 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; |
---|
[51b7345] | 168 | } |
---|
| 169 | |
---|
[d9a0e76] | 170 | Statement *Mutator::mutate( FinallyStmt *finalStmt ) { |
---|
[0dd3a2f] | 171 | finalStmt->set_block( maybeMutate( finalStmt->get_block(), *this ) ); |
---|
| 172 | return finalStmt; |
---|
[51b7345] | 173 | } |
---|
| 174 | |
---|
[d9a0e76] | 175 | NullStmt *Mutator::mutate( NullStmt *nullStmt ) { |
---|
[0dd3a2f] | 176 | return nullStmt; |
---|
[51b7345] | 177 | } |
---|
| 178 | |
---|
[d9a0e76] | 179 | Statement *Mutator::mutate( DeclStmt *declStmt ) { |
---|
[0dd3a2f] | 180 | declStmt->set_decl( maybeMutate( declStmt->get_decl(), *this ) ); |
---|
| 181 | return declStmt; |
---|
[51b7345] | 182 | } |
---|
| 183 | |
---|
[d9a0e76] | 184 | Expression *Mutator::mutate( ApplicationExpr *applicationExpr ) { |
---|
[0dd3a2f] | 185 | mutateAll( applicationExpr->get_results(), *this ); |
---|
| 186 | applicationExpr->set_function( maybeMutate( applicationExpr->get_function(), *this ) ); |
---|
| 187 | mutateAll( applicationExpr->get_args(), *this ); |
---|
| 188 | return applicationExpr; |
---|
[51b7345] | 189 | } |
---|
| 190 | |
---|
[d9a0e76] | 191 | Expression *Mutator::mutate( UntypedExpr *untypedExpr ) { |
---|
[0dd3a2f] | 192 | mutateAll( untypedExpr->get_results(), *this ); |
---|
| 193 | mutateAll( untypedExpr->get_args(), *this ); |
---|
| 194 | return untypedExpr; |
---|
[51b7345] | 195 | } |
---|
| 196 | |
---|
[d9a0e76] | 197 | Expression *Mutator::mutate( NameExpr *nameExpr ) { |
---|
[0dd3a2f] | 198 | mutateAll( nameExpr->get_results(), *this ); |
---|
| 199 | return nameExpr; |
---|
[51b7345] | 200 | } |
---|
| 201 | |
---|
[d9a0e76] | 202 | Expression *Mutator::mutate( AddressExpr *addressExpr ) { |
---|
[0dd3a2f] | 203 | mutateAll( addressExpr->get_results(), *this ); |
---|
| 204 | addressExpr->set_arg( maybeMutate( addressExpr->get_arg(), *this ) ); |
---|
| 205 | return addressExpr; |
---|
[51b7345] | 206 | } |
---|
| 207 | |
---|
[d9a0e76] | 208 | Expression *Mutator::mutate( LabelAddressExpr *labelAddressExpr ) { |
---|
[0dd3a2f] | 209 | mutateAll( labelAddressExpr->get_results(), *this ); |
---|
| 210 | labelAddressExpr->set_arg( maybeMutate( labelAddressExpr->get_arg(), *this ) ); |
---|
| 211 | return labelAddressExpr; |
---|
[51b7345] | 212 | } |
---|
| 213 | |
---|
[d9a0e76] | 214 | Expression *Mutator::mutate( CastExpr *castExpr ) { |
---|
[0dd3a2f] | 215 | mutateAll( castExpr->get_results(), *this ); |
---|
| 216 | castExpr->set_arg( maybeMutate( castExpr->get_arg(), *this ) ); |
---|
| 217 | return castExpr; |
---|
[51b7345] | 218 | } |
---|
| 219 | |
---|
[d9a0e76] | 220 | Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) { |
---|
[0dd3a2f] | 221 | mutateAll( memberExpr->get_results(), *this ); |
---|
| 222 | memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) ); |
---|
| 223 | return memberExpr; |
---|
[51b7345] | 224 | } |
---|
| 225 | |
---|
[d9a0e76] | 226 | Expression *Mutator::mutate( MemberExpr *memberExpr ) { |
---|
[0dd3a2f] | 227 | mutateAll( memberExpr->get_results(), *this ); |
---|
| 228 | memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) ); |
---|
| 229 | return memberExpr; |
---|
[51b7345] | 230 | } |
---|
| 231 | |
---|
[d9a0e76] | 232 | Expression *Mutator::mutate( VariableExpr *variableExpr ) { |
---|
[0dd3a2f] | 233 | mutateAll( variableExpr->get_results(), *this ); |
---|
| 234 | return variableExpr; |
---|
[51b7345] | 235 | } |
---|
| 236 | |
---|
[d9a0e76] | 237 | Expression *Mutator::mutate( ConstantExpr *constantExpr ) { |
---|
[0dd3a2f] | 238 | mutateAll( constantExpr->get_results(), *this ); |
---|
[51b7345] | 239 | // maybeMutate( constantExpr->get_constant(), *this ) |
---|
[0dd3a2f] | 240 | return constantExpr; |
---|
[51b7345] | 241 | } |
---|
| 242 | |
---|
[d9a0e76] | 243 | Expression *Mutator::mutate( SizeofExpr *sizeofExpr ) { |
---|
[0dd3a2f] | 244 | mutateAll( sizeofExpr->get_results(), *this ); |
---|
| 245 | if ( sizeofExpr->get_isType() ) { |
---|
| 246 | sizeofExpr->set_type( maybeMutate( sizeofExpr->get_type(), *this ) ); |
---|
| 247 | } else { |
---|
| 248 | sizeofExpr->set_expr( maybeMutate( sizeofExpr->get_expr(), *this ) ); |
---|
| 249 | } |
---|
| 250 | return sizeofExpr; |
---|
[51b7345] | 251 | } |
---|
| 252 | |
---|
[d9a0e76] | 253 | Expression *Mutator::mutate( AttrExpr *attrExpr ) { |
---|
[0dd3a2f] | 254 | mutateAll( attrExpr->get_results(), *this ); |
---|
| 255 | if ( attrExpr->get_isType() ) { |
---|
| 256 | attrExpr->set_type( maybeMutate( attrExpr->get_type(), *this ) ); |
---|
| 257 | } else { |
---|
| 258 | attrExpr->set_expr( maybeMutate( attrExpr->get_expr(), *this ) ); |
---|
| 259 | } |
---|
| 260 | return attrExpr; |
---|
[51b7345] | 261 | } |
---|
| 262 | |
---|
[d9a0e76] | 263 | Expression *Mutator::mutate( LogicalExpr *logicalExpr ) { |
---|
[0dd3a2f] | 264 | mutateAll( logicalExpr->get_results(), *this ); |
---|
| 265 | logicalExpr->set_arg1( maybeMutate( logicalExpr->get_arg1(), *this ) ); |
---|
| 266 | logicalExpr->set_arg2( maybeMutate( logicalExpr->get_arg2(), *this ) ); |
---|
| 267 | return logicalExpr; |
---|
[51b7345] | 268 | } |
---|
| 269 | |
---|
[d9a0e76] | 270 | Expression *Mutator::mutate( ConditionalExpr *conditionalExpr ) { |
---|
[0dd3a2f] | 271 | mutateAll( conditionalExpr->get_results(), *this ); |
---|
| 272 | conditionalExpr->set_arg1( maybeMutate( conditionalExpr->get_arg1(), *this ) ); |
---|
| 273 | conditionalExpr->set_arg2( maybeMutate( conditionalExpr->get_arg2(), *this ) ); |
---|
| 274 | conditionalExpr->set_arg3( maybeMutate( conditionalExpr->get_arg3(), *this ) ); |
---|
| 275 | return conditionalExpr; |
---|
[51b7345] | 276 | } |
---|
| 277 | |
---|
[d9a0e76] | 278 | Expression *Mutator::mutate( CommaExpr *commaExpr ) { |
---|
[0dd3a2f] | 279 | mutateAll( commaExpr->get_results(), *this ); |
---|
| 280 | commaExpr->set_arg1( maybeMutate( commaExpr->get_arg1(), *this ) ); |
---|
| 281 | commaExpr->set_arg2( maybeMutate( commaExpr->get_arg2(), *this ) ); |
---|
| 282 | return commaExpr; |
---|
[51b7345] | 283 | } |
---|
| 284 | |
---|
[d9a0e76] | 285 | Expression *Mutator::mutate( TupleExpr *tupleExpr ) { |
---|
[0dd3a2f] | 286 | mutateAll( tupleExpr->get_results(), *this ); |
---|
| 287 | mutateAll( tupleExpr->get_exprs(), *this ); |
---|
| 288 | return tupleExpr; |
---|
[51b7345] | 289 | } |
---|
| 290 | |
---|
[d9a0e76] | 291 | Expression *Mutator::mutate( SolvedTupleExpr *tupleExpr ) { |
---|
[0dd3a2f] | 292 | mutateAll( tupleExpr->get_results(), *this ); |
---|
| 293 | mutateAll( tupleExpr->get_exprs(), *this ); |
---|
| 294 | return tupleExpr; |
---|
[51b7345] | 295 | } |
---|
| 296 | |
---|
[d9a0e76] | 297 | Expression *Mutator::mutate( TypeExpr *typeExpr ) { |
---|
[0dd3a2f] | 298 | mutateAll( typeExpr->get_results(), *this ); |
---|
| 299 | typeExpr->set_type( maybeMutate( typeExpr->get_type(), *this ) ); |
---|
| 300 | return typeExpr; |
---|
[51b7345] | 301 | } |
---|
| 302 | |
---|
[7f5566b] | 303 | Expression *Mutator::mutate( AsmExpr *asmExpr ) { |
---|
| 304 | asmExpr->set_inout( maybeMutate( asmExpr->get_inout(), *this ) ); |
---|
| 305 | asmExpr->set_constraint( maybeMutate( asmExpr->get_constraint(), *this ) ); |
---|
| 306 | asmExpr->set_operand( maybeMutate( asmExpr->get_operand(), *this ) ); |
---|
| 307 | return asmExpr; |
---|
| 308 | } |
---|
| 309 | |
---|
[d9a0e76] | 310 | Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) { |
---|
[0dd3a2f] | 311 | mutateAll( valofExpr->get_results(), *this ); |
---|
| 312 | return valofExpr; |
---|
[51b7345] | 313 | } |
---|
| 314 | |
---|
[d9a0e76] | 315 | Type *Mutator::mutate( VoidType *voidType ) { |
---|
[0dd3a2f] | 316 | mutateAll( voidType->get_forall(), *this ); |
---|
| 317 | return voidType; |
---|
[51b7345] | 318 | } |
---|
| 319 | |
---|
[d9a0e76] | 320 | Type *Mutator::mutate( BasicType *basicType ) { |
---|
[0dd3a2f] | 321 | mutateAll( basicType->get_forall(), *this ); |
---|
| 322 | return basicType; |
---|
[51b7345] | 323 | } |
---|
| 324 | |
---|
[d9a0e76] | 325 | Type *Mutator::mutate( PointerType *pointerType ) { |
---|
[0dd3a2f] | 326 | mutateAll( pointerType->get_forall(), *this ); |
---|
| 327 | pointerType->set_base( maybeMutate( pointerType->get_base(), *this ) ); |
---|
| 328 | return pointerType; |
---|
[51b7345] | 329 | } |
---|
| 330 | |
---|
[d9a0e76] | 331 | Type *Mutator::mutate( ArrayType *arrayType ) { |
---|
[0dd3a2f] | 332 | mutateAll( arrayType->get_forall(), *this ); |
---|
| 333 | arrayType->set_dimension( maybeMutate( arrayType->get_dimension(), *this ) ); |
---|
| 334 | arrayType->set_base( maybeMutate( arrayType->get_base(), *this ) ); |
---|
| 335 | return arrayType; |
---|
[51b7345] | 336 | } |
---|
| 337 | |
---|
[d9a0e76] | 338 | Type *Mutator::mutate( FunctionType *functionType ) { |
---|
[0dd3a2f] | 339 | mutateAll( functionType->get_forall(), *this ); |
---|
| 340 | mutateAll( functionType->get_returnVals(), *this ); |
---|
| 341 | mutateAll( functionType->get_parameters(), *this ); |
---|
| 342 | return functionType; |
---|
[51b7345] | 343 | } |
---|
| 344 | |
---|
[d9a0e76] | 345 | Type *Mutator::handleReferenceToType( ReferenceToType *aggregateUseType ) { |
---|
[0dd3a2f] | 346 | mutateAll( aggregateUseType->get_forall(), *this ); |
---|
| 347 | mutateAll( aggregateUseType->get_parameters(), *this ); |
---|
| 348 | return aggregateUseType; |
---|
[51b7345] | 349 | } |
---|
| 350 | |
---|
[d9a0e76] | 351 | Type *Mutator::mutate( StructInstType *aggregateUseType ) { |
---|
[0dd3a2f] | 352 | handleReferenceToType( aggregateUseType ); |
---|
| 353 | return aggregateUseType; |
---|
[51b7345] | 354 | } |
---|
| 355 | |
---|
[d9a0e76] | 356 | Type *Mutator::mutate( UnionInstType *aggregateUseType ) { |
---|
[0dd3a2f] | 357 | handleReferenceToType( aggregateUseType ); |
---|
| 358 | return aggregateUseType; |
---|
[51b7345] | 359 | } |
---|
| 360 | |
---|
[d9a0e76] | 361 | Type *Mutator::mutate( EnumInstType *aggregateUseType ) { |
---|
[0dd3a2f] | 362 | handleReferenceToType( aggregateUseType ); |
---|
| 363 | return aggregateUseType; |
---|
[51b7345] | 364 | } |
---|
| 365 | |
---|
[d9a0e76] | 366 | Type *Mutator::mutate( ContextInstType *aggregateUseType ) { |
---|
[0dd3a2f] | 367 | handleReferenceToType( aggregateUseType ); |
---|
| 368 | mutateAll( aggregateUseType->get_members(), *this ); |
---|
| 369 | return aggregateUseType; |
---|
[51b7345] | 370 | } |
---|
| 371 | |
---|
[d9a0e76] | 372 | Type *Mutator::mutate( TypeInstType *aggregateUseType ) { |
---|
[0dd3a2f] | 373 | handleReferenceToType( aggregateUseType ); |
---|
| 374 | return aggregateUseType; |
---|
[51b7345] | 375 | } |
---|
| 376 | |
---|
[d9a0e76] | 377 | Type *Mutator::mutate( TupleType *tupleType ) { |
---|
[0dd3a2f] | 378 | mutateAll( tupleType->get_forall(), *this ); |
---|
| 379 | mutateAll( tupleType->get_types(), *this ); |
---|
| 380 | return tupleType; |
---|
[51b7345] | 381 | } |
---|
| 382 | |
---|
[d9a0e76] | 383 | Type *Mutator::mutate( TypeofType *typeofType ) { |
---|
[0dd3a2f] | 384 | assert( typeofType->get_expr() ); |
---|
| 385 | typeofType->set_expr( typeofType->get_expr()->acceptMutator( *this ) ); |
---|
| 386 | return typeofType; |
---|
[51b7345] | 387 | } |
---|
| 388 | |
---|
[d9a0e76] | 389 | Type *Mutator::mutate( AttrType *attrType ) { |
---|
[0dd3a2f] | 390 | if ( attrType->get_isType() ) { |
---|
| 391 | assert( attrType->get_type() ); |
---|
| 392 | attrType->set_type( attrType->get_type()->acceptMutator( *this ) ); |
---|
| 393 | } else { |
---|
| 394 | assert( attrType->get_expr() ); |
---|
| 395 | attrType->set_expr( attrType->get_expr()->acceptMutator( *this ) ); |
---|
| 396 | } |
---|
| 397 | return attrType; |
---|
[51b7345] | 398 | } |
---|
| 399 | |
---|
[d9a0e76] | 400 | Initializer *Mutator::mutate( SingleInit *singleInit ) { |
---|
[0dd3a2f] | 401 | singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) ); |
---|
| 402 | return singleInit; |
---|
[51b7345] | 403 | } |
---|
| 404 | |
---|
[d9a0e76] | 405 | Initializer *Mutator::mutate( ListInit *listInit ) { |
---|
[0dd3a2f] | 406 | mutateAll( listInit->get_designators(), *this ); |
---|
| 407 | mutateAll( listInit->get_initializers(), *this ); |
---|
| 408 | return listInit; |
---|
[51b7345] | 409 | } |
---|
| 410 | |
---|
[d9a0e76] | 411 | Subrange *Mutator::mutate( Subrange *subrange ) { |
---|
[0dd3a2f] | 412 | return subrange; |
---|
[51b7345] | 413 | } |
---|
| 414 | |
---|
[d9a0e76] | 415 | Constant *Mutator::mutate( Constant *constant ) { |
---|
[0dd3a2f] | 416 | return constant; |
---|
[51b7345] | 417 | } |
---|
[0dd3a2f] | 418 | |
---|
| 419 | // Local Variables: // |
---|
| 420 | // tab-width: 4 // |
---|
| 421 | // mode: c++ // |
---|
| 422 | // compile-command: "make install" // |
---|
| 423 | // End: // |
---|