Changes in src/SynTree/Expression.cc [cdb990a:42107b4]
- File:
-
- 1 edited
-
src/SynTree/Expression.cc (modified) (26 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
rcdb990a r42107b4 50 50 } 51 51 52 void Expression::spliceInferParams( Expression * other ) {53 if ( ! other ) return;54 for ( auto p : other->inferParams ) {55 inferParams[p.first] = std::move( p.second );56 }57 }58 59 52 Expression::~Expression() { 60 53 delete env; 61 delete result;62 54 } 63 55 … … 81 73 ConstantExpr::ConstantExpr( const ConstantExpr &other) : Expression( other ), constant( other.constant ) { 82 74 } 83 84 ConstantExpr::~ConstantExpr() {}85 75 86 76 void ConstantExpr::print( std::ostream &os, Indenter indent ) const { … … 127 117 } 128 118 129 VariableExpr::~VariableExpr() {130 // don't delete the declaration, since it points somewhere else in the tree131 }132 133 119 VariableExpr * VariableExpr::functionPointer( FunctionDecl * func ) { 134 120 VariableExpr * funcExpr = new VariableExpr( func ); … … 157 143 } 158 144 159 SizeofExpr::~SizeofExpr() {160 delete expr;161 delete type;162 }163 164 145 void SizeofExpr::print( std::ostream &os, Indenter indent) const { 165 146 os << "Sizeof Expression on: "; … … 183 164 } 184 165 185 AlignofExpr::~AlignofExpr() {186 delete expr;187 delete type;188 }189 190 166 void AlignofExpr::print( std::ostream &os, Indenter indent) const { 191 167 os << "Alignof Expression on: "; … … 203 179 UntypedOffsetofExpr::UntypedOffsetofExpr( const UntypedOffsetofExpr &other ) : 204 180 Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {} 205 206 UntypedOffsetofExpr::~UntypedOffsetofExpr() {207 delete type;208 }209 181 210 182 void UntypedOffsetofExpr::print( std::ostream &os, Indenter indent) const { … … 224 196 Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {} 225 197 226 OffsetofExpr::~OffsetofExpr() {227 delete type;228 }229 230 198 void OffsetofExpr::print( std::ostream &os, Indenter indent) const { 231 199 os << "Offsetof Expression on member " << member->name << " of "; … … 241 209 OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {} 242 210 243 OffsetPackExpr::~OffsetPackExpr() { delete type; }244 245 211 void OffsetPackExpr::print( std::ostream &os, Indenter indent ) const { 246 212 os << "Offset pack expression on "; … … 259 225 AttrExpr::AttrExpr( const AttrExpr &other ) : 260 226 Expression( other ), attr( maybeClone( other.attr ) ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType ) { 261 }262 263 AttrExpr::~AttrExpr() {264 delete attr;265 delete expr;266 delete type;267 227 } 268 228 … … 287 247 288 248 CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) { 289 }290 291 CastExpr::~CastExpr() {292 delete arg;293 249 } 294 250 … … 312 268 } 313 269 314 KeywordCastExpr::~KeywordCastExpr() {315 delete arg;316 }317 318 270 const std::string & KeywordCastExpr::targetString() const { 319 271 static const std::string targetStrs[] = { … … 340 292 341 293 VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) { 342 }343 344 VirtualCastExpr::~VirtualCastExpr() {345 delete arg;346 294 } 347 295 … … 368 316 } 369 317 370 UntypedMemberExpr::~UntypedMemberExpr() {371 delete aggregate;372 delete member;373 }374 375 318 void UntypedMemberExpr::print( std::ostream &os, Indenter indent ) const { 376 319 os << "Untyped Member Expression, with field: " << std::endl << indent+1; … … 399 342 } 400 343 401 MemberExpr::~MemberExpr() {402 // don't delete the member declaration, since it points somewhere else in the tree403 delete aggregate;404 }405 406 344 void MemberExpr::print( std::ostream &os, Indenter indent ) const { 407 345 os << "Member Expression, with field: " << std::endl; … … 419 357 Expression( other ), function( maybeClone( other.function ) ) { 420 358 cloneAll( other.args, args ); 421 }422 423 UntypedExpr::~UntypedExpr() {424 delete function;425 deleteAll( args );426 359 } 427 360 … … 472 405 } 473 406 474 NameExpr::~NameExpr() {}475 476 407 void NameExpr::print( std::ostream &os, Indenter indent ) const { 477 408 os << "Name: " << get_name(); … … 486 417 LogicalExpr::LogicalExpr( const LogicalExpr &other ) : 487 418 Expression( other ), arg1( maybeClone( other.arg1 ) ), arg2( maybeClone( other.arg2 ) ), isAnd( other.isAnd ) { 488 }489 490 LogicalExpr::~LogicalExpr() {491 delete arg1;492 delete arg2;493 419 } 494 420 … … 506 432 ConditionalExpr::ConditionalExpr( const ConditionalExpr &other ) : 507 433 Expression( other ), arg1( maybeClone( other.arg1 ) ), arg2( maybeClone( other.arg2 ) ), arg3( maybeClone( other.arg3 ) ) { 508 }509 510 ConditionalExpr::~ConditionalExpr() {511 delete arg1;512 delete arg2;513 delete arg3;514 434 } 515 435 … … 549 469 ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() { 550 470 set_env( nullptr ); // ImplicitCopyCtorExpr does not take ownership of an environment 551 delete callExpr;552 deleteAll( tempDecls );553 deleteAll( returnDecls );554 deleteAll( dtors );555 471 } 556 472 … … 577 493 } 578 494 579 ConstructorExpr::~ConstructorExpr() {580 delete callExpr;581 }582 583 495 void ConstructorExpr::print( std::ostream &os, Indenter indent ) const { 584 496 os << "Constructor Expression: " << std::endl << indent+1; … … 595 507 596 508 CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), initializer( other.initializer->clone() ) {} 597 598 CompoundLiteralExpr::~CompoundLiteralExpr() {599 delete initializer;600 }601 509 602 510 void CompoundLiteralExpr::print( std::ostream &os, Indenter indent ) const { … … 625 533 cloneAll( other.dtors, dtors ); 626 534 } 627 StmtExpr::~StmtExpr() {628 delete statements;629 deleteAll( dtors );630 deleteAll( returnDecls );631 }632 535 void StmtExpr::computeResult() { 633 536 assert( statements ); 634 537 std::list< Statement * > & body = statements->kids; 635 delete result;636 538 result = nullptr; 637 539 if ( ! returnDecls.empty() ) { … … 676 578 UniqueExpr::UniqueExpr( const UniqueExpr &other ) : Expression( other ), expr( maybeClone( other.expr ) ), object( maybeClone( other.object ) ), var( maybeClone( other.var ) ), id( other.id ) { 677 579 } 678 UniqueExpr::~UniqueExpr() { 679 delete expr; 680 delete object; 681 delete var; 682 } 580 683 581 void UniqueExpr::print( std::ostream &os, Indenter indent ) const { 684 582 os << "Unique Expression with id:" << id << std::endl << indent+1; … … 693 591 InitAlternative::InitAlternative( Type * type, Designation * designation ) : type( type ), designation( designation ) {} 694 592 InitAlternative::InitAlternative( const InitAlternative & other ) : type( maybeClone( other.type ) ), designation( maybeClone( other.designation ) ) {} 695 InitAlternative::~InitAlternative() {696 delete type;697 delete designation;698 }699 593 700 594 UntypedInitExpr::UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts ) : expr( expr ), initAlts( initAlts ) {} 701 595 UntypedInitExpr::UntypedInitExpr( const UntypedInitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), initAlts( other.initAlts ) {} 702 UntypedInitExpr::~UntypedInitExpr() {703 delete expr;704 }705 596 706 597 void UntypedInitExpr::print( std::ostream & os, Indenter indent ) const { … … 720 611 } 721 612 InitExpr::InitExpr( const InitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), designation( maybeClone( other.designation) ) {} 722 InitExpr::~InitExpr() {723 delete expr;724 delete designation;725 }726 613 727 614 void InitExpr::print( std::ostream & os, Indenter indent ) const { … … 737 624 } 738 625 DeletedExpr::DeletedExpr( const DeletedExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), deleteStmt( other.deleteStmt ) {} 739 DeletedExpr::~DeletedExpr() {740 delete expr;741 }742 626 743 627 void DeletedExpr::print( std::ostream & os, Indenter indent ) const {
Note:
See TracChangeset
for help on using the changeset viewer.