Changeset fdca7c6


Ignore:
Timestamp:
May 18, 2017, 8:42:21 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
27caf8d
Parents:
17e0dc9
Message:

mark aggregate as generic before parsing aggregate body so generic-type name available in body

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r17e0dc9 rfdca7c6  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 30 15:42:32 2017
    13 // Update Count     : 2318
     12// Last Modified On : Thu May 18 18:06:17 2017
     13// Update Count     : 2338
    1414//
    1515
     
    8585        } // for
    8686} // distExt
     87
     88bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
    8789%}
    8890
     
    15561558sue_type_specifier:                                                                             // struct, union, enum + type specifier
    15571559        elaborated_type
    1558         | type_qualifier_list elaborated_type
    1559                 { $$ = $2->addQualifiers( $1 ); }
     1560        | type_qualifier_list
     1561                { if ( $1->type != nullptr && $1->type->forall ) forall = true; } // remember generic type
     1562          elaborated_type
     1563                { $$ = $3->addQualifiers( $1 ); }
    15601564        | sue_type_specifier type_qualifier
    15611565                { $$ = $1->addQualifiers( $2 ); }
     
    16131617                { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), nullptr, $4, true )->addQualifiers( $2 ); }
    16141618        | aggregate_key attribute_list_opt no_attr_identifier_or_type_name
    1615                 { typedefTable.makeTypedef( *$3 ); }
     1619                {
     1620                        typedefTable.makeTypedef( *$3 );                        // create typedef
     1621                        if ( forall ) typedefTable.changeKind( *$3, TypedefTable::TG ); // possibly update
     1622                        forall = false;                                                         // reset
     1623                }
    16161624          '{' field_declaration_list '}'
    16171625                { $$ = DeclarationNode::newAggregate( $1, $3, nullptr, $6, true )->addQualifiers( $2 ); }
Note: See TracChangeset for help on using the changeset viewer.