Changeset 62423350 for src/CodeGen
- Timestamp:
- Jun 29, 2017, 5:06:24 PM (8 years ago)
- 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:
- a12d5aa
- Parents:
- bb1cd95
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
rbb1cd95 r62423350 292 292 if ( designators.size() == 0 ) return; 293 293 for ( Expression * des : designators ) { 294 if ( dynamic_cast< ConstantExpr * >( des ) ) { 295 // if expression is a ConstantExpr, then initializing array element 294 if ( dynamic_cast< NameExpr * >( des ) || dynamic_cast< VariableExpr * >( des ) ) { 295 // if expression is a NameExpr or VariableExpr, then initializing aggregate member 296 output << "."; 297 des->accept( *this ); 298 } else { 299 // otherwise, it has to be a ConstantExpr or CastExpr, initializing array eleemnt 296 300 output << "["; 297 301 des->accept( *this ); 298 302 output << "]"; 299 } else {300 // if not a ConstantExpr, it has to be a NameExpr or VariableExpr, initializing aggregate member301 output << ".";302 des->accept( *this );303 303 } // if 304 304 } // for
Note: See TracChangeset
for help on using the changeset viewer.