Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r2a7b3ca rfea3faa  
    202202                };
    203203
    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 variable
     204                /// 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.
    205205                class Pass3 final : public PolyMutator {
    206206                  public:
     
    210210                        using PolyMutator::mutate;
    211211                        virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override;
     212                        virtual Declaration *mutate( StructDecl *structDecl ) override;
     213                        virtual Declaration *mutate( UnionDecl *unionDecl ) override;
    212214                        virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) override;
    213215                        virtual TypedefDecl *mutate( TypedefDecl *objectDecl ) override;
     
    504506                DeclarationWithType *Pass1::mutate( FunctionDecl *functionDecl ) {
    505507                        if ( functionDecl->get_statements() ) {         // empty routine body ?
    506                                 // std::cerr << "mutating function: " << functionDecl->get_mangleName() << std::endl;
    507508                                doBeginScope();
    508509                                scopeTyVars.beginScope();
     
    549550                                retval = oldRetval;
    550551                                doEndScope();
    551                                 // std::cerr << "end function: " << functionDecl->get_mangleName() << std::endl;
    552552                        } // if
    553553                        return functionDecl;
     
    11181118
    11191119                Expression *Pass1::mutate( ApplicationExpr *appExpr ) {
    1120                         // std::cerr << "mutate appExpr: " << InitTweak::getFunctionName( appExpr ) << std::endl;
     1120                        // std::cerr << "mutate appExpr: ";
    11211121                        // for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
    11221122                        //      std::cerr << i->first << " ";
     
    11431143                        ReferenceToType *dynRetType = isDynRet( function, exprTyVars );
    11441144
    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 
    11531145                        // 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
    11541146                        // passTypeVars needs to know the program-text return type (i.e. the distinction between _conc_T30 and T3(int))
    11551147                        // concRetType may not be a good name in one or both of these places. A more appropriate name change is welcome.
    11561148                        if ( dynRetType ) {
    1157                                 // std::cerr << "dynRetType: " << dynRetType << std::endl;
    11581149                                Type *concRetType = appExpr->get_result()->isVoid() ? nullptr : appExpr->get_result();
    11591150                                ret = addDynRetParam( appExpr, concRetType, arg ); // xxx - used to use dynRetType instead of concRetType
     
    18681859                }
    18691860
     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
    18701876                TypeDecl * Pass3::mutate( TypeDecl *typeDecl ) {
    18711877//   Initializer *init = 0;
Note: See TracChangeset for help on using the changeset viewer.