Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r35b1bf4 rc0aa336  
    8989        }
    9090
    91         CodeGenerator::CodeGenerator( std::ostream & os, bool pretty ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ), pretty( pretty ) {}
     91        CodeGenerator::CodeGenerator( std::ostream & os, bool mangle ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ), mangle( mangle ) {}
    9292
    9393        CodeGenerator::CodeGenerator( std::ostream & os, std::string init, int indentation, bool infunp )
     
    102102
    103103        string CodeGenerator::mangleName( DeclarationWithType * decl ) {
    104                 if ( pretty ) return decl->get_name();
     104                if ( ! mangle ) return decl->get_name();
    105105                if ( decl->get_mangleName() != "" ) {
    106106                        // need to incorporate scope level in order to differentiate names for destructors
     
    140140                        output << "_Noreturn ";
    141141                } // if
    142                 output << genType( functionDecl->get_functionType(), mangleName( functionDecl ), pretty );
     142                output << genType( functionDecl->get_functionType(), mangleName( functionDecl ) );
    143143
    144144                // how to get this to the Functype?
     
    161161
    162162                handleStorageClass( objectDecl );
    163                 output << genType( objectDecl->get_type(), mangleName( objectDecl ), pretty );
     163                output << genType( objectDecl->get_type(), mangleName( objectDecl ) );
    164164
    165165                asmName( objectDecl );
     
    178178        void CodeGenerator::handleAggregate( AggregateDecl * aggDecl ) {
    179179                genAttributes( aggDecl->get_attributes() );
    180 
     180               
    181181                if ( aggDecl->get_name() != "" )
    182182                        output << aggDecl->get_name();
     
    249249                assert( false && "Typedefs are removed and substituted in earlier passes." );
    250250                //output << "typedef ";
    251                 //output << genType( typeDecl->get_base(), typeDecl->get_name(), pretty );
     251                //output << genType( typeDecl->get_base(), typeDecl->get_name() );
    252252        }
    253253
     
    258258                output << "extern unsigned long " << typeDecl->get_name();
    259259                if ( typeDecl->get_base() ) {
    260                         output << " = sizeof( " << genType( typeDecl->get_base(), "", pretty ) << " )";
     260                        output << " = sizeof( " << genType( typeDecl->get_base(), "" ) << " )";
    261261                } // if
    262262        }
     
    552552                        // at least one result type of cast, but not an lvalue
    553553                        output << "(";
    554                         output << genType( castExpr->get_result(), "", pretty );
     554                        output << genType( castExpr->get_result(), "" );
    555555                        output << ")";
    556556                } else {
     
    592592                output << "sizeof(";
    593593                if ( sizeofExpr->get_isType() ) {
    594                         output << genType( sizeofExpr->get_type(), "", pretty );
     594                        output << genType( sizeofExpr->get_type(), "" );
    595595                } else {
    596596                        sizeofExpr->get_expr()->accept( *this );
     
    604604                output << "__alignof__(";
    605605                if ( alignofExpr->get_isType() ) {
    606                         output << genType( alignofExpr->get_type(), "", pretty );
     606                        output << genType( alignofExpr->get_type(), "" );
    607607                } else {
    608608                        alignofExpr->get_expr()->accept( *this );
     
    618618                // use GCC builtin
    619619                output << "__builtin_offsetof(";
    620                 output << genType( offsetofExpr->get_type(), "", pretty );
     620                output << genType( offsetofExpr->get_type(), "" );
    621621                output << ", " << mangleName( offsetofExpr->get_member() );
    622622                output << ")";
     
    680680        void CodeGenerator::visit( CompoundLiteralExpr *compLitExpr ) {
    681681                assert( compLitExpr->get_type() && dynamic_cast< ListInit * > ( compLitExpr->get_initializer() ) );
    682                 output << "(" << genType( compLitExpr->get_type(), "", pretty ) << ")";
     682                output << "(" << genType( compLitExpr->get_type(), "" ) << ")";
    683683                compLitExpr->get_initializer()->accept( *this );
    684684        }
Note: See TracChangeset for help on using the changeset viewer.