Changes in src/CodeGen/CodeGenerator.cc [c0aa336:35b1bf4]
- File:
-
- 1 edited
-
src/CodeGen/CodeGenerator.cc (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
rc0aa336 r35b1bf4 89 89 } 90 90 91 CodeGenerator::CodeGenerator( std::ostream & os, bool mangle ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ), mangle( mangle) {}91 CodeGenerator::CodeGenerator( std::ostream & os, bool pretty ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ), pretty( pretty ) {} 92 92 93 93 CodeGenerator::CodeGenerator( std::ostream & os, std::string init, int indentation, bool infunp ) … … 102 102 103 103 string CodeGenerator::mangleName( DeclarationWithType * decl ) { 104 if ( ! mangle) return decl->get_name();104 if ( pretty ) return decl->get_name(); 105 105 if ( decl->get_mangleName() != "" ) { 106 106 // need to incorporate scope level in order to differentiate names for destructors … … 140 140 output << "_Noreturn "; 141 141 } // if 142 output << genType( functionDecl->get_functionType(), mangleName( functionDecl ) );142 output << genType( functionDecl->get_functionType(), mangleName( functionDecl ), pretty ); 143 143 144 144 // how to get this to the Functype? … … 161 161 162 162 handleStorageClass( objectDecl ); 163 output << genType( objectDecl->get_type(), mangleName( objectDecl ) );163 output << genType( objectDecl->get_type(), mangleName( objectDecl ), pretty ); 164 164 165 165 asmName( objectDecl ); … … 178 178 void CodeGenerator::handleAggregate( AggregateDecl * aggDecl ) { 179 179 genAttributes( aggDecl->get_attributes() ); 180 180 181 181 if ( aggDecl->get_name() != "" ) 182 182 output << aggDecl->get_name(); … … 249 249 assert( false && "Typedefs are removed and substituted in earlier passes." ); 250 250 //output << "typedef "; 251 //output << genType( typeDecl->get_base(), typeDecl->get_name() );251 //output << genType( typeDecl->get_base(), typeDecl->get_name(), pretty ); 252 252 } 253 253 … … 258 258 output << "extern unsigned long " << typeDecl->get_name(); 259 259 if ( typeDecl->get_base() ) { 260 output << " = sizeof( " << genType( typeDecl->get_base(), "" ) << " )";260 output << " = sizeof( " << genType( typeDecl->get_base(), "", pretty ) << " )"; 261 261 } // if 262 262 } … … 552 552 // at least one result type of cast, but not an lvalue 553 553 output << "("; 554 output << genType( castExpr->get_result(), "" );554 output << genType( castExpr->get_result(), "", pretty ); 555 555 output << ")"; 556 556 } else { … … 592 592 output << "sizeof("; 593 593 if ( sizeofExpr->get_isType() ) { 594 output << genType( sizeofExpr->get_type(), "" );594 output << genType( sizeofExpr->get_type(), "", pretty ); 595 595 } else { 596 596 sizeofExpr->get_expr()->accept( *this ); … … 604 604 output << "__alignof__("; 605 605 if ( alignofExpr->get_isType() ) { 606 output << genType( alignofExpr->get_type(), "" );606 output << genType( alignofExpr->get_type(), "", pretty ); 607 607 } else { 608 608 alignofExpr->get_expr()->accept( *this ); … … 618 618 // use GCC builtin 619 619 output << "__builtin_offsetof("; 620 output << genType( offsetofExpr->get_type(), "" );620 output << genType( offsetofExpr->get_type(), "", pretty ); 621 621 output << ", " << mangleName( offsetofExpr->get_member() ); 622 622 output << ")"; … … 680 680 void CodeGenerator::visit( CompoundLiteralExpr *compLitExpr ) { 681 681 assert( compLitExpr->get_type() && dynamic_cast< ListInit * > ( compLitExpr->get_initializer() ) ); 682 output << "(" << genType( compLitExpr->get_type(), "" ) << ")";682 output << "(" << genType( compLitExpr->get_type(), "", pretty ) << ")"; 683 683 compLitExpr->get_initializer()->accept( *this ); 684 684 }
Note:
See TracChangeset
for help on using the changeset viewer.