Changeset fb24492


Ignore:
Timestamp:
May 12, 2016, 1:19:59 PM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
03286aa, 7b3f66b
Parents:
ec79847 (diff), 228851d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into ctor

Conflicts:

src/SymTab/Validate.cc

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    rec79847 rfb24492  
    499499
    500500                        // place current size in the current offset index
    501                         addExpr( layoutDecl->get_statements(), makeOp( "?=?", makeOp( "?[?]", new VariableExpr( offsetParam ), new ConstantExpr( Constant::from( n_members ) ) ),
     501                        addExpr( layoutDecl->get_statements(), makeOp( "?=?", makeOp( "?[?]", new VariableExpr( offsetParam ), new ConstantExpr( Constant::from_ulong( n_members ) ) ),
    502502                                                                              derefVar( sizeParam ) ) );
    503503                        ++n_members;
     
    20692069                                if ( n_members == 0 ) {
    20702070                                        // all empty structs have the same layout - size 1, align 1
    2071                                         makeVar( sizeofName( typeName ), layoutType, new SingleInit( new ConstantExpr( Constant::from( (unsigned long)1 ) ) ) );
    2072                                         makeVar( alignofName( typeName ), layoutType->clone(), new SingleInit( new ConstantExpr( Constant::from( (unsigned long)1 ) ) ) );
     2071                                        makeVar( sizeofName( typeName ), layoutType, new SingleInit( new ConstantExpr( Constant::from_ulong( 1 ) ) ) );
     2072                                        makeVar( alignofName( typeName ), layoutType->clone(), new SingleInit( new ConstantExpr( Constant::from_ulong( 1 ) ) ) );
    20732073                                        // NOTE zero-length arrays are forbidden in C, so empty structs have no offsetof array
    20742074                                } else {
    20752075                                        ObjectDecl *sizeVar = makeVar( sizeofName( typeName ), layoutType );
    20762076                                        ObjectDecl *alignVar = makeVar( alignofName( typeName ), layoutType->clone() );
    2077                                         ObjectDecl *offsetVar = makeVar( offsetofName( typeName ), new ArrayType( Type::Qualifiers(), layoutType->clone(), new ConstantExpr( Constant::from( n_members ) ), false, false ) );
     2077                                        ObjectDecl *offsetVar = makeVar( offsetofName( typeName ), new ArrayType( Type::Qualifiers(), layoutType->clone(), new ConstantExpr( Constant::from_int( n_members ) ), false, false ) );
    20782078
    20792079                                        // generate call to layout function
     
    21942194
    21952195                                        // build the offset array and replace the pack with a reference to it
    2196                                         ObjectDecl *offsetArray = makeVar( offsetName, new ArrayType( Type::Qualifiers(), offsetType, new ConstantExpr( Constant::from( baseMembers.size() ) ), false, false ),
     2196                                        ObjectDecl *offsetArray = makeVar( offsetName, new ArrayType( Type::Qualifiers(), offsetType, new ConstantExpr( Constant::from_ulong( baseMembers.size() ) ), false, false ),
    21972197                                                        new ListInit( inits ) );
    21982198                                        ret = new VariableExpr( offsetArray );
  • src/SymTab/Autogen.cc

    rec79847 rfb24492  
    1010// Created On       : Thu Mar 03 15:45:56 2016
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue May 03 16:56:21 2016
     12// Last Modified On : Wed May 11 13:22:03 2016
    1313// Update Count     : 1
    1414//
     
    217217                                if ( type->get_qualifiers().isConst ) {
    218218                                        // don't assign const members
     219                                        continue;
     220                                }
     221
     222                                if ( field->get_name() == "" ) {
     223                                        // don't assign to anonymous members
     224                                        // xxx - this is a temporary fix. Anonymous members tie into
     225                                        // our inheritance model. I think the correct way to handle this is to
     226                                        // cast the structure to the type of the member and let the resolver
     227                                        // figure out whether it's valid and have a pass afterwards that fixes
     228                                        // the assignment to use pointer arithmetic with the offset of the
     229                                        // member, much like how generic type members are handled.
    219230                                        continue;
    220231                                }
     
    317328                        if ( isUnnamedBitfield( dynamic_cast< ObjectDecl * > ( member ) ) ) {
    318329                                // don't make a function whose parameter is an unnamed bitfield
     330                                continue;
     331                        } else if ( member->get_name() == "" ) {
     332                                // don't assign to anonymous members
     333                                // xxx - this is a temporary fix. Anonymous members tie into
     334                                // our inheritance model. I think the correct way to handle this is to
     335                                // cast the structure to the type of the member and let the resolver
     336                                // figure out whether it's valid and have a pass afterwards that fixes
     337                                // the assignment to use pointer arithmetic with the offset of the
     338                                // member, much like how generic type members are handled.
    319339                                continue;
    320340                        }
  • src/SymTab/Validate.cc

    rec79847 rfb24492  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Apr 14 15:37:23 2016
     12// Last Modified On : Wed May 11 13:17:52 2016
    1313// Update Count     : 297
    1414//
  • src/SynTree/Constant.cc

    rec79847 rfb24492  
    3030Constant::~Constant() { delete type; }
    3131
    32 Constant Constant::from( int i ) {
     32Constant Constant::from_int( int i ) {
    3333        return Constant( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), std::to_string( i ) );
    3434}
    3535
    36 Constant Constant::from( unsigned long i ) {
     36Constant Constant::from_ulong( unsigned long i ) {
    3737        return Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), std::to_string( i ) );
    3838}
    3939
    40 Constant Constant::from( double d ) {
     40Constant Constant::from_double( double d ) {
    4141        return Constant( new BasicType( Type::Qualifiers(), BasicType::Double ), std::to_string( d ) );
    4242}
  • src/SynTree/Constant.h

    rec79847 rfb24492  
    3333
    3434        /// generates an integer constant of the given int
    35         static Constant from( int i );
     35        static Constant from_int( int i );
    3636        /// generates an integer constant of the given unsigned long int
    37         static Constant from( unsigned long i );
     37        static Constant from_ulong( unsigned long i );
    3838        /// generates a floating point constant of the given double
    39         static Constant from( double d );
     39        static Constant from_double( double d );
    4040
    4141        virtual Constant *clone() const;
Note: See TracChangeset for help on using the changeset viewer.