Changeset 32805db for src/GenPoly
- Timestamp:
- Jan 22, 2016, 1:54:30 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:
- 6d160d7
- Parents:
- 4a79e3c9
- Location:
- src/GenPoly
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/GenPoly/Box.cc ¶
r4a79e3c9 r32805db 423 423 std::set< std::string > seenTypes; //< names for generic types we've seen 424 424 for ( ; fnParm != funcType->get_parameters().end() && fnArg != appExpr->get_args().end(); ++fnParm, ++fnArg ) { 425 Type *p armType = (*fnParm)->get_type();426 if ( ! dynamic_cast< TypeInstType* >( parmType ) && isPolyType( parmType, exprTyVars) ) {427 std::string sizeName = sizeofName( p armType );425 Type *polyBase = hasPolyBase( (*fnParm)->get_type(), exprTyVars ); 426 if ( polyBase && ! dynamic_cast< TypeInstType* >( polyBase ) ) { 427 std::string sizeName = sizeofName( polyBase ); 428 428 if ( seenTypes.count( sizeName ) ) continue; 429 429 430 assert( ! (*fnArg)->get_results().empty() ); 431 Type *argType = (*fnArg)->get_results().front(); 432 arg = appExpr->get_args().insert( arg, new SizeofExpr( argType->clone() ) ); 430 VariableExpr *fnArgBase = getBaseVar( *fnArg ); 431 assert( fnArgBase && ! fnArgBase->get_results().empty() ); 432 Type *argBaseType = fnArgBase->get_results().front(); 433 arg = appExpr->get_args().insert( arg, new SizeofExpr( argBaseType->clone() ) ); 433 434 arg++; 434 arg = appExpr->get_args().insert( arg, new AlignofExpr( arg Type->clone() ) );435 arg = appExpr->get_args().insert( arg, new AlignofExpr( argBaseType->clone() ) ); 435 436 arg++; 436 if ( dynamic_cast< StructInstType* >( p armType ) ) {437 if ( StructInstType *arg StructType = dynamic_cast< StructInstType* >( argType ) ) {438 arg = appExpr->get_args().insert( arg, makeOffsetArray( arg StructType ) );437 if ( dynamic_cast< StructInstType* >( polyBase ) ) { 438 if ( StructInstType *argBaseStructType = dynamic_cast< StructInstType* >( argBaseType ) ) { 439 arg = appExpr->get_args().insert( arg, makeOffsetArray( argBaseStructType ) ); 439 440 arg++; 440 441 } else { … … 1177 1178 std::set< std::string > seenTypes; // sizeofName for generic types we've seen 1178 1179 for ( std::list< DeclarationWithType* >::const_iterator fnParm = last; fnParm != funcType->get_parameters().end(); ++fnParm ) { 1179 Type *p armType = (*fnParm)->get_type();1180 if ( ! dynamic_cast< TypeInstType* >( parmType ) && isPolyType( parmType, scopeTyVars) ) {1181 std::string sizeName = sizeofName( p armType );1180 Type *polyBase = hasPolyBase( (*fnParm)->get_type(), scopeTyVars ); 1181 if ( polyBase && ! dynamic_cast< TypeInstType* >( polyBase ) ) { 1182 std::string sizeName = sizeofName( polyBase ); 1182 1183 if ( seenTypes.count( sizeName ) ) continue; 1183 1184 … … 1189 1190 1190 1191 alignParm = newObj.clone(); 1191 alignParm->set_name( alignofName( p armType ) );1192 alignParm->set_name( alignofName( polyBase ) ); 1192 1193 last = funcType->get_parameters().insert( last, alignParm ); 1193 1194 ++last; 1194 1195 1195 if ( dynamic_cast< StructInstType* >( p armType ) ) {1196 if ( dynamic_cast< StructInstType* >( polyBase ) ) { 1196 1197 offsetParm = newPtr.clone(); 1197 offsetParm->set_name( offsetofName( p armType ) );1198 offsetParm->set_name( offsetofName( polyBase ) ); 1198 1199 last = funcType->get_parameters().insert( last, offsetParm ); 1199 1200 ++last; -
TabularUnified src/GenPoly/GenPoly.cc ¶
r4a79e3c9 r32805db 168 168 // found the variable directly 169 169 return varExpr; 170 } else if ( AddressExpr *addressExpr = dynamic_cast< AddressExpr* >( expr ) ) { 171 return getBaseVar( addressExpr->get_arg() ); 170 172 } else if ( UntypedExpr *untypedExpr = dynamic_cast< UntypedExpr* >( expr ) ) { 171 173 // look for compiler-inserted dereference operator
Note: See TracChangeset
for help on using the changeset viewer.