Changes in src/SynTree/Expression.cc [d67cdb7:bf4b4cf]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
rd67cdb7 rbf4b4cf 33 33 #include "GenPoly/Lvalue.h" 34 34 35 Expression::Expression( Expression *_aname ) : result( 0 ), env( 0 ), argName( _aname) {}36 37 Expression::Expression( const Expression &other ) : BaseSyntaxNode( other ), result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ),extension( other.extension ) {35 Expression::Expression() : result( 0 ), env( 0 ) {} 36 37 Expression::Expression( const Expression &other ) : BaseSyntaxNode( other ), result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), extension( other.extension ) { 38 38 } 39 39 40 40 Expression::~Expression() { 41 41 delete env; 42 delete argName; // xxx -- there's a problem in cloning ConstantExpr I still don't know how to fix43 42 delete result; 44 43 } 45 44 46 void Expression::print( std::ostream &os, intindent ) const {45 void Expression::print( std::ostream &os, Indenter indent ) const { 47 46 if ( env ) { 48 os << std:: string( indent, ' ' ) << "with environment:" << std::endl;49 env->print( os, indent+ 2);47 os << std::endl << indent << "... with environment:" << std::endl; 48 env->print( os, indent+1 ); 50 49 } // if 51 50 52 if ( argName ) { 53 os << std::string( indent, ' ' ) << "with designator:"; 54 argName->print( os, indent+2 ); 51 if ( extension ) { 52 os << std::endl << indent << "... with extension:"; 55 53 } // if 56 57 if ( extension ) { 58 os << std::string( indent, ' ' ) << "with extension:"; 59 } // if 60 } 61 62 ConstantExpr::ConstantExpr( Constant _c, Expression *_aname ) : Expression( _aname ), constant( _c ) { 54 } 55 56 ConstantExpr::ConstantExpr( Constant _c ) : Expression(), constant( _c ) { 63 57 set_result( constant.get_type()->clone() ); 64 58 } … … 69 63 ConstantExpr::~ConstantExpr() {} 70 64 71 void ConstantExpr::print( std::ostream &os, intindent ) const {65 void ConstantExpr::print( std::ostream &os, Indenter indent ) const { 72 66 os << "constant expression " ; 73 67 constant.print( os ); … … 75 69 } 76 70 77 VariableExpr::VariableExpr( DeclarationWithType *_var , Expression *_aname ) : Expression( _aname), var( _var ) {71 VariableExpr::VariableExpr( DeclarationWithType *_var ) : Expression(), var( _var ) { 78 72 assert( var ); 79 73 assert( var->get_type() ); … … 96 90 } 97 91 98 void VariableExpr::print( std::ostream &os, intindent ) const {92 void VariableExpr::print( std::ostream &os, Indenter indent ) const { 99 93 os << "Variable Expression: "; 100 101 Declaration *decl = get_var(); 102 if ( decl != 0) decl->printShort(os, indent + 2); 103 os << std::endl; 104 Expression::print( os, indent ); 105 } 106 107 SizeofExpr::SizeofExpr( Expression *expr_, Expression *_aname ) : 108 Expression( _aname ), expr(expr_), type(0), isType(false) { 94 var->printShort(os, indent); 95 Expression::print( os, indent ); 96 } 97 98 SizeofExpr::SizeofExpr( Expression *expr_ ) : 99 Expression(), expr(expr_), type(0), isType(false) { 109 100 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 110 101 } 111 102 112 SizeofExpr::SizeofExpr( Type *type_ , Expression *_aname) :113 Expression( _aname), expr(0), type(type_), isType(true) {103 SizeofExpr::SizeofExpr( Type *type_ ) : 104 Expression(), expr(0), type(type_), isType(true) { 114 105 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 115 106 } … … 124 115 } 125 116 126 void SizeofExpr::print( std::ostream &os, intindent) const {117 void SizeofExpr::print( std::ostream &os, Indenter indent) const { 127 118 os << "Sizeof Expression on: "; 128 129 if (isType) 130 type->print(os, indent + 2); 131 else 132 expr->print(os, indent + 2); 133 134 os << std::endl; 135 Expression::print( os, indent ); 136 } 137 138 AlignofExpr::AlignofExpr( Expression *expr_, Expression *_aname ) : 139 Expression( _aname ), expr(expr_), type(0), isType(false) { 119 if (isType) type->print(os, indent+1); 120 else expr->print(os, indent+1); 121 Expression::print( os, indent ); 122 } 123 124 AlignofExpr::AlignofExpr( Expression *expr_ ) : 125 Expression(), expr(expr_), type(0), isType(false) { 140 126 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 141 127 } 142 128 143 AlignofExpr::AlignofExpr( Type *type_ , Expression *_aname) :144 Expression( _aname), expr(0), type(type_), isType(true) {129 AlignofExpr::AlignofExpr( Type *type_ ) : 130 Expression(), expr(0), type(type_), isType(true) { 145 131 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 146 132 } … … 155 141 } 156 142 157 void AlignofExpr::print( std::ostream &os, intindent) const {143 void AlignofExpr::print( std::ostream &os, Indenter indent) const { 158 144 os << "Alignof Expression on: "; 159 160 if (isType) 161 type->print(os, indent + 2); 162 else 163 expr->print(os, indent + 2); 164 165 os << std::endl; 166 Expression::print( os, indent ); 167 } 168 169 UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type_, const std::string &member_, Expression *_aname ) : 170 Expression( _aname ), type(type_), member(member_) { 145 if (isType) type->print(os, indent+1); 146 else expr->print(os, indent+1); 147 Expression::print( os, indent ); 148 } 149 150 UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type, const std::string &member ) : 151 Expression(), type(type), member(member) { 152 assert( type ); 171 153 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 172 154 } … … 179 161 } 180 162 181 void UntypedOffsetofExpr::print( std::ostream &os, int indent) const { 182 os << std::string( indent, ' ' ) << "Untyped Offsetof Expression on member " << member << " of "; 183 184 if ( type ) { 185 type->print(os, indent + 2); 186 } else { 187 os << "<NULL>"; 188 } 189 190 os << std::endl; 191 Expression::print( os, indent ); 192 } 193 194 OffsetofExpr::OffsetofExpr( Type *type_, DeclarationWithType *member_, Expression *_aname ) : 195 Expression( _aname ), type(type_), member(member_) { 163 void UntypedOffsetofExpr::print( std::ostream &os, Indenter indent) const { 164 os << "Untyped Offsetof Expression on member " << member << " of "; 165 type->print(os, indent+1); 166 Expression::print( os, indent ); 167 } 168 169 OffsetofExpr::OffsetofExpr( Type *type, DeclarationWithType *member ) : 170 Expression(), type(type), member(member) { 171 assert( member ); 172 assert( type ); 196 173 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 197 174 } … … 204 181 } 205 182 206 void OffsetofExpr::print( std::ostream &os, int indent) const { 207 os << std::string( indent, ' ' ) << "Offsetof Expression on member "; 208 209 if ( member ) { 210 os << member->get_name(); 211 } else { 212 os << "<NULL>"; 213 } 214 215 os << " of "; 216 217 if ( type ) { 218 type->print(os, indent + 2); 219 } else { 220 os << "<NULL>"; 221 } 222 223 os << std::endl; 224 Expression::print( os, indent ); 225 } 226 227 OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) { 183 void OffsetofExpr::print( std::ostream &os, Indenter indent) const { 184 os << "Offsetof Expression on member " << member->name << " of "; 185 type->print(os, indent+1); 186 Expression::print( os, indent ); 187 } 188 189 OffsetPackExpr::OffsetPackExpr( StructInstType *type ) : Expression(), type( type ) { 190 assert( type ); 228 191 set_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) ); 229 192 } … … 233 196 OffsetPackExpr::~OffsetPackExpr() { delete type; } 234 197 235 void OffsetPackExpr::print( std::ostream &os, int indent ) const { 236 os << std::string( indent, ' ' ) << "Offset pack expression on "; 237 238 if ( type ) { 239 type->print(os, indent + 2); 240 } else { 241 os << "<NULL>"; 242 } 243 244 os << std::endl; 245 Expression::print( os, indent ); 246 } 247 248 AttrExpr::AttrExpr( Expression *attr, Expression *expr_, Expression *_aname ) : 249 Expression( _aname ), attr( attr ), expr(expr_), type(0), isType(false) { 250 } 251 252 AttrExpr::AttrExpr( Expression *attr, Type *type_, Expression *_aname ) : 253 Expression( _aname ), attr( attr ), expr(0), type(type_), isType(true) { 198 void OffsetPackExpr::print( std::ostream &os, Indenter indent ) const { 199 os << "Offset pack expression on "; 200 type->print(os, indent+1); 201 Expression::print( os, indent ); 202 } 203 204 AttrExpr::AttrExpr( Expression *attr, Expression *expr_ ) : 205 Expression(), attr( attr ), expr(expr_), type(0), isType(false) { 206 } 207 208 AttrExpr::AttrExpr( Expression *attr, Type *type_ ) : 209 Expression(), attr( attr ), expr(0), type(type_), isType(true) { 254 210 } 255 211 … … 264 220 } 265 221 266 void AttrExpr::print( std::ostream &os, intindent) const {222 void AttrExpr::print( std::ostream &os, Indenter indent) const { 267 223 os << "Attr "; 268 attr->print( os, indent + 2);224 attr->print( os, indent+1); 269 225 if ( isType || expr ) { 270 226 os << "applied to: "; 271 272 if (isType) 273 type->print(os, indent + 2); 274 else 275 expr->print(os, indent + 2); 227 if (isType) type->print(os, indent+1); 228 else expr->print(os, indent+1); 276 229 } // if 277 278 os << std::endl; 279 Expression::print( os, indent ); 280 } 281 282 CastExpr::CastExpr( Expression *arg_, Type *toType, Expression *_aname ) : Expression( _aname ), arg(arg_) { 230 Expression::print( os, indent ); 231 } 232 233 CastExpr::CastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) { 283 234 set_result(toType); 284 235 } 285 236 286 CastExpr::CastExpr( Expression *arg_ , Expression *_aname ) : Expression( _aname), arg(arg_) {237 CastExpr::CastExpr( Expression *arg_ ) : Expression(), arg(arg_) { 287 238 set_result( new VoidType( Type::Qualifiers() ) ); 288 239 } … … 295 246 } 296 247 297 void CastExpr::print( std::ostream &os, int indent ) const { 298 os << "Cast of:" << std::endl << std::string( indent+2, ' ' ); 299 arg->print(os, indent+2); 300 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; 301 os << std::string( indent+2, ' ' ); 248 void CastExpr::print( std::ostream &os, Indenter indent ) const { 249 os << "Cast of:" << std::endl << indent+1; 250 arg->print(os, indent+1); 251 os << std::endl << indent << "... to:"; 302 252 if ( result->isVoid() ) { 303 os << " nothing";253 os << " nothing"; 304 254 } else { 305 result->print( os, indent+2 ); 255 os << std::endl << indent+1; 256 result->print( os, indent+1 ); 306 257 } // if 307 os << std::endl;308 258 Expression::print( os, indent ); 309 259 } … … 320 270 } 321 271 322 void VirtualCastExpr::print( std::ostream &os, int indent ) const { 323 os << "Virtual Cast of:" << std::endl << std::string( indent+2, ' ' ); 324 arg->print(os, indent+2); 325 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; 326 os << std::string( indent+2, ' ' ); 272 void VirtualCastExpr::print( std::ostream &os, Indenter indent ) const { 273 os << "Virtual Cast of:" << std::endl << indent+1; 274 arg->print(os, indent+1); 275 os << std::endl << indent << "... to:"; 327 276 if ( ! result ) { 328 os << " unknown";277 os << " unknown"; 329 278 } else { 330 result->print( os, indent+2 ); 279 os << std::endl << indent+1; 280 result->print( os, indent+1 ); 331 281 } // if 332 os << std::endl; 333 Expression::print( os, indent ); 334 } 335 336 UntypedMemberExpr::UntypedMemberExpr( Expression * _member, Expression *_aggregate, Expression *_aname ) : 337 Expression( _aname ), member(_member), aggregate(_aggregate) {} 282 Expression::print( os, indent ); 283 } 284 285 UntypedMemberExpr::UntypedMemberExpr( Expression * member, Expression *aggregate ) : 286 Expression(), member(member), aggregate(aggregate) { 287 assert( aggregate ); 288 } 338 289 339 290 UntypedMemberExpr::UntypedMemberExpr( const UntypedMemberExpr &other ) : … … 346 297 } 347 298 348 void UntypedMemberExpr::print( std::ostream &os, int indent ) const { 349 os << "Untyped Member Expression, with field: " << std::endl; 350 os << std::string( indent+2, ' ' ); 351 get_member()->print(os, indent+4); 352 os << std::string( indent+2, ' ' ); 353 354 Expression *agg = get_aggregate(); 355 os << "from aggregate: " << std::endl; 356 if (agg != 0) { 357 os << std::string( indent + 4, ' ' ); 358 agg->print(os, indent + 4); 359 } 360 os << std::string( indent+2, ' ' ); 299 void UntypedMemberExpr::print( std::ostream &os, Indenter indent ) const { 300 os << "Untyped Member Expression, with field: " << std::endl << indent+1; 301 member->print(os, indent+1 ); 302 os << indent << "... from aggregate: " << std::endl << indent+1; 303 aggregate->print(os, indent+1); 361 304 Expression::print( os, indent ); 362 305 } … … 377 320 378 321 379 MemberExpr::MemberExpr( DeclarationWithType *_member, Expression *_aggregate, Expression *_aname ) : 380 Expression( _aname ), member(_member), aggregate(_aggregate) { 322 MemberExpr::MemberExpr( DeclarationWithType *member, Expression *aggregate ) : 323 Expression(), member(member), aggregate(aggregate) { 324 assert( member ); 325 assert( aggregate ); 381 326 382 327 TypeSubstitution sub( makeSub( aggregate->get_result() ) ); … … 396 341 } 397 342 398 void MemberExpr::print( std::ostream &os, intindent ) const {343 void MemberExpr::print( std::ostream &os, Indenter indent ) const { 399 344 os << "Member Expression, with field: " << std::endl; 400 401 assert( member ); 402 os << std::string( indent + 2, ' ' ); 403 member->print( os, indent + 2 ); 404 os << std::endl; 405 406 Expression *agg = get_aggregate(); 407 os << std::string( indent, ' ' ) << "from aggregate: " << std::endl; 408 if (agg != 0) { 409 os << std::string( indent + 2, ' ' ); 410 agg->print(os, indent + 2); 411 } 412 os << std::string( indent+2, ' ' ); 413 Expression::print( os, indent ); 414 } 415 416 UntypedExpr::UntypedExpr( Expression *_function, const std::list<Expression *> &_args, Expression *_aname ) : 417 Expression( _aname ), function(_function), args(_args) {} 345 os << indent+1; 346 member->print( os, indent+1 ); 347 os << std::endl << indent << "... from aggregate: " << std::endl << indent+1; 348 aggregate->print(os, indent + 1); 349 Expression::print( os, indent ); 350 } 351 352 UntypedExpr::UntypedExpr( Expression *function, const std::list<Expression *> &args ) : 353 Expression(), function(function), args(args) {} 418 354 419 355 UntypedExpr::UntypedExpr( const UntypedExpr &other ) : … … 456 392 457 393 458 void UntypedExpr::print( std::ostream &os, intindent ) const {394 void UntypedExpr::print( std::ostream &os, Indenter indent ) const { 459 395 os << "Applying untyped: " << std::endl; 460 os << std::string( indent+2, ' ' ); 461 function->print(os, indent + 2); 462 os << std::string( indent, ' ' ) << "...to: " << std::endl; 463 printAll(args, os, indent + 2); 464 Expression::print( os, indent ); 465 } 466 467 void UntypedExpr::printArgs( std::ostream &os, int indent ) const { 468 std::list<Expression *>::const_iterator i; 469 for (i = args.begin(); i != args.end(); i++) { 470 os << std::string(indent, ' ' ); 471 (*i)->print(os, indent); 472 } 473 } 474 475 NameExpr::NameExpr( std::string _name, Expression *_aname ) : Expression( _aname ), name(_name) { 476 assertf(_name != "0", "Zero is not a valid name\n"); 477 assertf(_name != "1", "One is not a valid name\n"); 396 os << indent+1; 397 function->print(os, indent+1); 398 os << std::endl << indent << "...to: " << std::endl; 399 printAll(args, os, indent+1); 400 Expression::print( os, indent ); 401 } 402 403 NameExpr::NameExpr( std::string name ) : Expression(), name(name) { 404 assertf(name != "0", "Zero is not a valid name"); 405 assertf(name != "1", "One is not a valid name"); 478 406 } 479 407 … … 483 411 NameExpr::~NameExpr() {} 484 412 485 void NameExpr::print( std::ostream &os, intindent ) const {486 os << "Name: " << get_name() << std::endl;487 Expression::print( os, indent ); 488 } 489 490 LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp , Expression *_aname) :491 Expression( _aname), arg1(arg1_), arg2(arg2_), isAnd(andp) {413 void NameExpr::print( std::ostream &os, Indenter indent ) const { 414 os << "Name: " << get_name(); 415 Expression::print( os, indent ); 416 } 417 418 LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp ) : 419 Expression(), arg1(arg1_), arg2(arg2_), isAnd(andp) { 492 420 set_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ); 493 421 } … … 502 430 } 503 431 504 void LogicalExpr::print( std::ostream &os, intindent )const {505 os << "Short-circuited operation (" << (isAnd ?"and":"or") << ") on: ";432 void LogicalExpr::print( std::ostream &os, Indenter indent )const { 433 os << "Short-circuited operation (" << (isAnd ? "and" : "or") << ") on: "; 506 434 arg1->print(os); 507 435 os << " and "; 508 436 arg2->print(os); 509 os << std::endl; 510 Expression::print( os, indent ); 511 } 512 513 ConditionalExpr::ConditionalExpr( Expression *arg1_, Expression *arg2_, Expression *arg3_, Expression *_aname ) : 514 Expression( _aname ), arg1(arg1_), arg2(arg2_), arg3(arg3_) {} 437 Expression::print( os, indent ); 438 } 439 440 ConditionalExpr::ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3 ) : 441 Expression(), arg1(arg1), arg2(arg2), arg3(arg3) {} 515 442 516 443 ConditionalExpr::ConditionalExpr( const ConditionalExpr &other ) : … … 524 451 } 525 452 526 void ConditionalExpr::print( std::ostream &os, int indent ) const { 527 os << "Conditional expression on: " << std::endl; 528 os << std::string( indent+2, ' ' ); 529 arg1->print( os, indent+2 ); 530 os << std::string( indent, ' ' ) << "First alternative:" << std::endl; 531 os << std::string( indent+2, ' ' ); 532 arg2->print( os, indent+2 ); 533 os << std::string( indent, ' ' ) << "Second alternative:" << std::endl; 534 os << std::string( indent+2, ' ' ); 535 arg3->print( os, indent+2 ); 536 os << std::endl; 453 void ConditionalExpr::print( std::ostream &os, Indenter indent ) const { 454 os << "Conditional expression on: " << std::endl << indent+1; 455 arg1->print( os, indent+1 ); 456 os << indent << "First alternative:" << std::endl << indent+1; 457 arg2->print( os, indent+1 ); 458 os << indent << "Second alternative:" << std::endl << indent+1; 459 arg3->print( os, indent+1 ); 537 460 Expression::print( os, indent ); 538 461 } … … 541 464 542 465 543 void AsmExpr::print( std::ostream &os, intindent ) const {466 void AsmExpr::print( std::ostream &os, Indenter indent ) const { 544 467 os << "Asm Expression: " << std::endl; 545 if ( inout ) inout->print( os, indent + 2);546 if ( constraint ) constraint->print( os, indent + 2);547 if ( operand ) operand->print( os, indent + 2);468 if ( inout ) inout->print( os, indent+1 ); 469 if ( constraint ) constraint->print( os, indent+1 ); 470 if ( operand ) operand->print( os, indent+1 ); 548 471 } 549 472 … … 551 474 ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) { 552 475 assert( callExpr ); 553 assert( callExpr-> has_result());476 assert( callExpr->result ); 554 477 set_result( callExpr->get_result()->clone() ); 555 478 } … … 569 492 } 570 493 571 void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const { 572 os << "Implicit Copy Constructor Expression: " << std::endl; 573 assert( callExpr ); 574 os << std::string( indent+2, ' ' ); 575 callExpr->print( os, indent + 2 ); 576 os << std::endl << std::string( indent, ' ' ) << "with temporaries:" << std::endl; 577 printAll(tempDecls, os, indent+2); 578 os << std::endl << std::string( indent, ' ' ) << "with return temporaries:" << std::endl; 579 printAll(returnDecls, os, indent+2); 494 void ImplicitCopyCtorExpr::print( std::ostream &os, Indenter indent ) const { 495 os << "Implicit Copy Constructor Expression: " << std::endl << indent+1; 496 callExpr->print( os, indent+1 ); 497 os << std::endl << indent << "... with temporaries:" << std::endl; 498 printAll( tempDecls, os, indent+1 ); 499 os << std::endl << indent << "... with return temporaries:" << std::endl; 500 printAll( returnDecls, os, indent+1 ); 580 501 Expression::print( os, indent ); 581 502 } … … 587 508 Expression * arg = InitTweak::getCallArg( callExpr, 0 ); 588 509 assert( arg ); 589 set_result( maybeClone( arg-> get_result()) );510 set_result( maybeClone( arg->result ) ); 590 511 } 591 512 … … 597 518 } 598 519 599 void ConstructorExpr::print( std::ostream &os, int indent ) const { 600 os << "Constructor Expression: " << std::endl; 601 assert( callExpr ); 602 os << std::string( indent+2, ' ' ); 520 void ConstructorExpr::print( std::ostream &os, Indenter indent ) const { 521 os << "Constructor Expression: " << std::endl << indent+1; 603 522 callExpr->print( os, indent + 2 ); 604 523 Expression::print( os, indent ); … … 618 537 } 619 538 620 void CompoundLiteralExpr::print( std::ostream &os, int indent ) const { 621 os << "Compound Literal Expression: " << std::endl; 622 os << std::string( indent+2, ' ' ); 623 get_result()->print( os, indent + 2 ); 624 os << std::string( indent+2, ' ' ); 625 initializer->print( os, indent + 2 ); 539 void CompoundLiteralExpr::print( std::ostream &os, Indenter indent ) const { 540 os << "Compound Literal Expression: " << std::endl << indent+1; 541 result->print( os, indent+1 ); 542 os << indent+1; 543 initializer->print( os, indent+1 ); 626 544 Expression::print( os, indent ); 627 545 } … … 629 547 RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {} 630 548 RangeExpr::RangeExpr( const RangeExpr &other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {} 631 void RangeExpr::print( std::ostream &os, intindent ) const {549 void RangeExpr::print( std::ostream &os, Indenter indent ) const { 632 550 os << "Range Expression: "; 633 551 low->print( os, indent ); … … 659 577 deleteAll( returnDecls ); 660 578 } 661 void StmtExpr::print( std::ostream &os, intindent ) const {662 os << "Statement Expression: " << std::endl << std::string( indent, ' ' );663 statements->print( os, indent+ 2);579 void StmtExpr::print( std::ostream &os, Indenter indent ) const { 580 os << "Statement Expression: " << std::endl << indent+1; 581 statements->print( os, indent+1 ); 664 582 if ( ! returnDecls.empty() ) { 665 os << std::string( indent+2, ' ' ) << "with returnDecls: ";666 printAll( returnDecls, os, indent+ 2);583 os << indent+1 << "... with returnDecls: "; 584 printAll( returnDecls, os, indent+1 ); 667 585 } 668 586 if ( ! dtors.empty() ) { 669 os << std::string( indent+2, ' ' ) << "with dtors: ";670 printAll( dtors, os, indent+ 2);587 os << indent+1 << "... with dtors: "; 588 printAll( dtors, os, indent+1 ); 671 589 } 672 590 Expression::print( os, indent ); … … 690 608 delete var; 691 609 } 692 void UniqueExpr::print( std::ostream &os, intindent ) const {693 os << "Unique Expression with id:" << id << std::endl << std::string( indent+2, ' ' );694 get_expr()->print( os, indent+2);695 if ( get_object()) {696 os << std::string( indent+2, ' ' ) << "with decl: ";697 get_object()->printShort( os, indent+ 2);610 void UniqueExpr::print( std::ostream &os, Indenter indent ) const { 611 os << "Unique Expression with id:" << id << std::endl << indent+1; 612 expr->print( os, indent+1 ); 613 if ( object ) { 614 os << indent << "... with decl: "; 615 get_object()->printShort( os, indent+1 ); 698 616 } 699 617 Expression::print( os, indent ); … … 713 631 } 714 632 715 void UntypedInitExpr::print( std::ostream & os, intindent ) const {716 os << "Untyped Init Expression" << std::endl << std::string( indent+2, ' ' );717 expr->print( os, indent+ 2);633 void UntypedInitExpr::print( std::ostream & os, Indenter indent ) const { 634 os << "Untyped Init Expression" << std::endl << indent+1; 635 expr->print( os, indent+1 ); 718 636 if ( ! initAlts.empty() ) { 719 637 for ( const InitAlternative & alt : initAlts ) { 720 os << std::string( indent+2, ' ' )<< "InitAlternative: ";721 alt.type->print( os, indent+ 2);722 alt.designation->print( os, indent+ 2);638 os << indent+1 << "InitAlternative: "; 639 alt.type->print( os, indent+1 ); 640 alt.designation->print( os, indent+1 ); 723 641 } 724 642 } … … 734 652 } 735 653 736 void InitExpr::print( std::ostream & os, intindent ) const {737 os << "Init Expression" << std::endl << std::string( indent+2, ' ' );738 expr->print( os, indent+ 2);739 os << std::string( indent+2, ' ' ) << "with designation: ";740 designation->print( os, indent+ 2);654 void InitExpr::print( std::ostream & os, Indenter indent ) const { 655 os << "Init Expression" << std::endl << indent+1; 656 expr->print( os, indent+1 ); 657 os << indent+1 << "... with designation: "; 658 designation->print( os, indent+1 ); 741 659 } 742 660
Note: See TracChangeset
for help on using the changeset viewer.