Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rd9bad51 r67467a3  
    5353        linkage( ::linkage ) {
    5454
     55//      variable.name = nullptr;
    5556        variable.tyClass = ast::TypeDecl::NUMBER_OF_KINDS;
    5657        variable.assertions = nullptr;
     
    6465        delete name;
    6566
     67//      delete variable.name;
    6668        delete variable.assertions;
    6769        delete variable.initializer;
    6870
    69         delete type;
     71//      delete type;
    7072        delete bitfieldWidth;
    7173
     
    98100        newnode->error = error;
    99101
     102//      newnode->variable.name = variable.name ? new string( *variable.name ) : nullptr;
    100103        newnode->variable.tyClass = variable.tyClass;
    101104        newnode->variable.assertions = maybeCopy( variable.assertions );
     
    225228} // DeclarationNode::newEnumValueGeneric
    226229
    227 DeclarationNode * DeclarationNode::newEnumInLine( const std::string * name ) {
    228         DeclarationNode * newnode = newName( name );
     230DeclarationNode * DeclarationNode::newEnumInLine( const string name ) {
     231        DeclarationNode * newnode = newName( new std::string(name) );
    229232        newnode->enumInLine = true;
    230233        return newnode;
     
    457460                SemanticWarning( yylloc, Warning::BadQualifiersZeroOne, TypeData::builtinTypeNames[builtin] );
    458461        } // if
    459         type = ::addQualifiers( type, q->type );
     462        type = ::addQualifiers( q->type, type );
    460463        q->type = nullptr;
    461464
     
    470473        copySpecifiers( o, copyattr );
    471474        if ( o->type ) {
    472                 type = ::addType( type, o->type, o->attributes );
     475                type = ::addType( o->type, type, o->attributes );
    473476                o->type = nullptr;
    474477        } // if
     
    581584DeclarationNode * DeclarationNode::addAssertions( DeclarationNode * assertions ) {
    582585        if ( variable.tyClass != ast::TypeDecl::NUMBER_OF_KINDS ) {
    583                 extend( variable.assertions, assertions );
     586                if ( variable.assertions ) {
     587                        variable.assertions->set_last( assertions );
     588                } else {
     589                        variable.assertions = assertions;
     590                } // if
    584591                return this;
    585592        } // if
    586593
    587594        assert( type );
    588         assert( TypeData::Symbolic == type->kind );
    589         extend( type->symbolic.assertions, assertions );
     595        switch ( type->kind ) {
     596        case TypeData::Symbolic:
     597                if ( type->symbolic.assertions ) {
     598                        type->symbolic.assertions->set_last( assertions );
     599                } else {
     600                        type->symbolic.assertions = assertions;
     601                } // if
     602                break;
     603        default:
     604                assert( false );
     605        } // switch
    590606
    591607        return this;
     
    672688
    673689DeclarationNode * DeclarationNode::addNewPointer( DeclarationNode * p ) {
    674         if ( !p ) return this;
    675         assert( p->type->kind == TypeData::Pointer || p->type->kind == TypeData::Reference );
    676         if ( type ) {
    677                 p->type->base = makeNewBase( type );
    678                 type = nullptr;
    679         } // if
    680         delete this;
    681         return p;
     690        if ( p ) {
     691                assert( p->type->kind == TypeData::Pointer || p->type->kind == TypeData::Reference );
     692                if ( type ) {
     693                        p->type->base = makeNewBase( type );
     694                        type = nullptr;
     695                } // if
     696                delete this;
     697                return p;
     698        } else {
     699                return this;
     700        } // if
    682701}
    683702
    684703DeclarationNode * DeclarationNode::addNewArray( DeclarationNode * a ) {
    685         if ( !a ) return this;
     704        if ( ! a ) return this;
    686705        assert( a->type->kind == TypeData::Array );
    687706        if ( type ) {
     
    755774                        if ( ret->kind == TypeData::Aggregate ) {
    756775                                newnode->attributes.swap( ret->aggregate.attributes );
    757                         } // if
     776                        } // if 
    758777                        return newnode;
    759778                } // if
Note: See TracChangeset for help on using the changeset viewer.