Changes in src/GenPoly/Box.cc [2a7b3ca:fea3faa]
- File:
-
- 1 edited
-
src/GenPoly/Box.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r2a7b3ca rfea3faa 202 202 }; 203 203 204 /// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, and sizeof expressions of polymorphic types with the proper variable204 /// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, sizeof expressions of polymorphic types with the proper variable, and strips fields from generic struct declarations. 205 205 class Pass3 final : public PolyMutator { 206 206 public: … … 210 210 using PolyMutator::mutate; 211 211 virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override; 212 virtual Declaration *mutate( StructDecl *structDecl ) override; 213 virtual Declaration *mutate( UnionDecl *unionDecl ) override; 212 214 virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) override; 213 215 virtual TypedefDecl *mutate( TypedefDecl *objectDecl ) override; … … 504 506 DeclarationWithType *Pass1::mutate( FunctionDecl *functionDecl ) { 505 507 if ( functionDecl->get_statements() ) { // empty routine body ? 506 // std::cerr << "mutating function: " << functionDecl->get_mangleName() << std::endl;507 508 doBeginScope(); 508 509 scopeTyVars.beginScope(); … … 549 550 retval = oldRetval; 550 551 doEndScope(); 551 // std::cerr << "end function: " << functionDecl->get_mangleName() << std::endl;552 552 } // if 553 553 return functionDecl; … … 1118 1118 1119 1119 Expression *Pass1::mutate( ApplicationExpr *appExpr ) { 1120 // std::cerr << "mutate appExpr: " << InitTweak::getFunctionName( appExpr ) << std::endl;1120 // std::cerr << "mutate appExpr: "; 1121 1121 // for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) { 1122 1122 // std::cerr << i->first << " "; … … 1143 1143 ReferenceToType *dynRetType = isDynRet( function, exprTyVars ); 1144 1144 1145 // std::cerr << function << std::endl;1146 // std::cerr << "scopeTyVars: ";1147 // printTyVarMap( std::cerr, scopeTyVars );1148 // std::cerr << "exprTyVars: ";1149 // printTyVarMap( std::cerr, exprTyVars );1150 // std::cerr << "env: " << *env << std::endl;1151 // std::cerr << needsAdapter( function, scopeTyVars ) << ! needsAdapter( function, exprTyVars) << std::endl;1152 1153 1145 // NOTE: addDynRetParam needs to know the actual (generated) return type so it can make a temp variable, so pass the result type from the appExpr 1154 1146 // passTypeVars needs to know the program-text return type (i.e. the distinction between _conc_T30 and T3(int)) 1155 1147 // concRetType may not be a good name in one or both of these places. A more appropriate name change is welcome. 1156 1148 if ( dynRetType ) { 1157 // std::cerr << "dynRetType: " << dynRetType << std::endl;1158 1149 Type *concRetType = appExpr->get_result()->isVoid() ? nullptr : appExpr->get_result(); 1159 1150 ret = addDynRetParam( appExpr, concRetType, arg ); // xxx - used to use dynRetType instead of concRetType … … 1868 1859 } 1869 1860 1861 /// Strips the members from a generic aggregate 1862 void stripGenericMembers(AggregateDecl* decl) { 1863 if ( ! decl->get_parameters().empty() ) decl->get_members().clear(); 1864 } 1865 1866 Declaration *Pass3::mutate( StructDecl *structDecl ) { 1867 stripGenericMembers( structDecl ); 1868 return structDecl; 1869 } 1870 1871 Declaration *Pass3::mutate( UnionDecl *unionDecl ) { 1872 stripGenericMembers( unionDecl ); 1873 return unionDecl; 1874 } 1875 1870 1876 TypeDecl * Pass3::mutate( TypeDecl *typeDecl ) { 1871 1877 // Initializer *init = 0;
Note:
See TracChangeset
for help on using the changeset viewer.