Changes in src/GenPoly/Box.cc [982f95d:2efe4b8]
- File:
-
- 1 edited
-
src/GenPoly/Box.cc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r982f95d r2efe4b8 38 38 #include "Lvalue.h" // for generalizedLvalue 39 39 #include "Parser/LinkageSpec.h" // for C, Spec, Cforall, Intrinsic 40 #include "ResolvExpr/TypeEnvironment.h" // for EqvClass 40 41 #include "ResolvExpr/typeops.h" // for typesCompatible 41 42 #include "ScopedSet.h" // for ScopedSet, ScopedSet<>::iter... … … 183 184 /// change the type of generic aggregate members to char[] 184 185 void mutateMembers( AggregateDecl * aggrDecl ); 185 /// returns the calculated sizeof expression for ty, or nullptr for use C sizeof()186 Expression* genSizeof( Type* ty );187 186 188 187 /// Enters a new scope for type-variables, adding the type variables from ty … … 384 383 unsigned long n_members = 0; 385 384 bool firstMember = true; 386 for ( Declaration* member : structDecl->get_members()) {387 DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( member );385 for ( std::list< Declaration* >::const_iterator member = structDecl->get_members().begin(); member != structDecl->get_members().end(); ++member ) { 386 DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member ); 388 387 assert( dwt ); 389 388 Type *memberType = dwt->get_type(); … … 591 590 // pass size/align for type variables 592 591 for ( TyVarMap::const_iterator tyParm = exprTyVars.begin(); tyParm != exprTyVars.end(); ++tyParm ) { 592 ResolvExpr::EqvClass eqvClass; 593 593 assert( env ); 594 594 if ( tyParm->second.isComplete ) { … … 1737 1737 } 1738 1738 1739 Expression * PolyGenericCalculator::genSizeof( Type* ty ) { 1740 if ( ArrayType * aty = dynamic_cast<ArrayType *>(ty) ) { 1741 // generate calculated size for possibly generic array 1742 Expression * sizeofBase = genSizeof( aty->get_base() ); 1743 if ( ! sizeofBase ) return nullptr; 1744 Expression * dim = aty->get_dimension(); 1745 aty->set_dimension( nullptr ); 1746 return makeOp( "?*?", sizeofBase, dim ); 1747 } else if ( findGeneric( ty ) ) { 1748 // generate calculated size for generic type 1739 Expression *PolyGenericCalculator::postmutate( SizeofExpr *sizeofExpr ) { 1740 Type *ty = sizeofExpr->get_isType() ? sizeofExpr->get_type() : sizeofExpr->get_expr()->get_result(); 1741 if ( findGeneric( ty ) ) { 1749 1742 return new NameExpr( sizeofName( mangleType( ty ) ) ); 1750 } else return nullptr; 1751 } 1752 1753 Expression *PolyGenericCalculator::postmutate( SizeofExpr *sizeofExpr ) { 1754 Type *ty = sizeofExpr->get_isType() ? 1755 sizeofExpr->get_type() : sizeofExpr->get_expr()->get_result(); 1756 1757 Expression * gen = genSizeof( ty ); 1758 return gen ? gen : sizeofExpr; 1743 } 1744 return sizeofExpr; 1759 1745 } 1760 1746
Note:
See TracChangeset
for help on using the changeset viewer.