Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.cc

    rd7dc824 r4b0f997  
    262262        // E ?=?(E volatile*, int),
    263263        //   ?=?(E _Atomic volatile*, int);
    264         void makeEnumFunctions( EnumInstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) {
     264        void makeEnumFunctions( EnumDecl *enumDecl, EnumInstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) {
    265265
    266266                // T ?=?(E *, E);
     
    486486
    487487        /// generates the body of a union assignment/copy constructor/field constructor
    488         void makeUnionAssignBody( FunctionDecl * funcDecl ) {
     488        void makeUnionAssignBody( FunctionDecl * funcDecl, bool isDynamicLayout ) {
    489489                FunctionType * ftype = funcDecl->get_functionType();
    490490                assert( ftype->get_parameters().size() == 2 );
     
    506506                // Make function polymorphic in same parameters as generic union, if applicable
    507507                const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions
    508                
     508                bool isDynamicLayout = hasDynamicLayout( aggregateDecl );  // NOTE this flag is an incredibly ugly kludge; we should fix the assignment signature instead (ditto for struct)
     509
    509510                // default ctor/dtor need only first parameter
    510511                // void ?{}(T *); void ^?{}(T *);
     
    532533                FunctionDecl *dtorDecl = genFunc( "^?{}", dtorType, functionNesting );
    533534
    534                 makeUnionAssignBody( assignDecl );
     535                makeUnionAssignBody( assignDecl, isDynamicLayout );
    535536
    536537                // body of assignment and copy ctor is the same
    537                 makeUnionAssignBody( copyCtorDecl );
     538                makeUnionAssignBody( copyCtorDecl, isDynamicLayout );
    538539
    539540                // create a constructor which takes the first member type as a parameter.
     
    550551                                FunctionDecl * ctor = genFunc( "?{}", memCtorType, functionNesting );
    551552
    552                                 makeUnionAssignBody( ctor );
     553                                makeUnionAssignBody( ctor, isDynamicLayout );
    553554                                memCtors.push_back( ctor );
    554555                                // only generate a ctor for the first field
     
    577578                        EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() );
    578579                        // enumInst->set_baseEnum( enumDecl );
    579                         makeEnumFunctions( enumInst, functionNesting, declsToAddAfter );
     580                        makeEnumFunctions( enumDecl, enumInst, functionNesting, declsToAddAfter );
    580581                }
    581582        }
Note: See TracChangeset for help on using the changeset viewer.