Ignore:
Timestamp:
Nov 25, 2017, 3:22:18 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c6e2c18
Parents:
9d06142 (diff), 3de176d (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 cleanup-dtors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r9d06142 rc0d00b6  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Sep 23 18:16:48 2017
    13 // Update Count     : 1024
     12// Last Modified On : Mon Nov 20 09:21:52 2017
     13// Update Count     : 1031
    1414//
    1515
     
    509509
    510510DeclarationNode * DeclarationNode::addQualifiers( DeclarationNode * q ) {
    511         if ( ! q ) { delete q; return this; }
     511        if ( ! q ) { delete q; return this; }                           // empty qualifier
    512512
    513513        checkSpecifiers( q );
    514514        copySpecifiers( q );
    515515
    516         if ( ! q->type ) {
    517                 delete q;
    518                 return this;
    519         } // if
     516        if ( ! q->type ) { delete q; return this; }
    520517
    521518        if ( ! type ) {
    522                 type = q->type;                                                                 // reuse this structure
     519                type = q->type;                                                                 // reuse structure
    523520                q->type = nullptr;
    524521                delete q;
     
    526523        } // if
    527524
    528         if ( q->type->forall ) {
    529                 if ( type->forall ) {
    530                         type->forall->appendList( q->type->forall );
     525        if ( q->type->forall ) {                                                        // forall qualifier ?
     526                if ( type->forall ) {                                                   // polymorphic routine ?
     527                        type->forall->appendList( q->type->forall ); // augment forall qualifier
    531528                } else {
    532                         if ( type->kind == TypeData::Aggregate ) {
    533                                 type->aggregate.params = q->type->forall;
    534                                 // change implicit typedef from TYPEDEFname to TYPEGENname
    535                                 typedefTable.changeKind( *type->aggregate.name, TypedefTable::TG );
    536                         } else {
    537                                 type->forall = q->type->forall;
     529                        if ( type->kind == TypeData::Aggregate ) {      // struct/union ?
     530                                if ( type->aggregate.params ) {                 // polymorphic ?
     531                                        type->aggregate.params->appendList( q->type->forall ); // augment forall qualifier
     532                                } else {                                                                // not polymorphic
     533                                        type->aggregate.params = q->type->forall; // make polymorphic type
     534                                        // change implicit typedef from TYPEDEFname to TYPEGENname
     535                                        typedefTable.changeKind( *type->aggregate.name, TypedefTable::TG );
     536                                } // if
     537                        } else {                                                                        // not polymorphic
     538                                type->forall = q->type->forall;                 // make polymorphic routine
    538539                        } // if
    539540                } // if
    540                 q->type->forall = nullptr;
     541                q->type->forall = nullptr;                                              // forall qualifier moved
    541542        } // if
    542543
Note: See TracChangeset for help on using the changeset viewer.