Ignore:
Timestamp:
Apr 8, 2024, 11:57:37 AM (21 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
485cf59, dd37afa
Parents:
d3a49864 (diff), d9bad51 (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rd3a49864 rcb98d9d  
    5353        linkage( ::linkage ) {
    5454
    55 //      variable.name = nullptr;
    5655        variable.tyClass = ast::TypeDecl::NUMBER_OF_KINDS;
    5756        variable.assertions = nullptr;
     
    6564        delete name;
    6665
    67 //      delete variable.name;
    6866        delete variable.assertions;
    6967        delete variable.initializer;
    7068
    71 //      delete type;
     69        delete type;
    7270        delete bitfieldWidth;
    7371
     
    10098        newnode->error = error;
    10199
    102 //      newnode->variable.name = variable.name ? new string( *variable.name ) : nullptr;
    103100        newnode->variable.tyClass = variable.tyClass;
    104101        newnode->variable.assertions = maybeCopy( variable.assertions );
     
    228225} // DeclarationNode::newEnumValueGeneric
    229226
    230 DeclarationNode * DeclarationNode::newEnumInLine( const string name ) {
    231         DeclarationNode * newnode = newName( new std::string(name) );
     227DeclarationNode * DeclarationNode::newEnumInLine( const std::string * name ) {
     228        DeclarationNode * newnode = newName( name );
    232229        newnode->enumInLine = true;
    233230        return newnode;
     
    460457                SemanticWarning( yylloc, Warning::BadQualifiersZeroOne, TypeData::builtinTypeNames[builtin] );
    461458        } // if
    462         type = ::addQualifiers( q->type, type );
     459        type = ::addQualifiers( type, q->type );
    463460        q->type = nullptr;
    464461
     
    473470        copySpecifiers( o, copyattr );
    474471        if ( o->type ) {
    475                 type = ::addType( o->type, type, o->attributes );
     472                type = ::addType( type, o->type, o->attributes );
    476473                o->type = nullptr;
    477474        } // if
     
    584581DeclarationNode * DeclarationNode::addAssertions( DeclarationNode * assertions ) {
    585582        if ( variable.tyClass != ast::TypeDecl::NUMBER_OF_KINDS ) {
    586                 if ( variable.assertions ) {
    587                         variable.assertions->set_last( assertions );
    588                 } else {
    589                         variable.assertions = assertions;
    590                 } // if
     583                extend( variable.assertions, assertions );
    591584                return this;
    592585        } // if
    593586
    594587        assert( type );
    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
     588        assert( TypeData::Symbolic == type->kind );
     589        extend( type->symbolic.assertions, assertions );
    606590
    607591        return this;
     
    688672
    689673DeclarationNode * DeclarationNode::addNewPointer( DeclarationNode * 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
     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;
    701682}
    702683
    703684DeclarationNode * DeclarationNode::addNewArray( DeclarationNode * a ) {
    704         if ( ! a ) return this;
     685        if ( !a ) return this;
    705686        assert( a->type->kind == TypeData::Array );
    706687        if ( type ) {
     
    774755                        if ( ret->kind == TypeData::Aggregate ) {
    775756                                newnode->attributes.swap( ret->aggregate.attributes );
    776                         } // if 
     757                        } // if
    777758                        return newnode;
    778759                } // if
Note: See TracChangeset for help on using the changeset viewer.