Changeset 6840e7c for src/InitTweak/InitTweak.cc
- Timestamp:
- Oct 19, 2017, 12:01:04 PM (8 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 837ce06
- Parents:
- b96ec83 (diff), a15b72c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/InitTweak.cc
rb96ec83 r6840e7c 168 168 deleteAll( indices ); 169 169 indices.clear(); 170 } 171 172 bool InitExpander::addReference() { 173 bool added = false; 174 for ( Expression *& expr : cur ) { 175 expr = new AddressExpr( expr ); 176 added = true; 177 } 178 return added; 170 179 } 171 180 … … 270 279 } 271 280 272 Type * getT hisType( FunctionType * ftype ) {273 assertf( ftype, "getT hisType: nullptr ftype" );274 ObjectDecl * thisParam = get ThisParam( ftype );281 Type * getTypeofThis( FunctionType * ftype ) { 282 assertf( ftype, "getTypeofThis: nullptr ftype" ); 283 ObjectDecl * thisParam = getParamThis( ftype ); 275 284 ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( thisParam->type ); 276 285 return refType->base; 277 286 } 278 287 279 ObjectDecl * get ThisParam( FunctionType * ftype ) {280 assertf( ftype, "get ThisParam: nullptr ftype" );288 ObjectDecl * getParamThis( FunctionType * ftype ) { 289 assertf( ftype, "getParamThis: nullptr ftype" ); 281 290 auto & params = ftype->parameters; 282 assertf( ! params.empty(), "get ThisParam: ftype with 0 parameters: %s", toString( ftype ).c_str() );291 assertf( ! params.empty(), "getParamThis: ftype with 0 parameters: %s", toString( ftype ).c_str() ); 283 292 return strict_dynamic_cast< ObjectDecl * >( params.front() ); 284 293 } … … 353 362 assert( expr ); 354 363 if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( expr ) ) { 355 return varExpr-> get_var();364 return varExpr->var; 356 365 } else if ( MemberExpr * memberExpr = dynamic_cast< MemberExpr * >( expr ) ) { 357 return memberExpr-> get_member();366 return memberExpr->member; 358 367 } else if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) { 359 return getCalledFunction( castExpr-> get_arg());368 return getCalledFunction( castExpr->arg ); 360 369 } else if ( UntypedExpr * untypedExpr = dynamic_cast< UntypedExpr * >( expr ) ) { 361 370 return handleDerefCalledFunction( untypedExpr ); … … 363 372 return handleDerefCalledFunction( appExpr ); 364 373 } else if ( AddressExpr * addrExpr = dynamic_cast< AddressExpr * >( expr ) ) { 365 return getCalledFunction( addrExpr->get_arg() ); 374 return getCalledFunction( addrExpr->arg ); 375 } else if ( CommaExpr * commaExpr = dynamic_cast< CommaExpr * >( expr ) ) { 376 return getCalledFunction( commaExpr->arg2 ); 366 377 } 367 378 return nullptr; … … 578 589 FunctionDecl * isCopyFunction( Declaration * decl, const std::string & fname ) { 579 590 FunctionDecl * function = dynamic_cast< FunctionDecl * >( decl ); 580 if ( ! function ) return 0;581 if ( function-> get_name() != fname ) return 0;582 FunctionType * ftype = function-> get_functionType();583 if ( ftype-> get_parameters().size() != 2 ) return 0;591 if ( ! function ) return nullptr; 592 if ( function->name != fname ) return nullptr; 593 FunctionType * ftype = function->type; 594 if ( ftype->parameters.size() != 2 ) return nullptr; 584 595 585 596 Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type() ); 586 Type * t2 = ftype-> get_parameters().back()->get_type();597 Type * t2 = ftype->parameters.back()->get_type(); 587 598 assert( t1 ); 588 599 … … 604 615 } 605 616 FunctionDecl * isDefaultConstructor( Declaration * decl ) { 606 if ( isConstructor( decl-> get_name()) ) {617 if ( isConstructor( decl->name ) ) { 607 618 if ( FunctionDecl * func = dynamic_cast< FunctionDecl * >( decl ) ) { 608 if ( func-> get_functionType()->get_parameters().size() == 1 ) {619 if ( func->type->parameters.size() == 1 ) { 609 620 return func; 610 621 }
Note:
See TracChangeset
for help on using the changeset viewer.