Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r3c13c03 r486341f  
    309309                                                        UntypedExpr * newExpr = new UntypedExpr( new NameExpr( "*?" ) );
    310310                                                        newExpr->get_args().push_back( *arg );
    311                                                         Type * type = InitTweak::getPointerBase( (*arg)->get_result() );
     311                                                        assert( (*arg)->get_results().size() == 1 );
     312                                                        Type * type = InitTweak::getPointerBase( (*arg)->get_results().front() );
    312313                                                        assert( type );
    313                                                         newExpr->set_result( type->clone() );
     314                                                        newExpr->get_results().push_back( type->clone() );
    314315                                                        *arg = newExpr;
    315316                                                } // if
     
    526527                extension( castExpr );
    527528                output << "(";
    528                 if ( castExpr->get_result()->isVoid() ) {
     529                if ( castExpr->get_results().empty() ) {
    529530                        output << "(void)" ;
    530                 } else if ( ! castExpr->get_result()->get_isLvalue() ) {
     531                } else if ( ! castExpr->get_results().front()->get_isLvalue() ) {
    531532                        // at least one result type of cast, but not an lvalue
    532533                        output << "(";
    533                         output << genType( castExpr->get_result(), "" );
     534                        output << genType( castExpr->get_results().front(), "" );
    534535                        output << ")";
    535536                } else {
     
    639640        }
    640641
    641         void CodeGenerator::visit( TupleExpr * tupleExpr ) { assert( false ); }
     642        void CodeGenerator::visit( TupleExpr * tupleExpr ) {}
    642643
    643644        void CodeGenerator::visit( TypeExpr * typeExpr ) {}
     
    653654                asmExpr->get_operand()->accept( *this );
    654655                output << " )";
    655         }
    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 
    663         void CodeGenerator::visit( StmtExpr * stmtExpr ) {
    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 << "})";
    690656        }
    691657
Note: See TracChangeset for help on using the changeset viewer.