Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    r9a705dc8 r42107b4  
    5252Expression::~Expression() {
    5353        delete env;
    54         delete result;
    5554}
    5655
     
    7473ConstantExpr::ConstantExpr( const ConstantExpr &other) : Expression( other ), constant( other.constant ) {
    7574}
    76 
    77 ConstantExpr::~ConstantExpr() {}
    7875
    7976void ConstantExpr::print( std::ostream &os, Indenter indent ) const {
     
    120117}
    121118
    122 VariableExpr::~VariableExpr() {
    123         // don't delete the declaration, since it points somewhere else in the tree
    124 }
    125 
    126119VariableExpr * VariableExpr::functionPointer( FunctionDecl * func ) {
    127120        VariableExpr * funcExpr = new VariableExpr( func );
     
    150143}
    151144
    152 SizeofExpr::~SizeofExpr() {
    153         delete expr;
    154         delete type;
    155 }
    156 
    157145void SizeofExpr::print( std::ostream &os, Indenter indent) const {
    158146        os << "Sizeof Expression on: ";
     
    176164}
    177165
    178 AlignofExpr::~AlignofExpr() {
    179         delete expr;
    180         delete type;
    181 }
    182 
    183166void AlignofExpr::print( std::ostream &os, Indenter indent) const {
    184167        os << "Alignof Expression on: ";
     
    196179UntypedOffsetofExpr::UntypedOffsetofExpr( const UntypedOffsetofExpr &other ) :
    197180        Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {}
    198 
    199 UntypedOffsetofExpr::~UntypedOffsetofExpr() {
    200         delete type;
    201 }
    202181
    203182void UntypedOffsetofExpr::print( std::ostream &os, Indenter indent) const {
     
    217196        Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {}
    218197
    219 OffsetofExpr::~OffsetofExpr() {
    220         delete type;
    221 }
    222 
    223198void OffsetofExpr::print( std::ostream &os, Indenter indent) const {
    224199        os << "Offsetof Expression on member " << member->name << " of ";
     
    234209OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {}
    235210
    236 OffsetPackExpr::~OffsetPackExpr() { delete type; }
    237 
    238211void OffsetPackExpr::print( std::ostream &os, Indenter indent ) const {
    239212        os << "Offset pack expression on ";
     
    252225AttrExpr::AttrExpr( const AttrExpr &other ) :
    253226                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;
    260227}
    261228
     
    280247
    281248CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) {
    282 }
    283 
    284 CastExpr::~CastExpr() {
    285         delete arg;
    286249}
    287250
     
    305268}
    306269
    307 KeywordCastExpr::~KeywordCastExpr() {
    308         delete arg;
    309 }
    310 
    311270const std::string & KeywordCastExpr::targetString() const {
    312271        static const std::string targetStrs[] = {
     
    333292
    334293VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
    335 }
    336 
    337 VirtualCastExpr::~VirtualCastExpr() {
    338         delete arg;
    339294}
    340295
     
    361316}
    362317
    363 UntypedMemberExpr::~UntypedMemberExpr() {
    364         delete aggregate;
    365         delete member;
    366 }
    367 
    368318void UntypedMemberExpr::print( std::ostream &os, Indenter indent ) const {
    369319        os << "Untyped Member Expression, with field: " << std::endl << indent+1;
     
    392342}
    393343
    394 MemberExpr::~MemberExpr() {
    395         // don't delete the member declaration, since it points somewhere else in the tree
    396         delete aggregate;
    397 }
    398 
    399344void MemberExpr::print( std::ostream &os, Indenter indent ) const {
    400345        os << "Member Expression, with field: " << std::endl;
     
    412357                Expression( other ), function( maybeClone( other.function ) ) {
    413358        cloneAll( other.args, args );
    414 }
    415 
    416 UntypedExpr::~UntypedExpr() {
    417         delete function;
    418         deleteAll( args );
    419359}
    420360
     
    465405}
    466406
    467 NameExpr::~NameExpr() {}
    468 
    469407void NameExpr::print( std::ostream &os, Indenter indent ) const {
    470408        os << "Name: " << get_name();
     
    479417LogicalExpr::LogicalExpr( const LogicalExpr &other ) :
    480418                Expression( other ), arg1( maybeClone( other.arg1 ) ), arg2( maybeClone( other.arg2 ) ), isAnd( other.isAnd ) {
    481 }
    482 
    483 LogicalExpr::~LogicalExpr() {
    484         delete arg1;
    485         delete arg2;
    486419}
    487420
     
    499432ConditionalExpr::ConditionalExpr( const ConditionalExpr &other ) :
    500433                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;
    507434}
    508435
     
    542469ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() {
    543470        set_env( nullptr ); // ImplicitCopyCtorExpr does not take ownership of an environment
    544         delete callExpr;
    545         deleteAll( tempDecls );
    546         deleteAll( returnDecls );
    547         deleteAll( dtors );
    548471}
    549472
     
    570493}
    571494
    572 ConstructorExpr::~ConstructorExpr() {
    573         delete callExpr;
    574 }
    575 
    576495void ConstructorExpr::print( std::ostream &os, Indenter indent ) const {
    577496        os <<  "Constructor Expression: " << std::endl << indent+1;
     
    588507
    589508CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), initializer( other.initializer->clone() ) {}
    590 
    591 CompoundLiteralExpr::~CompoundLiteralExpr() {
    592         delete initializer;
    593 }
    594509
    595510void CompoundLiteralExpr::print( std::ostream &os, Indenter indent ) const {
     
    618533        cloneAll( other.dtors, dtors );
    619534}
    620 StmtExpr::~StmtExpr() {
    621         delete statements;
    622         deleteAll( dtors );
    623         deleteAll( returnDecls );
    624 }
    625535void StmtExpr::computeResult() {
    626536        assert( statements );
    627537        std::list< Statement * > & body = statements->kids;
    628         delete result;
    629538        result = nullptr;
    630539        if ( ! returnDecls.empty() ) {
     
    669578UniqueExpr::UniqueExpr( const UniqueExpr &other ) : Expression( other ), expr( maybeClone( other.expr ) ), object( maybeClone( other.object ) ), var( maybeClone( other.var ) ), id( other.id ) {
    670579}
    671 UniqueExpr::~UniqueExpr() {
    672         delete expr;
    673         delete object;
    674         delete var;
    675 }
     580
    676581void UniqueExpr::print( std::ostream &os, Indenter indent ) const {
    677582        os << "Unique Expression with id:" << id << std::endl << indent+1;
     
    686591InitAlternative::InitAlternative( Type * type, Designation * designation ) : type( type ), designation( designation ) {}
    687592InitAlternative::InitAlternative( const InitAlternative & other ) : type( maybeClone( other.type ) ), designation( maybeClone( other.designation ) ) {}
    688 InitAlternative::~InitAlternative() {
    689         delete type;
    690         delete designation;
    691 }
    692593
    693594UntypedInitExpr::UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts ) : expr( expr ), initAlts( initAlts ) {}
    694595UntypedInitExpr::UntypedInitExpr( const UntypedInitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), initAlts( other.initAlts ) {}
    695 UntypedInitExpr::~UntypedInitExpr() {
    696         delete expr;
    697 }
    698596
    699597void UntypedInitExpr::print( std::ostream & os, Indenter indent ) const {
     
    713611}
    714612InitExpr::InitExpr( const InitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), designation( maybeClone( other.designation) ) {}
    715 InitExpr::~InitExpr() {
    716         delete expr;
    717         delete designation;
    718 }
    719613
    720614void InitExpr::print( std::ostream & os, Indenter indent ) const {
     
    730624}
    731625DeletedExpr::DeletedExpr( const DeletedExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), deleteStmt( other.deleteStmt ) {}
    732 DeletedExpr::~DeletedExpr() {
    733         delete expr;
    734 }
    735626
    736627void DeletedExpr::print( std::ostream & os, Indenter indent ) const {
Note: See TracChangeset for help on using the changeset viewer.