Changeset bd91e2a for src/GenPoly
- Timestamp:
- Mar 3, 2016, 3:59:25 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 2e60a1a
- Parents:
- 3627356
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r3627356 rbd91e2a 337 337 DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member ); 338 338 assert( dwt ); 339 Type *memberType = dwt->get_type(); 339 340 340 341 if ( firstMember ) { … … 342 343 } else { 343 344 // make sure all members after the first (automatically aligned at 0) are properly padded for alignment 344 addStmt( layoutDecl->get_statements(), makeAlignTo( derefVar( sizeParam ), new AlignofExpr( dwt->get_type() ) ) );345 addStmt( layoutDecl->get_statements(), makeAlignTo( derefVar( sizeParam ), new AlignofExpr( memberType->clone() ) ) ); 345 346 } 346 347 … … 351 352 352 353 // add member size to current size 353 addExpr( layoutDecl->get_statements(), makeOp( "?+=?", derefVar( sizeParam ), new SizeofExpr( dwt->get_type() ) ) );354 addExpr( layoutDecl->get_statements(), makeOp( "?+=?", derefVar( sizeParam ), new SizeofExpr( memberType->clone() ) ) ); 354 355 355 356 // take max of member alignment and global alignment 356 addStmt( layoutDecl->get_statements(), makeAssignMax( derefVar( alignParam ), new AlignofExpr( dwt->get_type() ) ) );357 addStmt( layoutDecl->get_statements(), makeAssignMax( derefVar( alignParam ), new AlignofExpr( memberType->clone() ) ) ); 357 358 } 358 359 // make sure the type is end-padded to a multiple of its alignment … … 391 392 DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member ); 392 393 assert( dwt ); 394 Type *memberType = dwt->get_type(); 393 395 394 396 // take max member size and global size 395 addStmt( layoutDecl->get_statements(), makeAssignMax( derefVar( sizeParam ), new SizeofExpr( dwt->get_type() ) ) );397 addStmt( layoutDecl->get_statements(), makeAssignMax( derefVar( sizeParam ), new SizeofExpr( memberType->clone() ) ) ); 396 398 397 399 // take max of member alignment and global alignment 398 addStmt( layoutDecl->get_statements(), makeAssignMax( derefVar( alignParam ), new AlignofExpr( dwt->get_type() ) ) );400 addStmt( layoutDecl->get_statements(), makeAssignMax( derefVar( alignParam ), new AlignofExpr( memberType->clone() ) ) ); 399 401 } 400 402 // make sure the type is end-padded to a multiple of its alignment
Note: See TracChangeset
for help on using the changeset viewer.