Ignore:
Timestamp:
Sep 21, 2022, 11:02:15 AM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
95dab9e
Parents:
428adbc (diff), 0bd46fd (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 pthread-emulation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r428adbc r7f6a7c9  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 14 17:36:57 2021
    13 // Update Count     : 1154
     12// Last Modified On : Mon Aug  8 17:07:00 2022
     13// Update Count     : 1185
    1414//
    1515
     
    128128        if ( name ) {
    129129                os << *name << ": ";
    130         } else {
    131                 os << "unnamed: ";
    132130        } // if
    133131
     
    154152                initializer->printOneLine( os );
    155153                os << " maybe constructed? " << initializer->get_maybeConstructed();
    156 
    157         } // if
     154        } // if
     155
     156        for ( Attribute * attr: reverseIterate( attributes ) ) {
     157                os << string( indent + 2, ' ' ) << "attr " << attr->name.c_str();
     158        } // for
    158159
    159160        os << endl;
     
    243244        newnode->type = new TypeData( TypeData::Aggregate );
    244245        newnode->type->aggregate.kind = kind;
    245         newnode->type->aggregate.name =  name == nullptr ? new string( DeclarationNode::anonymous.newName() ) : name;
     246        newnode->type->aggregate.name = name == nullptr ? new string( DeclarationNode::anonymous.newName() ) : name;
    246247        newnode->type->aggregate.actuals = actuals;
    247248        newnode->type->aggregate.fields = fields;
     
    253254} // DeclarationNode::newAggregate
    254255
    255 DeclarationNode * DeclarationNode::newEnum( const string * name, DeclarationNode * constants, bool body, DeclarationNode * base) {
     256DeclarationNode * DeclarationNode::newEnum( const string * name, DeclarationNode * constants, bool body, bool typed, DeclarationNode * base) {
    256257        DeclarationNode * newnode = new DeclarationNode;
    257258        newnode->type = new TypeData( TypeData::Enum );
     
    260261        newnode->type->enumeration.body = body;
    261262        newnode->type->enumeration.anon = name == nullptr;
     263        newnode->type->enumeration.typed = typed;
    262264        if ( base && base->type)  {
    263                 newnode->type->base = base->type;       
    264         } // if
    265 
    266         // Check: if base has TypeData
     265                newnode->type->base = base->type;
     266        } // if
     267
    267268        return newnode;
    268269} // DeclarationNode::newEnum
     
    284285
    285286DeclarationNode * DeclarationNode::newEnumValueGeneric( const string * name, InitializerNode * init ) {
    286         if ( init ) { // list init {} or a singleInit
    287                 if ( init->get_expression() ) { // singleInit
     287        if ( init ) {
     288                if ( init->get_expression() ) {
    288289                        return newEnumConstant( name, init->get_expression() );
    289                 } else { // TODO: listInit
     290                } else {
    290291                        DeclarationNode * newnode = newName( name );
    291292                        newnode->initializer = init;
     
    293294                } // if
    294295        } else {
    295                 return newName( name ); // Not explicitly inited enum value;
     296                return newName( name );
    296297        } // if
    297298} // DeclarationNode::newEnumValueGeneric
     
    504505                        } // for
    505506                        // src is the new item being added and has a single bit
    506                 } else if ( ! src->storageClasses.is_threadlocal ) { // conflict ?
     507                } else if ( ! src->storageClasses.is_threadlocal_any() ) { // conflict ?
    507508                        appendError( error, string( "conflicting " ) + Type::StorageClassesNames[storageClasses.ffs()] +
    508509                                                 " & " + Type::StorageClassesNames[src->storageClasses.ffs()] );
     
    518519        storageClasses |= q->storageClasses;
    519520
    520         for ( Attribute *attr: reverseIterate( q->attributes ) ) {
     521        for ( Attribute * attr: reverseIterate( q->attributes ) ) {
    521522                attributes.push_front( attr->clone() );
    522523        } // for
     
    683684        } // if
    684685        delete o;
     686
    685687        return this;
    686688}
Note: See TracChangeset for help on using the changeset viewer.