Changeset 4b8f918
- Timestamp:
- Apr 12, 2016, 2:30:22 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:
- b52d900
- Parents:
- df2be83
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
rdf2be83 r4b8f918 664 664 if ( functionDecl->get_statements() ) { // empty routine body ? 665 665 doBeginScope(); 666 scopeTyVars.beginScope(); ;666 scopeTyVars.beginScope(); 667 667 assignOps.beginScope(); 668 668 DeclarationWithType *oldRetval = retval; … … 741 741 742 742 void Pass1::passArgTypeVars( ApplicationExpr *appExpr, Type *parmType, Type *argBaseType, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars, std::set< std::string > &seenTypes ) { 743 Type *poly Base = hasPolyBase( parmType, exprTyVars );744 if ( poly Base && ! dynamic_cast< TypeInstType* >( polyBase ) ) {745 std::string typeName = mangleType( poly Base );743 Type *polyType = isPolyType( parmType, exprTyVars ); 744 if ( polyType && ! dynamic_cast< TypeInstType* >( polyType ) ) { 745 std::string typeName = mangleType( polyType ); 746 746 if ( seenTypes.count( typeName ) ) return; 747 747 … … 750 750 arg = appExpr->get_args().insert( arg, new AlignofExpr( argBaseType->clone() ) ); 751 751 arg++; 752 if ( dynamic_cast< StructInstType* >( poly Base ) ) {752 if ( dynamic_cast< StructInstType* >( polyType ) ) { 753 753 if ( StructInstType *argBaseStructType = dynamic_cast< StructInstType* >( argBaseType ) ) { 754 754 // zero-length arrays are forbidden by C, so don't pass offset for empty struct … … 1301 1301 1302 1302 boxParams( appExpr, function, arg, exprTyVars ); 1303 1304 1303 passAdapters( appExpr, function, exprTyVars ); 1305 1304 … … 1591 1590 std::set< std::string > seenTypes; // sizeofName for generic types we've seen 1592 1591 for ( std::list< DeclarationWithType* >::const_iterator fnParm = last; fnParm != funcType->get_parameters().end(); ++fnParm ) { 1593 Type *poly Base = hasPolyBase( (*fnParm)->get_type(), scopeTyVars );1594 if ( poly Base && ! dynamic_cast< TypeInstType* >( polyBase ) ) {1595 std::string typeName = mangleType( poly Base );1592 Type *polyType = isPolyType( (*fnParm)->get_type(), scopeTyVars ); 1593 if ( polyType && ! dynamic_cast< TypeInstType* >( polyType ) ) { 1594 std::string typeName = mangleType( polyType ); 1596 1595 if ( seenTypes.count( typeName ) ) continue; 1597 1596 … … 1607 1606 ++last; 1608 1607 1609 if ( StructInstType *polyBaseStruct = dynamic_cast< StructInstType* >( poly Base ) ) {1608 if ( StructInstType *polyBaseStruct = dynamic_cast< StructInstType* >( polyType ) ) { 1610 1609 // NOTE zero-length arrays are illegal in C, so empty structs have no offset array 1611 1610 if ( ! polyBaseStruct->get_baseStruct()->get_members().empty() ) { … … 1820 1819 } 1821 1820 1822 ////////////////////////////////////////// MemberExprFixer ////////////////////////////////////////////////////1821 ////////////////////////////////////////// PolyGenericCalculator //////////////////////////////////////////////////// 1823 1822 1824 1823 template< typename DeclClass > … … 1867 1866 for ( std::list< DeclarationWithType* >::const_iterator fnParm = funcType->get_parameters().begin(); fnParm != funcType->get_parameters().end(); ++fnParm ) { 1868 1867 // condition here duplicates that in Pass2::mutate( FunctionType* ) 1869 Type *poly Base = hasPolyBase( (*fnParm)->get_type(), scopeTyVars );1870 if ( poly Base && ! dynamic_cast< TypeInstType* >( polyBase ) ) {1871 knownLayouts.insert( mangleType( poly Base ) );1868 Type *polyType = isPolyType( (*fnParm)->get_type(), scopeTyVars ); 1869 if ( polyType && ! dynamic_cast< TypeInstType* >( polyType ) ) { 1870 knownLayouts.insert( mangleType( polyType ) ); 1872 1871 } 1873 1872 }
Note: See TracChangeset
for help on using the changeset viewer.