Ignore:
Timestamp:
Apr 13, 2016, 5:08:56 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
b11fac4
Parents:
3849857
Message:

generate implicit typedef right after sue name appears, further fixes storage allocation routines and comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r3849857 r45161b4d  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar 21 21:04:23 2016
    13 // Update Count     : 142
     12// Last Modified On : Wed Apr 13 16:53:17 2016
     13// Update Count     : 161
    1414//
    1515
     
    188188        newnode->type->aggregate->name = assign_strptr( name );
    189189        if ( newnode->type->aggregate->name == "" ) {           // anonymous aggregate ?
    190                 newnode->type->aggregate->name = DeclarationNode::anonymous.newName();
    191         } else if ( ! typedefTable.exists( newnode->type->aggregate->name ) ) {
    192                 // SKULLDUGGERY: Generate a typedef for the aggregate name so the aggregate does not have to be qualified by
    193                 // "struct". Only generate the typedef, if the name is not in use. The typedef is implicitly (silently) removed
    194                 // if the name is explicitly used.
    195                 typedefTable.addToEnclosingScope( newnode->type->aggregate->name, TypedefTable::TD );
    196                 DeclarationNode *typedf = new DeclarationNode;
    197                 typedf->name = newnode->type->aggregate->name;
    198                 newnode->appendList( typedf->addType( newnode->clone() )->addTypedef() );
     190                newnode->type->aggregate->name = anonymous.newName();
    199191        } // if
    200192        newnode->type->aggregate->actuals = actuals;
     
    210202        if ( newnode->type->enumeration->name == "" ) {         // anonymous enumeration ?
    211203                newnode->type->enumeration->name = DeclarationNode::anonymous.newName();
    212         } else if ( ! typedefTable.exists( newnode->type->enumeration->name ) ) {
    213                 // SKULLDUGGERY: Generate a typedef for the enumeration name so the enumeration does not have to be qualified by
    214                 // "enum". Only generate the typedef, if the name is not in use. The typedef is implicitly (silently) removed if
    215                 // the name is explicitly used.
    216                 typedefTable.addToEnclosingScope( newnode->type->enumeration->name, TypedefTable::TD );
    217                 DeclarationNode *typedf = new DeclarationNode;
    218                 typedf->name = newnode->type->enumeration->name;
    219                 newnode->appendList( typedf->addType( newnode->clone() )->addTypedef() );
    220204        } // if
    221205        newnode->type->enumeration->constants = constants;
Note: See TracChangeset for help on using the changeset viewer.