Changes in src/SynTree/Expression.cc [9a705dc8:42107b4]
- File:
-
- 1 edited
-
src/SynTree/Expression.cc (modified) (26 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r9a705dc8 r42107b4 52 52 Expression::~Expression() { 53 53 delete env; 54 delete result;55 54 } 56 55 … … 74 73 ConstantExpr::ConstantExpr( const ConstantExpr &other) : Expression( other ), constant( other.constant ) { 75 74 } 76 77 ConstantExpr::~ConstantExpr() {}78 75 79 76 void ConstantExpr::print( std::ostream &os, Indenter indent ) const { … … 120 117 } 121 118 122 VariableExpr::~VariableExpr() {123 // don't delete the declaration, since it points somewhere else in the tree124 }125 126 119 VariableExpr * VariableExpr::functionPointer( FunctionDecl * func ) { 127 120 VariableExpr * funcExpr = new VariableExpr( func ); … … 150 143 } 151 144 152 SizeofExpr::~SizeofExpr() {153 delete expr;154 delete type;155 }156 157 145 void SizeofExpr::print( std::ostream &os, Indenter indent) const { 158 146 os << "Sizeof Expression on: "; … … 176 164 } 177 165 178 AlignofExpr::~AlignofExpr() {179 delete expr;180 delete type;181 }182 183 166 void AlignofExpr::print( std::ostream &os, Indenter indent) const { 184 167 os << "Alignof Expression on: "; … … 196 179 UntypedOffsetofExpr::UntypedOffsetofExpr( const UntypedOffsetofExpr &other ) : 197 180 Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {} 198 199 UntypedOffsetofExpr::~UntypedOffsetofExpr() {200 delete type;201 }202 181 203 182 void UntypedOffsetofExpr::print( std::ostream &os, Indenter indent) const { … … 217 196 Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {} 218 197 219 OffsetofExpr::~OffsetofExpr() {220 delete type;221 }222 223 198 void OffsetofExpr::print( std::ostream &os, Indenter indent) const { 224 199 os << "Offsetof Expression on member " << member->name << " of "; … … 234 209 OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {} 235 210 236 OffsetPackExpr::~OffsetPackExpr() { delete type; }237 238 211 void OffsetPackExpr::print( std::ostream &os, Indenter indent ) const { 239 212 os << "Offset pack expression on "; … … 252 225 AttrExpr::AttrExpr( const AttrExpr &other ) : 253 226 Expression( other ), attr( maybeClone( other.attr ) ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType ) { 254 }255 256 AttrExpr::~AttrExpr() {257 delete attr;258 delete expr;259 delete type;260 227 } 261 228 … … 280 247 281 248 CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) { 282 }283 284 CastExpr::~CastExpr() {285 delete arg;286 249 } 287 250 … … 305 268 } 306 269 307 KeywordCastExpr::~KeywordCastExpr() {308 delete arg;309 }310 311 270 const std::string & KeywordCastExpr::targetString() const { 312 271 static const std::string targetStrs[] = { … … 333 292 334 293 VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) { 335 }336 337 VirtualCastExpr::~VirtualCastExpr() {338 delete arg;339 294 } 340 295 … … 361 316 } 362 317 363 UntypedMemberExpr::~UntypedMemberExpr() {364 delete aggregate;365 delete member;366 }367 368 318 void UntypedMemberExpr::print( std::ostream &os, Indenter indent ) const { 369 319 os << "Untyped Member Expression, with field: " << std::endl << indent+1; … … 392 342 } 393 343 394 MemberExpr::~MemberExpr() {395 // don't delete the member declaration, since it points somewhere else in the tree396 delete aggregate;397 }398 399 344 void MemberExpr::print( std::ostream &os, Indenter indent ) const { 400 345 os << "Member Expression, with field: " << std::endl; … … 412 357 Expression( other ), function( maybeClone( other.function ) ) { 413 358 cloneAll( other.args, args ); 414 }415 416 UntypedExpr::~UntypedExpr() {417 delete function;418 deleteAll( args );419 359 } 420 360 … … 465 405 } 466 406 467 NameExpr::~NameExpr() {}468 469 407 void NameExpr::print( std::ostream &os, Indenter indent ) const { 470 408 os << "Name: " << get_name(); … … 479 417 LogicalExpr::LogicalExpr( const LogicalExpr &other ) : 480 418 Expression( other ), arg1( maybeClone( other.arg1 ) ), arg2( maybeClone( other.arg2 ) ), isAnd( other.isAnd ) { 481 }482 483 LogicalExpr::~LogicalExpr() {484 delete arg1;485 delete arg2;486 419 } 487 420 … … 499 432 ConditionalExpr::ConditionalExpr( const ConditionalExpr &other ) : 500 433 Expression( other ), arg1( maybeClone( other.arg1 ) ), arg2( maybeClone( other.arg2 ) ), arg3( maybeClone( other.arg3 ) ) { 501 }502 503 ConditionalExpr::~ConditionalExpr() {504 delete arg1;505 delete arg2;506 delete arg3;507 434 } 508 435 … … 542 469 ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() { 543 470 set_env( nullptr ); // ImplicitCopyCtorExpr does not take ownership of an environment 544 delete callExpr;545 deleteAll( tempDecls );546 deleteAll( returnDecls );547 deleteAll( dtors );548 471 } 549 472 … … 570 493 } 571 494 572 ConstructorExpr::~ConstructorExpr() {573 delete callExpr;574 }575 576 495 void ConstructorExpr::print( std::ostream &os, Indenter indent ) const { 577 496 os << "Constructor Expression: " << std::endl << indent+1; … … 588 507 589 508 CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), initializer( other.initializer->clone() ) {} 590 591 CompoundLiteralExpr::~CompoundLiteralExpr() {592 delete initializer;593 }594 509 595 510 void CompoundLiteralExpr::print( std::ostream &os, Indenter indent ) const { … … 618 533 cloneAll( other.dtors, dtors ); 619 534 } 620 StmtExpr::~StmtExpr() {621 delete statements;622 deleteAll( dtors );623 deleteAll( returnDecls );624 }625 535 void StmtExpr::computeResult() { 626 536 assert( statements ); 627 537 std::list< Statement * > & body = statements->kids; 628 delete result;629 538 result = nullptr; 630 539 if ( ! returnDecls.empty() ) { … … 669 578 UniqueExpr::UniqueExpr( const UniqueExpr &other ) : Expression( other ), expr( maybeClone( other.expr ) ), object( maybeClone( other.object ) ), var( maybeClone( other.var ) ), id( other.id ) { 670 579 } 671 UniqueExpr::~UniqueExpr() { 672 delete expr; 673 delete object; 674 delete var; 675 } 580 676 581 void UniqueExpr::print( std::ostream &os, Indenter indent ) const { 677 582 os << "Unique Expression with id:" << id << std::endl << indent+1; … … 686 591 InitAlternative::InitAlternative( Type * type, Designation * designation ) : type( type ), designation( designation ) {} 687 592 InitAlternative::InitAlternative( const InitAlternative & other ) : type( maybeClone( other.type ) ), designation( maybeClone( other.designation ) ) {} 688 InitAlternative::~InitAlternative() {689 delete type;690 delete designation;691 }692 593 693 594 UntypedInitExpr::UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts ) : expr( expr ), initAlts( initAlts ) {} 694 595 UntypedInitExpr::UntypedInitExpr( const UntypedInitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), initAlts( other.initAlts ) {} 695 UntypedInitExpr::~UntypedInitExpr() {696 delete expr;697 }698 596 699 597 void UntypedInitExpr::print( std::ostream & os, Indenter indent ) const { … … 713 611 } 714 612 InitExpr::InitExpr( const InitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), designation( maybeClone( other.designation) ) {} 715 InitExpr::~InitExpr() {716 delete expr;717 delete designation;718 }719 613 720 614 void InitExpr::print( std::ostream & os, Indenter indent ) const { … … 730 624 } 731 625 DeletedExpr::DeletedExpr( const DeletedExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), deleteStmt( other.deleteStmt ) {} 732 DeletedExpr::~DeletedExpr() {733 delete expr;734 }735 626 736 627 void DeletedExpr::print( std::ostream & os, Indenter indent ) const {
Note:
See TracChangeset
for help on using the changeset viewer.