Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.cc

    r2bfc6b2 r6926a6d  
    4141
    4242namespace SymTab {
     43        Type * SizeType = 0;
     44
    4345        /// Data used to generate functions generically. Specifically, the name of the generated function and a function which generates the routine protoype
    4446        struct FuncData {
    45                 typedef FunctionType * (*TypeGen)( Type *, bool );
     47                typedef FunctionType * (*TypeGen)( Type * );
    4648                FuncData( const std::string & fname, const TypeGen & genType ) : fname( fname ), genType( genType ) {}
    4749                std::string fname;
     
    229231
    230232        /// given type T, generate type of default ctor/dtor, i.e. function type void (*) (T *)
    231         FunctionType * genDefaultType( Type * paramType, bool maybePolymorphic ) {
     233        FunctionType * genDefaultType( Type * paramType ) {
     234                const auto & typeParams = getGenericParams( paramType );
    232235                FunctionType *ftype = new FunctionType( Type::Qualifiers(), false );
    233                 if ( maybePolymorphic ) {
    234                         // only copy in
    235                         const auto & typeParams = getGenericParams( paramType );
    236                         cloneAll( typeParams, ftype->forall );
    237                 }
     236                cloneAll( typeParams, ftype->forall );
    238237                ObjectDecl *dstParam = new ObjectDecl( "_dst", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), paramType->clone() ), nullptr );
    239238                ftype->parameters.push_back( dstParam );
     
    242241
    243242        /// given type T, generate type of copy ctor, i.e. function type void (*) (T *, T)
    244         FunctionType * genCopyType( Type * paramType, bool maybePolymorphic ) {
    245                 FunctionType *ftype = genDefaultType( paramType, maybePolymorphic );
     243        FunctionType * genCopyType( Type * paramType ) {
     244                FunctionType *ftype = genDefaultType( paramType );
    246245                ObjectDecl *srcParam = new ObjectDecl( "_src", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
    247246                ftype->parameters.push_back( srcParam );
     
    250249
    251250        /// given type T, generate type of assignment, i.e. function type T (*) (T *, T)
    252         FunctionType * genAssignType( Type * paramType, bool maybePolymorphic ) {
    253                 FunctionType *ftype = genCopyType( paramType, maybePolymorphic );
     251        FunctionType * genAssignType( Type * paramType ) {
     252                FunctionType *ftype = genCopyType( paramType );
    254253                ObjectDecl *returnVal = new ObjectDecl( "_ret", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
    255254                ftype->returnVals.push_back( returnVal );
     
    309308                for ( const FuncData & d : data ) {
    310309                        // generate a function (?{}, ?=?, ^?{}) based on the current FuncData.
    311                         FunctionType * ftype = d.genType( type, true );
     310                        FunctionType * ftype = d.genType( type );
    312311
    313312                        // destructor for concurrent type must be mutex
Note: See TracChangeset for help on using the changeset viewer.