Changes in src/GenPoly/Box.cc [2efe4b8:982f95d]
- File:
-
- 1 edited
-
src/GenPoly/Box.cc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r2efe4b8 r982f95d 38 38 #include "Lvalue.h" // for generalizedLvalue 39 39 #include "Parser/LinkageSpec.h" // for C, Spec, Cforall, Intrinsic 40 #include "ResolvExpr/TypeEnvironment.h" // for EqvClass41 40 #include "ResolvExpr/typeops.h" // for typesCompatible 42 41 #include "ScopedSet.h" // for ScopedSet, ScopedSet<>::iter... … … 184 183 /// change the type of generic aggregate members to char[] 185 184 void mutateMembers( AggregateDecl * aggrDecl ); 185 /// returns the calculated sizeof expression for ty, or nullptr for use C sizeof() 186 Expression* genSizeof( Type* ty ); 186 187 187 188 /// Enters a new scope for type-variables, adding the type variables from ty … … 383 384 unsigned long n_members = 0; 384 385 bool firstMember = true; 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 );386 for ( Declaration* member : structDecl->get_members() ) { 387 DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( member ); 387 388 assert( dwt ); 388 389 Type *memberType = dwt->get_type(); … … 590 591 // pass size/align for type variables 591 592 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 1749 return new NameExpr( sizeofName( mangleType( ty ) ) ); 1750 } else return nullptr; 1751 } 1752 1739 1753 Expression *PolyGenericCalculator::postmutate( SizeofExpr *sizeofExpr ) { 1740 Type *ty = sizeofExpr->get_isType() ? sizeofExpr->get_type() : sizeofExpr->get_expr()->get_result();1741 if ( findGeneric( ty ) ) {1742 return new NameExpr( sizeofName( mangleType( ty ) ) );1743 }1744 return 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; 1745 1759 } 1746 1760
Note:
See TracChangeset
for help on using the changeset viewer.