Changeset f32c7f4
- Timestamp:
- Aug 12, 2015, 2:35:51 PM (9 years ago)
- 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:
- 4550bcf
- Parents:
- d60ccbf
- git-author:
- Rob Schluntz <rschlunt@…> (08/12/15 14:33:29)
- git-committer:
- Rob Schluntz <rschlunt@…> (08/12/15 14:35:51)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
rd60ccbf rf32c7f4 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Mon Jul 27 14:40:06201513 // Update Count : 2 1811 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Aug 12 14:33:52 2015 13 // Update Count : 222 14 14 // 15 15 … … 190 190 if ( designators.size() == 0 ) return; 191 191 for ( DesignatorList::iterator iter = designators.begin(); iter != designators.end(); ++iter ) { 192 // if expression is a name, then initializing aggregate member, if constant expression then array193 192 if ( NameExpr * nm = dynamic_cast< NameExpr * >( *iter ) ) { 194 if ( nm->get_name() == "0" || nm->get_name() == "1" ) { 195 // except if name is 0 or 1... 196 output << "["; 197 nm->accept( *this ); 198 output << "]"; 199 } else { 200 output << "."; 201 nm->accept( *this ); 202 } 203 } else if ( dynamic_cast< ConstantExpr * >( *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 204 198 output << "["; 205 199 (*iter)->accept( *this ); 206 200 output << "]"; 207 } else {208 assert(0);209 201 } 210 202 }
Note: See TracChangeset
for help on using the changeset viewer.