| [51b73452] | 1 | #include <cassert>
|
|---|
| 2 | #include "Mutator.h"
|
|---|
| 3 | #include "Initializer.h"
|
|---|
| 4 | #include "Statement.h"
|
|---|
| 5 | #include "Type.h"
|
|---|
| 6 | #include "Declaration.h"
|
|---|
| 7 | #include "Expression.h"
|
|---|
| 8 | #include "Constant.h"
|
|---|
| 9 | #include "utility.h"
|
|---|
| 10 |
|
|---|
| [d9a0e76] | 11 | Mutator::Mutator() {}
|
|---|
| [51b73452] | 12 |
|
|---|
| [d9a0e76] | 13 | Mutator::~Mutator() {}
|
|---|
| [51b73452] | 14 |
|
|---|
| [d9a0e76] | 15 | ObjectDecl *Mutator::mutate( ObjectDecl *objectDecl ) {
|
|---|
| [51b73452] | 16 | objectDecl->set_type( maybeMutate( objectDecl->get_type(), *this ) );
|
|---|
| 17 | objectDecl->set_init( maybeMutate( objectDecl->get_init(), *this ) );
|
|---|
| 18 | objectDecl->set_bitfieldWidth( maybeMutate( objectDecl->get_bitfieldWidth(), *this ) );
|
|---|
| 19 | return objectDecl;
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| [d9a0e76] | 22 | DeclarationWithType *Mutator::mutate( FunctionDecl *functionDecl ) {
|
|---|
| [51b73452] | 23 | functionDecl->set_functionType( maybeMutate( functionDecl->get_functionType(), *this ) );
|
|---|
| 24 | mutateAll( functionDecl->get_oldDecls(), *this );
|
|---|
| 25 | functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) );
|
|---|
| 26 | return functionDecl;
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| [d9a0e76] | 29 | Declaration *Mutator::handleAggregateDecl( AggregateDecl *aggregateDecl ) {
|
|---|
| [51b73452] | 30 | mutateAll( aggregateDecl->get_parameters(), *this );
|
|---|
| 31 | mutateAll( aggregateDecl->get_members(), *this );
|
|---|
| 32 | return aggregateDecl;
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| [d9a0e76] | 35 | Declaration *Mutator::mutate( StructDecl *aggregateDecl ) {
|
|---|
| [51b73452] | 36 | handleAggregateDecl( aggregateDecl );
|
|---|
| 37 | return aggregateDecl;
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| [d9a0e76] | 40 | Declaration *Mutator::mutate( UnionDecl *aggregateDecl ) {
|
|---|
| [51b73452] | 41 | handleAggregateDecl( aggregateDecl );
|
|---|
| 42 | return aggregateDecl;
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| [d9a0e76] | 45 | Declaration *Mutator::mutate( EnumDecl *aggregateDecl ) {
|
|---|
| [51b73452] | 46 | handleAggregateDecl( aggregateDecl );
|
|---|
| 47 | return aggregateDecl;
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| [d9a0e76] | 50 | Declaration *Mutator::mutate( ContextDecl *aggregateDecl ) {
|
|---|
| [51b73452] | 51 | handleAggregateDecl( aggregateDecl );
|
|---|
| 52 | return aggregateDecl;
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| [d9a0e76] | 55 | Declaration *Mutator::handleNamedTypeDecl( NamedTypeDecl *typeDecl ) {
|
|---|
| [51b73452] | 56 | mutateAll( typeDecl->get_parameters(), *this );
|
|---|
| 57 | mutateAll( typeDecl->get_assertions(), *this );
|
|---|
| 58 | typeDecl->set_base( maybeMutate( typeDecl->get_base(), *this ) );
|
|---|
| 59 | return typeDecl;
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| [d9a0e76] | 62 | TypeDecl *Mutator::mutate( TypeDecl *typeDecl ) {
|
|---|
| [51b73452] | 63 | handleNamedTypeDecl( typeDecl );
|
|---|
| 64 | return typeDecl;
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| [d9a0e76] | 67 | Declaration *Mutator::mutate( TypedefDecl *typeDecl ) {
|
|---|
| [51b73452] | 68 | handleNamedTypeDecl( typeDecl );
|
|---|
| 69 | return typeDecl;
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| [d9a0e76] | 72 | CompoundStmt *Mutator::mutate( CompoundStmt *compoundStmt ) {
|
|---|
| [51b73452] | 73 | mutateAll( compoundStmt->get_kids(), *this );
|
|---|
| 74 | return compoundStmt;
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| [d9a0e76] | 77 | Statement *Mutator::mutate( ExprStmt *exprStmt ) {
|
|---|
| [51b73452] | 78 | exprStmt->set_expr( maybeMutate( exprStmt->get_expr(), *this ) );
|
|---|
| 79 | return exprStmt;
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| [d9a0e76] | 82 | Statement *Mutator::mutate( IfStmt *ifStmt ) {
|
|---|
| 83 | ifStmt->set_condition( maybeMutate( ifStmt->get_condition(), *this ) );
|
|---|
| 84 | ifStmt->set_thenPart( maybeMutate( ifStmt->get_thenPart(), *this ) );
|
|---|
| 85 | ifStmt->set_elsePart( maybeMutate( ifStmt->get_elsePart(), *this ) );
|
|---|
| [51b73452] | 86 | return ifStmt;
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| [d9a0e76] | 89 | Statement *Mutator::mutate( WhileStmt *whileStmt ) {
|
|---|
| 90 | whileStmt->set_condition( maybeMutate( whileStmt->get_condition(), *this ) );
|
|---|
| 91 | whileStmt->set_body( maybeMutate( whileStmt->get_body(), *this ) );
|
|---|
| [51b73452] | 92 | return whileStmt;
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| [d9a0e76] | 95 | Statement *Mutator::mutate( ForStmt *forStmt ) {
|
|---|
| 96 | forStmt->set_initialization( maybeMutate( forStmt->get_initialization(), *this ) );
|
|---|
| 97 | forStmt->set_condition( maybeMutate( forStmt->get_condition(), *this ) );
|
|---|
| 98 | forStmt->set_increment( maybeMutate( forStmt->get_increment(), *this ) );
|
|---|
| 99 | forStmt->set_body( maybeMutate( forStmt->get_body(), *this ) );
|
|---|
| [51b73452] | 100 | return forStmt;
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| [d9a0e76] | 103 | Statement *Mutator::mutate( SwitchStmt *switchStmt ) {
|
|---|
| [51b73452] | 104 | switchStmt->set_condition( maybeMutate( switchStmt->get_condition(), *this ) );
|
|---|
| 105 | mutateAll( switchStmt->get_branches(), *this );
|
|---|
| 106 | return switchStmt;
|
|---|
| 107 | }
|
|---|
| 108 |
|
|---|
| [d9a0e76] | 109 | Statement *Mutator::mutate( ChooseStmt *switchStmt ) {
|
|---|
| 110 | switchStmt->set_condition( maybeMutate( switchStmt->get_condition(), *this ) );
|
|---|
| [51b73452] | 111 | mutateAll( switchStmt->get_branches(), *this );
|
|---|
| 112 | return switchStmt;
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| [d9a0e76] | 115 | Statement *Mutator::mutate( FallthruStmt *fallthruStmt ) {
|
|---|
| [51b73452] | 116 | return fallthruStmt;
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| [d9a0e76] | 119 | Statement *Mutator::mutate( CaseStmt *caseStmt ) {
|
|---|
| 120 | caseStmt->set_condition( maybeMutate( caseStmt->get_condition(), *this ) );
|
|---|
| [51b73452] | 121 | mutateAll (caseStmt->get_statements(), *this );
|
|---|
| 122 |
|
|---|
| 123 | return caseStmt;
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| [d9a0e76] | 126 | Statement *Mutator::mutate( BranchStmt *branchStmt ) {
|
|---|
| [51b73452] | 127 | return branchStmt;
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| [d9a0e76] | 130 | Statement *Mutator::mutate( ReturnStmt *returnStmt ) {
|
|---|
| 131 | returnStmt->set_expr( maybeMutate( returnStmt->get_expr(), *this ) );
|
|---|
| [51b73452] | 132 | return returnStmt;
|
|---|
| 133 | }
|
|---|
| 134 |
|
|---|
| [d9a0e76] | 135 | Statement *Mutator::mutate( TryStmt *tryStmt ) {
|
|---|
| [51b73452] | 136 | tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) );
|
|---|
| 137 | mutateAll( tryStmt->get_catchers(), *this );
|
|---|
| 138 | return tryStmt;
|
|---|
| 139 | }
|
|---|
| 140 |
|
|---|
| [d9a0e76] | 141 | Statement *Mutator::mutate( CatchStmt *catchStmt ) {
|
|---|
| [51b73452] | 142 | catchStmt->set_decl( maybeMutate( catchStmt->get_decl(), *this ) );
|
|---|
| 143 | catchStmt->set_body( maybeMutate( catchStmt->get_body(), *this ) );
|
|---|
| 144 | return catchStmt;
|
|---|
| 145 | }
|
|---|
| 146 |
|
|---|
| [d9a0e76] | 147 | Statement *Mutator::mutate( FinallyStmt *finalStmt ) {
|
|---|
| [51b73452] | 148 | finalStmt->set_block( maybeMutate( finalStmt->get_block(), *this ) );
|
|---|
| 149 | return finalStmt;
|
|---|
| 150 | }
|
|---|
| 151 |
|
|---|
| [d9a0e76] | 152 | NullStmt *Mutator::mutate( NullStmt *nullStmt ) {
|
|---|
| [51b73452] | 153 | return nullStmt;
|
|---|
| 154 | }
|
|---|
| 155 |
|
|---|
| [d9a0e76] | 156 | Statement *Mutator::mutate( DeclStmt *declStmt ) {
|
|---|
| [51b73452] | 157 | declStmt->set_decl( maybeMutate( declStmt->get_decl(), *this ) );
|
|---|
| 158 | return declStmt;
|
|---|
| 159 | }
|
|---|
| 160 |
|
|---|
| [d9a0e76] | 161 | Expression *Mutator::mutate( ApplicationExpr *applicationExpr ) {
|
|---|
| [51b73452] | 162 | mutateAll( applicationExpr->get_results(), *this );
|
|---|
| [d9a0e76] | 163 | applicationExpr->set_function( maybeMutate( applicationExpr->get_function(), *this ) );
|
|---|
| [51b73452] | 164 | mutateAll( applicationExpr->get_args(), *this );
|
|---|
| 165 | return applicationExpr;
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| [d9a0e76] | 168 | Expression *Mutator::mutate( UntypedExpr *untypedExpr ) {
|
|---|
| [51b73452] | 169 | mutateAll( untypedExpr->get_results(), *this );
|
|---|
| 170 | mutateAll( untypedExpr->get_args(), *this );
|
|---|
| 171 | return untypedExpr;
|
|---|
| 172 | }
|
|---|
| 173 |
|
|---|
| [d9a0e76] | 174 | Expression *Mutator::mutate( NameExpr *nameExpr ) {
|
|---|
| [51b73452] | 175 | mutateAll( nameExpr->get_results(), *this );
|
|---|
| 176 | return nameExpr;
|
|---|
| 177 | }
|
|---|
| 178 |
|
|---|
| [d9a0e76] | 179 | Expression *Mutator::mutate( AddressExpr *addressExpr ) {
|
|---|
| [51b73452] | 180 | mutateAll( addressExpr->get_results(), *this );
|
|---|
| [d9a0e76] | 181 | addressExpr->set_arg( maybeMutate( addressExpr->get_arg(), *this ) );
|
|---|
| [51b73452] | 182 | return addressExpr;
|
|---|
| 183 | }
|
|---|
| 184 |
|
|---|
| [d9a0e76] | 185 | Expression *Mutator::mutate( LabelAddressExpr *labelAddressExpr ) {
|
|---|
| [51b73452] | 186 | mutateAll( labelAddressExpr->get_results(), *this );
|
|---|
| [d9a0e76] | 187 | labelAddressExpr->set_arg( maybeMutate( labelAddressExpr->get_arg(), *this ) );
|
|---|
| [51b73452] | 188 | return labelAddressExpr;
|
|---|
| 189 | }
|
|---|
| 190 |
|
|---|
| [d9a0e76] | 191 | Expression *Mutator::mutate( CastExpr *castExpr ) {
|
|---|
| [51b73452] | 192 | mutateAll( castExpr->get_results(), *this );
|
|---|
| [d9a0e76] | 193 | castExpr->set_arg( maybeMutate( castExpr->get_arg(), *this ) );
|
|---|
| [51b73452] | 194 | return castExpr;
|
|---|
| 195 | }
|
|---|
| 196 |
|
|---|
| [d9a0e76] | 197 | Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) {
|
|---|
| [51b73452] | 198 | mutateAll( memberExpr->get_results(), *this );
|
|---|
| [d9a0e76] | 199 | memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
|
|---|
| [51b73452] | 200 | return memberExpr;
|
|---|
| 201 | }
|
|---|
| 202 |
|
|---|
| [d9a0e76] | 203 | Expression *Mutator::mutate( MemberExpr *memberExpr ) {
|
|---|
| [51b73452] | 204 | mutateAll( memberExpr->get_results(), *this );
|
|---|
| [d9a0e76] | 205 | memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
|
|---|
| [51b73452] | 206 | return memberExpr;
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| [d9a0e76] | 209 | Expression *Mutator::mutate( VariableExpr *variableExpr ) {
|
|---|
| [51b73452] | 210 | mutateAll( variableExpr->get_results(), *this );
|
|---|
| 211 | return variableExpr;
|
|---|
| 212 | }
|
|---|
| 213 |
|
|---|
| [d9a0e76] | 214 | Expression *Mutator::mutate( ConstantExpr *constantExpr ) {
|
|---|
| [51b73452] | 215 | mutateAll( constantExpr->get_results(), *this );
|
|---|
| 216 | // maybeMutate( constantExpr->get_constant(), *this )
|
|---|
| 217 | return constantExpr;
|
|---|
| 218 | }
|
|---|
| 219 |
|
|---|
| [d9a0e76] | 220 | Expression *Mutator::mutate( SizeofExpr *sizeofExpr ) {
|
|---|
| [51b73452] | 221 | mutateAll( sizeofExpr->get_results(), *this );
|
|---|
| [d9a0e76] | 222 | if ( sizeofExpr->get_isType() ) {
|
|---|
| 223 | sizeofExpr->set_type( maybeMutate( sizeofExpr->get_type(), *this ) );
|
|---|
| [51b73452] | 224 | } else {
|
|---|
| [d9a0e76] | 225 | sizeofExpr->set_expr( maybeMutate( sizeofExpr->get_expr(), *this ) );
|
|---|
| [51b73452] | 226 | }
|
|---|
| 227 | return sizeofExpr;
|
|---|
| 228 | }
|
|---|
| 229 |
|
|---|
| [d9a0e76] | 230 | Expression *Mutator::mutate( AttrExpr *attrExpr ) {
|
|---|
| [51b73452] | 231 | mutateAll( attrExpr->get_results(), *this );
|
|---|
| [d9a0e76] | 232 | if ( attrExpr->get_isType() ) {
|
|---|
| 233 | attrExpr->set_type( maybeMutate( attrExpr->get_type(), *this ) );
|
|---|
| [51b73452] | 234 | } else {
|
|---|
| [d9a0e76] | 235 | attrExpr->set_expr( maybeMutate( attrExpr->get_expr(), *this ) );
|
|---|
| [51b73452] | 236 | }
|
|---|
| 237 | return attrExpr;
|
|---|
| 238 | }
|
|---|
| 239 |
|
|---|
| [d9a0e76] | 240 | Expression *Mutator::mutate( LogicalExpr *logicalExpr ) {
|
|---|
| [51b73452] | 241 | mutateAll( logicalExpr->get_results(), *this );
|
|---|
| [d9a0e76] | 242 | logicalExpr->set_arg1( maybeMutate( logicalExpr->get_arg1(), *this ) );
|
|---|
| 243 | logicalExpr->set_arg2( maybeMutate( logicalExpr->get_arg2(), *this ) );
|
|---|
| [51b73452] | 244 | return logicalExpr;
|
|---|
| 245 | }
|
|---|
| 246 |
|
|---|
| [d9a0e76] | 247 | Expression *Mutator::mutate( ConditionalExpr *conditionalExpr ) {
|
|---|
| [51b73452] | 248 | mutateAll( conditionalExpr->get_results(), *this );
|
|---|
| [d9a0e76] | 249 | conditionalExpr->set_arg1( maybeMutate( conditionalExpr->get_arg1(), *this ) );
|
|---|
| 250 | conditionalExpr->set_arg2( maybeMutate( conditionalExpr->get_arg2(), *this ) );
|
|---|
| 251 | conditionalExpr->set_arg3( maybeMutate( conditionalExpr->get_arg3(), *this ) );
|
|---|
| [51b73452] | 252 | return conditionalExpr;
|
|---|
| 253 | }
|
|---|
| 254 |
|
|---|
| [d9a0e76] | 255 | Expression *Mutator::mutate( CommaExpr *commaExpr ) {
|
|---|
| [51b73452] | 256 | mutateAll( commaExpr->get_results(), *this );
|
|---|
| [d9a0e76] | 257 | commaExpr->set_arg1( maybeMutate( commaExpr->get_arg1(), *this ) );
|
|---|
| 258 | commaExpr->set_arg2( maybeMutate( commaExpr->get_arg2(), *this ) );
|
|---|
| [51b73452] | 259 | return commaExpr;
|
|---|
| 260 | }
|
|---|
| 261 |
|
|---|
| [d9a0e76] | 262 | Expression *Mutator::mutate( TupleExpr *tupleExpr ) {
|
|---|
| [51b73452] | 263 | mutateAll( tupleExpr->get_results(), *this );
|
|---|
| 264 | mutateAll( tupleExpr->get_exprs(), *this );
|
|---|
| 265 | return tupleExpr;
|
|---|
| 266 | }
|
|---|
| 267 |
|
|---|
| [d9a0e76] | 268 | Expression *Mutator::mutate( SolvedTupleExpr *tupleExpr ) {
|
|---|
| [51b73452] | 269 | mutateAll( tupleExpr->get_results(), *this );
|
|---|
| 270 | mutateAll( tupleExpr->get_exprs(), *this );
|
|---|
| 271 | return tupleExpr;
|
|---|
| 272 | }
|
|---|
| 273 |
|
|---|
| [d9a0e76] | 274 | Expression *Mutator::mutate( TypeExpr *typeExpr ) {
|
|---|
| [51b73452] | 275 | mutateAll( typeExpr->get_results(), *this );
|
|---|
| 276 | typeExpr->set_type( maybeMutate( typeExpr->get_type(), *this ) );
|
|---|
| 277 | return typeExpr;
|
|---|
| 278 | }
|
|---|
| 279 |
|
|---|
| [d9a0e76] | 280 | Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) {
|
|---|
| [51b73452] | 281 | mutateAll( valofExpr->get_results(), *this );
|
|---|
| 282 | return valofExpr;
|
|---|
| 283 | }
|
|---|
| 284 |
|
|---|
| [d9a0e76] | 285 | Type *Mutator::mutate( VoidType *voidType ) {
|
|---|
| [51b73452] | 286 | mutateAll( voidType->get_forall(), *this );
|
|---|
| 287 | return voidType;
|
|---|
| 288 | }
|
|---|
| 289 |
|
|---|
| [d9a0e76] | 290 | Type *Mutator::mutate( BasicType *basicType ) {
|
|---|
| [51b73452] | 291 | mutateAll( basicType->get_forall(), *this );
|
|---|
| 292 | return basicType;
|
|---|
| 293 | }
|
|---|
| 294 |
|
|---|
| [d9a0e76] | 295 | Type *Mutator::mutate( PointerType *pointerType ) {
|
|---|
| [51b73452] | 296 | mutateAll( pointerType->get_forall(), *this );
|
|---|
| 297 | pointerType->set_base( maybeMutate( pointerType->get_base(), *this ) );
|
|---|
| 298 | return pointerType;
|
|---|
| 299 | }
|
|---|
| 300 |
|
|---|
| [d9a0e76] | 301 | Type *Mutator::mutate( ArrayType *arrayType ) {
|
|---|
| [51b73452] | 302 | mutateAll( arrayType->get_forall(), *this );
|
|---|
| 303 | arrayType->set_dimension( maybeMutate( arrayType->get_dimension(), *this ) );
|
|---|
| 304 | arrayType->set_base( maybeMutate( arrayType->get_base(), *this ) );
|
|---|
| 305 | return arrayType;
|
|---|
| 306 | }
|
|---|
| 307 |
|
|---|
| [d9a0e76] | 308 | Type *Mutator::mutate( FunctionType *functionType ) {
|
|---|
| [51b73452] | 309 | mutateAll( functionType->get_forall(), *this );
|
|---|
| 310 | mutateAll( functionType->get_returnVals(), *this );
|
|---|
| 311 | mutateAll( functionType->get_parameters(), *this );
|
|---|
| 312 | return functionType;
|
|---|
| 313 | }
|
|---|
| 314 |
|
|---|
| [d9a0e76] | 315 | Type *Mutator::handleReferenceToType( ReferenceToType *aggregateUseType ) {
|
|---|
| [51b73452] | 316 | mutateAll( aggregateUseType->get_forall(), *this );
|
|---|
| 317 | mutateAll( aggregateUseType->get_parameters(), *this );
|
|---|
| 318 | return aggregateUseType;
|
|---|
| 319 | }
|
|---|
| 320 |
|
|---|
| [d9a0e76] | 321 | Type *Mutator::mutate( StructInstType *aggregateUseType ) {
|
|---|
| [51b73452] | 322 | handleReferenceToType( aggregateUseType );
|
|---|
| 323 | return aggregateUseType;
|
|---|
| 324 | }
|
|---|
| 325 |
|
|---|
| [d9a0e76] | 326 | Type *Mutator::mutate( UnionInstType *aggregateUseType ) {
|
|---|
| [51b73452] | 327 | handleReferenceToType( aggregateUseType );
|
|---|
| 328 | return aggregateUseType;
|
|---|
| 329 | }
|
|---|
| 330 |
|
|---|
| [d9a0e76] | 331 | Type *Mutator::mutate( EnumInstType *aggregateUseType ) {
|
|---|
| [51b73452] | 332 | handleReferenceToType( aggregateUseType );
|
|---|
| 333 | return aggregateUseType;
|
|---|
| 334 | }
|
|---|
| 335 |
|
|---|
| [d9a0e76] | 336 | Type *Mutator::mutate( ContextInstType *aggregateUseType ) {
|
|---|
| [51b73452] | 337 | handleReferenceToType( aggregateUseType );
|
|---|
| 338 | mutateAll( aggregateUseType->get_members(), *this );
|
|---|
| 339 | return aggregateUseType;
|
|---|
| 340 | }
|
|---|
| 341 |
|
|---|
| [d9a0e76] | 342 | Type *Mutator::mutate( TypeInstType *aggregateUseType ) {
|
|---|
| [51b73452] | 343 | handleReferenceToType( aggregateUseType );
|
|---|
| 344 | return aggregateUseType;
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| [d9a0e76] | 347 | Type *Mutator::mutate( TupleType *tupleType ) {
|
|---|
| [51b73452] | 348 | mutateAll( tupleType->get_forall(), *this );
|
|---|
| 349 | mutateAll( tupleType->get_types(), *this );
|
|---|
| 350 | return tupleType;
|
|---|
| 351 | }
|
|---|
| 352 |
|
|---|
| [d9a0e76] | 353 | Type *Mutator::mutate( TypeofType *typeofType ) {
|
|---|
| [51b73452] | 354 | assert( typeofType->get_expr() );
|
|---|
| 355 | typeofType->set_expr( typeofType->get_expr()->acceptMutator( *this ) );
|
|---|
| 356 | return typeofType;
|
|---|
| 357 | }
|
|---|
| 358 |
|
|---|
| [d9a0e76] | 359 | Type *Mutator::mutate( AttrType *attrType ) {
|
|---|
| 360 | if ( attrType->get_isType() ) {
|
|---|
| [51b73452] | 361 | assert( attrType->get_type() );
|
|---|
| 362 | attrType->set_type( attrType->get_type()->acceptMutator( *this ) );
|
|---|
| 363 | } else {
|
|---|
| 364 | assert( attrType->get_expr() );
|
|---|
| 365 | attrType->set_expr( attrType->get_expr()->acceptMutator( *this ) );
|
|---|
| 366 | }
|
|---|
| 367 | return attrType;
|
|---|
| 368 | }
|
|---|
| 369 |
|
|---|
| [d9a0e76] | 370 | Initializer *Mutator::mutate( MemberInit *memberInit ) {
|
|---|
| [51b73452] | 371 | memberInit->set_value( memberInit->get_value()->acceptMutator( *this ) );
|
|---|
| 372 | return memberInit;
|
|---|
| 373 | }
|
|---|
| 374 |
|
|---|
| [d9a0e76] | 375 | Initializer *Mutator::mutate( ElementInit *elementInit ) {
|
|---|
| [51b73452] | 376 | elementInit->set_value( elementInit->get_value()->acceptMutator( *this ) );
|
|---|
| 377 | return elementInit;
|
|---|
| 378 | }
|
|---|
| 379 |
|
|---|
| [d9a0e76] | 380 | Initializer *Mutator::mutate( SingleInit *singleInit ) {
|
|---|
| [51b73452] | 381 | singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) );
|
|---|
| 382 | return singleInit;
|
|---|
| 383 | }
|
|---|
| 384 |
|
|---|
| [d9a0e76] | 385 | Initializer *Mutator::mutate( ListInit *listInit ) {
|
|---|
| [51b73452] | 386 | mutateAll( listInit->get_designators(), *this );
|
|---|
| 387 | mutateAll( listInit->get_initializers(), *this );
|
|---|
| 388 | return listInit;
|
|---|
| 389 | }
|
|---|
| 390 |
|
|---|
| [d9a0e76] | 391 | Subrange *Mutator::mutate( Subrange *subrange ) {
|
|---|
| [51b73452] | 392 | return subrange;
|
|---|
| 393 | }
|
|---|
| 394 |
|
|---|
| [d9a0e76] | 395 | Constant *Mutator::mutate( Constant *constant ) {
|
|---|
| [51b73452] | 396 | return constant;
|
|---|
| 397 | }
|
|---|