Changeset 3c13c03 for src/CodeGen
- Timestamp:
- Sep 17, 2016, 8:27:51 AM (9 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:
- 8c49c0e
- Parents:
- 12bc63a
- Location:
- src/CodeGen
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/CodeGen/CodeGenerator.cc ¶
r12bc63a r3c13c03 639 639 } 640 640 641 void CodeGenerator::visit( TupleExpr * tupleExpr ) { }641 void CodeGenerator::visit( TupleExpr * tupleExpr ) { assert( false ); } 642 642 643 643 void CodeGenerator::visit( TypeExpr * typeExpr ) {} … … 655 655 } 656 656 657 void CodeGenerator::visit( CompoundLiteralExpr *compLitExpr ) { 658 assert( compLitExpr->get_type() && dynamic_cast< ListInit * > ( compLitExpr->get_initializer() ) ); 659 output << "(" << genType( compLitExpr->get_type(), "" ) << ")"; 660 compLitExpr->get_initializer()->accept( *this ); 661 } 662 657 663 void CodeGenerator::visit( StmtExpr * stmtExpr ) { 658 output << "("; 659 stmtExpr->get_statements()->accept( *this ); 660 output << ")"; 664 std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids(); 665 output << "({" << std::endl; 666 cur_indent += CodeGenerator::tabsize; 667 unsigned int numStmts = stmts.size(); 668 unsigned int i = 0; 669 for ( Statement * stmt : stmts ) { 670 output << indent << printLabels( stmt->get_labels() ); 671 if ( i+1 == numStmts ) { 672 // last statement in a statement expression needs to be handled specially - 673 // cannot cast to void, otherwise the expression statement has no value 674 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( stmt ) ) { 675 exprStmt->get_expr()->accept( *this ); 676 output << ";" << endl; 677 ++i; 678 break; 679 } 680 } 681 stmt->accept( *this ); 682 output << endl; 683 if ( wantSpacing( stmt ) ) { 684 output << endl; 685 } // if 686 ++i; 687 } 688 cur_indent -= CodeGenerator::tabsize; 689 output << indent << "})"; 661 690 } 662 691 -
TabularUnified src/CodeGen/CodeGenerator.h ¶
r12bc63a r3c13c03 70 70 virtual void visit( ConditionalExpr *conditionalExpr ); 71 71 virtual void visit( CommaExpr *commaExpr ); 72 virtual void visit( CompoundLiteralExpr *compLitExpr ); 72 73 virtual void visit( TupleExpr *tupleExpr ); 73 74 virtual void visit( TypeExpr *typeExpr ); -
TabularUnified src/CodeGen/GenType.cc ¶
r12bc63a r3c13c03 213 213 typeString = "_Atomic " + typeString; 214 214 } // if 215 if ( type->get_isAttribute() ) {216 typeString = "__attribute(( )) " + typeString;217 } // if218 215 } 219 216 } // namespace CodeGen
Note: See TracChangeset
for help on using the changeset viewer.