Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.h

    r42107b4 rcdb990a  
    4141        ParamEntry( UniqueId decl, Type * actualType, Type * formalType, Expression* expr ): decl( decl ), actualType( actualType ), formalType( formalType ), expr( expr ), inferParams( new InferredParams ) {}
    4242        ParamEntry( const ParamEntry & other );
     43        ParamEntry( ParamEntry && other );
     44        ~ParamEntry();
    4345        ParamEntry & operator=( const ParamEntry & other );
     46        ParamEntry & operator=( ParamEntry && other );
    4447
    4548        UniqueId decl;
     
    5255/// Expression is the root type for all expressions
    5356class Expression : public BaseSyntaxNode {
    54   protected:
    55         virtual ~Expression();
    56 
    5757  public:
    5858        Type * result;
     
    6363        Expression();
    6464        Expression( const Expression & other );
     65        virtual ~Expression();
    6566
    6667        Type *& get_result() { return result; }
     
    7576        InferredParams & get_inferParams() { return inferParams; }
    7677
     78        // move other's inferParams to this
     79        void spliceInferParams( Expression * other );
     80
    7781        virtual Expression * clone() const override = 0;
    7882        virtual void accept( Visitor & v ) override = 0;
     
    9094        ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() );
    9195        ApplicationExpr( const ApplicationExpr & other );
     96        virtual ~ApplicationExpr();
    9297
    9398        Expression * get_function() const { return function; }
     
    111116        UntypedExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() );
    112117        UntypedExpr( const UntypedExpr & other );
     118        virtual ~UntypedExpr();
    113119
    114120        Expression * get_function() const { return function; }
     
    135141        NameExpr( std::string name );
    136142        NameExpr( const NameExpr & other );
     143        virtual ~NameExpr();
    137144
    138145        const std::string & get_name() const { return name; }
     
    155162        AddressExpr( Expression * arg );
    156163        AddressExpr( const AddressExpr & other );
     164        virtual ~AddressExpr();
    157165
    158166        Expression * get_arg() const { return arg; }
     
    173181        LabelAddressExpr( const Label &arg );
    174182        LabelAddressExpr( const LabelAddressExpr & other );
     183        virtual ~LabelAddressExpr();
    175184
    176185        virtual LabelAddressExpr * clone() const { return new LabelAddressExpr( * this ); }
     
    190199        CastExpr( Expression * arg, void * ) = delete; // prevent accidentally passing pointers for isGenerated in the first constructor
    191200        CastExpr( const CastExpr & other );
     201        virtual ~CastExpr();
    192202
    193203        Expression * get_arg() const { return arg; }
     
    210220        KeywordCastExpr( Expression * arg, Target target );
    211221        KeywordCastExpr( const KeywordCastExpr & other );
     222        virtual ~KeywordCastExpr();
    212223
    213224        const std::string & targetString() const;
     
    226237        VirtualCastExpr( Expression * arg, Type * toType );
    227238        VirtualCastExpr( const VirtualCastExpr & other );
     239        virtual ~VirtualCastExpr();
    228240
    229241        Expression * get_arg() const { return arg; }
     
    244256        UntypedMemberExpr( Expression * member, Expression * aggregate );
    245257        UntypedMemberExpr( const UntypedMemberExpr & other );
     258        virtual ~UntypedMemberExpr();
    246259
    247260        Expression * get_member() const { return member; }
     
    265278        MemberExpr( DeclarationWithType * member, Expression * aggregate );
    266279        MemberExpr( const MemberExpr & other );
     280        virtual ~MemberExpr();
    267281
    268282        DeclarationWithType * get_member() const { return member; }
     
    285299        VariableExpr( DeclarationWithType * var );
    286300        VariableExpr( const VariableExpr & other );
     301        virtual ~VariableExpr();
    287302
    288303        DeclarationWithType * get_var() const { return var; }
     
    304319        ConstantExpr( Constant constant );
    305320        ConstantExpr( const ConstantExpr & other );
     321        virtual ~ConstantExpr();
    306322
    307323        Constant * get_constant() { return & constant; }
     
    327343        SizeofExpr( const SizeofExpr & other );
    328344        SizeofExpr( Type * type );
     345        virtual ~SizeofExpr();
    329346
    330347        Expression * get_expr() const { return expr; }
     
    351368        AlignofExpr( const AlignofExpr & other );
    352369        AlignofExpr( Type * type );
     370        virtual ~AlignofExpr();
    353371
    354372        Expression * get_expr() const { return expr; }
     
    373391        UntypedOffsetofExpr( Type * type, const std::string & member );
    374392        UntypedOffsetofExpr( const UntypedOffsetofExpr & other );
     393        virtual ~UntypedOffsetofExpr();
    375394
    376395        std::string get_member() const { return member; }
     
    393412        OffsetofExpr( Type * type, DeclarationWithType * member );
    394413        OffsetofExpr( const OffsetofExpr & other );
     414        virtual ~OffsetofExpr();
    395415
    396416        Type * get_type() const { return type; }
     
    412432        OffsetPackExpr( StructInstType * type );
    413433        OffsetPackExpr( const OffsetPackExpr & other );
     434        virtual ~OffsetPackExpr();
    414435
    415436        StructInstType * get_type() const { return type; }
     
    433454        AttrExpr( const AttrExpr & other );
    434455        AttrExpr( Expression * attr, Type * type );
     456        virtual ~AttrExpr();
    435457
    436458        Expression * get_attr() const { return attr; }
     
    457479        LogicalExpr( Expression * arg1, Expression * arg2, bool andp = true );
    458480        LogicalExpr( const LogicalExpr & other );
     481        virtual ~LogicalExpr();
    459482
    460483        bool get_isAnd() const { return isAnd; }
     
    482505        ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3 );
    483506        ConditionalExpr( const ConditionalExpr & other );
     507        virtual ~ConditionalExpr();
    484508
    485509        Expression * get_arg1() const { return arg1; }
     
    504528        CommaExpr( Expression * arg1, Expression * arg2 );
    505529        CommaExpr( const CommaExpr & other );
     530        virtual ~CommaExpr();
    506531
    507532        Expression * get_arg1() const { return arg1; }
     
    523548        TypeExpr( Type * type );
    524549        TypeExpr( const TypeExpr & other );
     550        virtual ~TypeExpr();
    525551
    526552        Type * get_type() const { return type; }
     
    542568        AsmExpr( Expression * inout, Expression * constraint, Expression * operand ) : inout( inout ), constraint( constraint ), operand( operand ) {}
    543569        AsmExpr( const AsmExpr & other );
     570        virtual ~AsmExpr() { delete inout; delete constraint; delete operand; };
    544571
    545572        Expression * get_inout() const { return inout; }
     
    563590/// along with a set of copy constructor calls, one for each argument.
    564591class ImplicitCopyCtorExpr : public Expression {
    565 protected:
    566         virtual ~ImplicitCopyCtorExpr();
    567 
    568592public:
    569593        ApplicationExpr * callExpr;
     
    574598        ImplicitCopyCtorExpr( ApplicationExpr * callExpr );
    575599        ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other );
     600        virtual ~ImplicitCopyCtorExpr();
    576601
    577602        ApplicationExpr * get_callExpr() const { return callExpr; }
     
    595620        ConstructorExpr( Expression * callExpr );
    596621        ConstructorExpr( const ConstructorExpr & other );
     622        ~ConstructorExpr();
    597623
    598624        Expression * get_callExpr() const { return callExpr; }
     
    612638        CompoundLiteralExpr( Type * type, Initializer * initializer );
    613639        CompoundLiteralExpr( const CompoundLiteralExpr & other );
     640        virtual ~CompoundLiteralExpr();
    614641
    615642        Initializer * get_initializer() const { return initializer; }
     
    648675        UntypedTupleExpr( const std::list< Expression * > & exprs );
    649676        UntypedTupleExpr( const UntypedTupleExpr & other );
     677        virtual ~UntypedTupleExpr();
    650678
    651679        std::list<Expression*>& get_exprs() { return exprs; }
     
    664692        TupleExpr( const std::list< Expression * > & exprs );
    665693        TupleExpr( const TupleExpr & other );
     694        virtual ~TupleExpr();
    666695
    667696        std::list<Expression*>& get_exprs() { return exprs; }
     
    681710        TupleIndexExpr( Expression * tuple, unsigned int index );
    682711        TupleIndexExpr( const TupleIndexExpr & other );
     712        virtual ~TupleIndexExpr();
    683713
    684714        Expression * get_tuple() const { return tuple; }
     
    700730        TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls );
    701731        TupleAssignExpr( const TupleAssignExpr & other );
     732        virtual ~TupleAssignExpr();
    702733
    703734        TupleAssignExpr * set_stmtExpr( StmtExpr * newValue ) { stmtExpr = newValue; return this; }
     
    719750        StmtExpr( CompoundStmt * statements );
    720751        StmtExpr( const StmtExpr & other );
     752        virtual ~StmtExpr();
    721753
    722754        CompoundStmt * get_statements() const { return statements; }
     
    743775        UniqueExpr( Expression * expr, long long idVal = -1 );
    744776        UniqueExpr( const UniqueExpr & other );
     777        ~UniqueExpr();
    745778
    746779        Expression * get_expr() const { return expr; }
     
    772805        InitAlternative( const InitAlternative & other );
    773806        InitAlternative & operator=( const Initializer & other ) = delete; // at the moment this isn't used, and I don't want to implement it
     807        ~InitAlternative();
    774808};
    775809
     
    781815        UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts );
    782816        UntypedInitExpr( const UntypedInitExpr & other );
     817        ~UntypedInitExpr();
    783818
    784819        Expression * get_expr() const { return expr; }
     
    800835        InitExpr( Expression * expr, Designation * designation );
    801836        InitExpr( const InitExpr & other );
     837        ~InitExpr();
    802838
    803839        Expression * get_expr() const { return expr; }
     
    821857        DeletedExpr( Expression * expr, BaseSyntaxNode * deleteStmt );
    822858        DeletedExpr( const DeletedExpr & other );
     859        ~DeletedExpr();
    823860
    824861        virtual DeletedExpr * clone() const { return new DeletedExpr( * this ); }
Note: See TracChangeset for help on using the changeset viewer.