Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.cc

    rb8524ca r6926a6d  
    2424#include <vector>                  // for vector
    2525
    26 #include "AST/Decl.hpp"
    2726#include "CodeGen/OperatorTable.h" // for isCtorDtor, isCtorDtorAssign
    2827#include "Common/PassVisitor.h"    // for PassVisitor
     
    4241
    4342namespace SymTab {
     43        Type * SizeType = 0;
     44
    4445        /// Data used to generate functions generically. Specifically, the name of the generated function and a function which generates the routine protoype
    4546        struct FuncData {
    46                 typedef FunctionType * (*TypeGen)( Type *, bool );
     47                typedef FunctionType * (*TypeGen)( Type * );
    4748                FuncData( const std::string & fname, const TypeGen & genType ) : fname( fname ), genType( genType ) {}
    4849                std::string fname;
     
    210211        }
    211212
    212         bool isUnnamedBitfield( const ast::ObjectDecl * obj ) {
    213                 return obj && obj->name.empty() && obj->bitfieldWidth;
    214         }
    215 
    216213        /// inserts a forward declaration for functionDecl into declsToAdd
    217214        void addForwardDecl( FunctionDecl * functionDecl, std::list< Declaration * > & declsToAdd ) {
     
    234231
    235232        /// given type T, generate type of default ctor/dtor, i.e. function type void (*) (T *)
    236         FunctionType * genDefaultType( Type * paramType, bool maybePolymorphic ) {
     233        FunctionType * genDefaultType( Type * paramType ) {
     234                const auto & typeParams = getGenericParams( paramType );
    237235                FunctionType *ftype = new FunctionType( Type::Qualifiers(), false );
    238                 if ( maybePolymorphic ) {
    239                         // only copy in
    240                         const auto & typeParams = getGenericParams( paramType );
    241                         cloneAll( typeParams, ftype->forall );
    242                 }
     236                cloneAll( typeParams, ftype->forall );
    243237                ObjectDecl *dstParam = new ObjectDecl( "_dst", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), paramType->clone() ), nullptr );
    244238                ftype->parameters.push_back( dstParam );
     
    247241
    248242        /// given type T, generate type of copy ctor, i.e. function type void (*) (T *, T)
    249         FunctionType * genCopyType( Type * paramType, bool maybePolymorphic ) {
    250                 FunctionType *ftype = genDefaultType( paramType, maybePolymorphic );
     243        FunctionType * genCopyType( Type * paramType ) {
     244                FunctionType *ftype = genDefaultType( paramType );
    251245                ObjectDecl *srcParam = new ObjectDecl( "_src", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
    252246                ftype->parameters.push_back( srcParam );
     
    255249
    256250        /// given type T, generate type of assignment, i.e. function type T (*) (T *, T)
    257         FunctionType * genAssignType( Type * paramType, bool maybePolymorphic ) {
    258                 FunctionType *ftype = genCopyType( paramType, maybePolymorphic );
     251        FunctionType * genAssignType( Type * paramType ) {
     252                FunctionType *ftype = genCopyType( paramType );
    259253                ObjectDecl *returnVal = new ObjectDecl( "_ret", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
    260254                ftype->returnVals.push_back( returnVal );
     
    314308                for ( const FuncData & d : data ) {
    315309                        // generate a function (?{}, ?=?, ^?{}) based on the current FuncData.
    316                         FunctionType * ftype = d.genType( type, true );
     310                        FunctionType * ftype = d.genType( type );
    317311
    318312                        // destructor for concurrent type must be mutex
     
    393387
    394388        void StructFuncGenerator::makeMemberOp( ObjectDecl * dstParam, Expression * src, DeclarationWithType * field, FunctionDecl * func, bool forward ) {
    395                 InitTweak::InitExpander_old srcParam( src );
     389                InitTweak::InitExpander srcParam( src );
    396390
    397391                // assign to destination
Note: See TracChangeset for help on using the changeset viewer.