Ignore:
Timestamp:
Sep 11, 2015, 9:44:54 AM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, 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, resolv-new, string, with_gc
Children:
32a1e5fd
Parents:
f60d997 (diff), 4550bcf (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 plg2:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rf60d997 raa99647  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jul 27 14:40:06 2015
    13 // Update Count     : 218
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Wed Aug 12 14:33:52 2015
     13// Update Count     : 222
    1414//
    1515
     
    186186        }
    187187
     188        void CodeGenerator::printDesignators( std::list< Expression * > & designators ) {
     189                typedef std::list< Expression * > DesignatorList;
     190                if ( designators.size() == 0 ) return;
     191                for ( DesignatorList::iterator iter = designators.begin(); iter != designators.end(); ++iter ) {
     192                        if ( NameExpr * nm = dynamic_cast< NameExpr * >( *iter ) ) {
     193                                // if expression is a name, then initializing aggregate member
     194                                output << ".";
     195                                (*iter)->accept( *this );
     196                        } else {
     197                                // if not a simple name, it has to be a constant expression, i.e. an array designator
     198                                output << "[";
     199                                (*iter)->accept( *this );
     200                                output << "]";
     201                        }
     202                }
     203                output << " = ";
     204        }
     205
    188206        void CodeGenerator::visit( SingleInit *init ) {
     207                printDesignators( init->get_designators() );
    189208                init->get_value()->accept( *this );
    190209        }
    191210
    192211        void CodeGenerator::visit( ListInit *init ) {
     212                printDesignators( init->get_designators() );
    193213                output << "{ ";
    194214                genCommaList( init->begin_initializers(), init->end_initializers() );
Note: See TracChangeset for help on using the changeset viewer.