Changes in src/SynTree/Expression.h [9a705dc8:68f9c43]
- File:
-
- 1 edited
-
src/SynTree/Expression.h (modified) (40 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.h
r9a705dc8 r68f9c43 41 41 ParamEntry( UniqueId decl, Type * actualType, Type * formalType, Expression* expr ): decl( decl ), actualType( actualType ), formalType( formalType ), expr( expr ), inferParams( new InferredParams ) {} 42 42 ParamEntry( const ParamEntry & other ); 43 ~ParamEntry();44 43 ParamEntry & operator=( const ParamEntry & other ); 45 44 … … 53 52 /// Expression is the root type for all expressions 54 53 class Expression : public BaseSyntaxNode { 54 protected: 55 virtual ~Expression(); 56 55 57 public: 56 58 Type * result; … … 61 63 Expression(); 62 64 Expression( const Expression & other ); 63 virtual ~Expression();64 65 65 66 Type *& get_result() { return result; } … … 89 90 ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() ); 90 91 ApplicationExpr( const ApplicationExpr & other ); 91 virtual ~ApplicationExpr();92 92 93 93 Expression * get_function() const { return function; } … … 111 111 UntypedExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() ); 112 112 UntypedExpr( const UntypedExpr & other ); 113 virtual ~UntypedExpr();114 113 115 114 Expression * get_function() const { return function; } … … 136 135 NameExpr( std::string name ); 137 136 NameExpr( const NameExpr & other ); 138 virtual ~NameExpr();139 137 140 138 const std::string & get_name() const { return name; } … … 157 155 AddressExpr( Expression * arg ); 158 156 AddressExpr( const AddressExpr & other ); 159 virtual ~AddressExpr();160 157 161 158 Expression * get_arg() const { return arg; } … … 176 173 LabelAddressExpr( const Label &arg ); 177 174 LabelAddressExpr( const LabelAddressExpr & other ); 178 virtual ~LabelAddressExpr();179 175 180 176 virtual LabelAddressExpr * clone() const { return new LabelAddressExpr( * this ); } … … 188 184 public: 189 185 Expression * arg; 190 bool isGenerated = true; // whether this cast appeared in the source program 191 192 CastExpr( Expression * arg, bool isGenerated = true ); 193 CastExpr( Expression * arg, Type * toType, bool isGenerated = true ); 194 CastExpr( Expression * arg, void * ) = delete; // prevent accidentally passing pointers for isGenerated in the first constructor 186 187 CastExpr( Expression * arg ); 188 CastExpr( Expression * arg, Type * toType ); 195 189 CastExpr( const CastExpr & other ); 196 virtual ~CastExpr();197 190 198 191 Expression * get_arg() const { return arg; } … … 205 198 }; 206 199 207 /// KeywordCastExpr represents a cast to 'keyword types', e.g. (thread &)t208 class KeywordCastExpr : public Expression {209 public:210 Expression * arg;211 enum Target {212 Coroutine, Thread, Monitor, NUMBER_OF_TARGETS213 } target;214 215 KeywordCastExpr( Expression * arg, Target target );216 KeywordCastExpr( const KeywordCastExpr & other );217 virtual ~KeywordCastExpr();218 219 const std::string & targetString() const;220 221 virtual KeywordCastExpr * clone() const { return new KeywordCastExpr( * this ); }222 virtual void accept( Visitor & v ) { v.visit( this ); }223 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }224 virtual void print( std::ostream & os, Indenter indent = {} ) const;225 };226 227 200 /// VirtualCastExpr repersents a virtual dynamic cast, e.g. (virtual exception)e 228 201 class VirtualCastExpr : public Expression { … … 232 205 VirtualCastExpr( Expression * arg, Type * toType ); 233 206 VirtualCastExpr( const VirtualCastExpr & other ); 234 virtual ~VirtualCastExpr();235 207 236 208 Expression * get_arg() const { return arg; } … … 251 223 UntypedMemberExpr( Expression * member, Expression * aggregate ); 252 224 UntypedMemberExpr( const UntypedMemberExpr & other ); 253 virtual ~UntypedMemberExpr();254 225 255 226 Expression * get_member() const { return member; } … … 273 244 MemberExpr( DeclarationWithType * member, Expression * aggregate ); 274 245 MemberExpr( const MemberExpr & other ); 275 virtual ~MemberExpr();276 246 277 247 DeclarationWithType * get_member() const { return member; } … … 294 264 VariableExpr( DeclarationWithType * var ); 295 265 VariableExpr( const VariableExpr & other ); 296 virtual ~VariableExpr();297 266 298 267 DeclarationWithType * get_var() const { return var; } … … 314 283 ConstantExpr( Constant constant ); 315 284 ConstantExpr( const ConstantExpr & other ); 316 virtual ~ConstantExpr();317 285 318 286 Constant * get_constant() { return & constant; } … … 338 306 SizeofExpr( const SizeofExpr & other ); 339 307 SizeofExpr( Type * type ); 340 virtual ~SizeofExpr();341 308 342 309 Expression * get_expr() const { return expr; } … … 363 330 AlignofExpr( const AlignofExpr & other ); 364 331 AlignofExpr( Type * type ); 365 virtual ~AlignofExpr();366 332 367 333 Expression * get_expr() const { return expr; } … … 386 352 UntypedOffsetofExpr( Type * type, const std::string & member ); 387 353 UntypedOffsetofExpr( const UntypedOffsetofExpr & other ); 388 virtual ~UntypedOffsetofExpr();389 354 390 355 std::string get_member() const { return member; } … … 407 372 OffsetofExpr( Type * type, DeclarationWithType * member ); 408 373 OffsetofExpr( const OffsetofExpr & other ); 409 virtual ~OffsetofExpr();410 374 411 375 Type * get_type() const { return type; } … … 427 391 OffsetPackExpr( StructInstType * type ); 428 392 OffsetPackExpr( const OffsetPackExpr & other ); 429 virtual ~OffsetPackExpr();430 393 431 394 StructInstType * get_type() const { return type; } … … 449 412 AttrExpr( const AttrExpr & other ); 450 413 AttrExpr( Expression * attr, Type * type ); 451 virtual ~AttrExpr();452 414 453 415 Expression * get_attr() const { return attr; } … … 474 436 LogicalExpr( Expression * arg1, Expression * arg2, bool andp = true ); 475 437 LogicalExpr( const LogicalExpr & other ); 476 virtual ~LogicalExpr();477 438 478 439 bool get_isAnd() const { return isAnd; } … … 500 461 ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3 ); 501 462 ConditionalExpr( const ConditionalExpr & other ); 502 virtual ~ConditionalExpr();503 463 504 464 Expression * get_arg1() const { return arg1; } … … 523 483 CommaExpr( Expression * arg1, Expression * arg2 ); 524 484 CommaExpr( const CommaExpr & other ); 525 virtual ~CommaExpr();526 485 527 486 Expression * get_arg1() const { return arg1; } … … 543 502 TypeExpr( Type * type ); 544 503 TypeExpr( const TypeExpr & other ); 545 virtual ~TypeExpr();546 504 547 505 Type * get_type() const { return type; } … … 563 521 AsmExpr( Expression * inout, Expression * constraint, Expression * operand ) : inout( inout ), constraint( constraint ), operand( operand ) {} 564 522 AsmExpr( const AsmExpr & other ); 565 virtual ~AsmExpr() { delete inout; delete constraint; delete operand; };566 523 567 524 Expression * get_inout() const { return inout; } … … 585 542 /// along with a set of copy constructor calls, one for each argument. 586 543 class ImplicitCopyCtorExpr : public Expression { 544 protected: 545 virtual ~ImplicitCopyCtorExpr(); 546 587 547 public: 588 548 ApplicationExpr * callExpr; … … 593 553 ImplicitCopyCtorExpr( ApplicationExpr * callExpr ); 594 554 ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other ); 595 virtual ~ImplicitCopyCtorExpr();596 555 597 556 ApplicationExpr * get_callExpr() const { return callExpr; } … … 615 574 ConstructorExpr( Expression * callExpr ); 616 575 ConstructorExpr( const ConstructorExpr & other ); 617 ~ConstructorExpr();618 576 619 577 Expression * get_callExpr() const { return callExpr; } … … 633 591 CompoundLiteralExpr( Type * type, Initializer * initializer ); 634 592 CompoundLiteralExpr( const CompoundLiteralExpr & other ); 635 virtual ~CompoundLiteralExpr();636 593 637 594 Initializer * get_initializer() const { return initializer; } … … 670 627 UntypedTupleExpr( const std::list< Expression * > & exprs ); 671 628 UntypedTupleExpr( const UntypedTupleExpr & other ); 672 virtual ~UntypedTupleExpr();673 629 674 630 std::list<Expression*>& get_exprs() { return exprs; } … … 687 643 TupleExpr( const std::list< Expression * > & exprs ); 688 644 TupleExpr( const TupleExpr & other ); 689 virtual ~TupleExpr();690 645 691 646 std::list<Expression*>& get_exprs() { return exprs; } … … 705 660 TupleIndexExpr( Expression * tuple, unsigned int index ); 706 661 TupleIndexExpr( const TupleIndexExpr & other ); 707 virtual ~TupleIndexExpr();708 662 709 663 Expression * get_tuple() const { return tuple; } … … 725 679 TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls ); 726 680 TupleAssignExpr( const TupleAssignExpr & other ); 727 virtual ~TupleAssignExpr();728 681 729 682 TupleAssignExpr * set_stmtExpr( StmtExpr * newValue ) { stmtExpr = newValue; return this; } … … 745 698 StmtExpr( CompoundStmt * statements ); 746 699 StmtExpr( const StmtExpr & other ); 747 virtual ~StmtExpr();748 700 749 701 CompoundStmt * get_statements() const { return statements; } … … 770 722 UniqueExpr( Expression * expr, long long idVal = -1 ); 771 723 UniqueExpr( const UniqueExpr & other ); 772 ~UniqueExpr();773 724 774 725 Expression * get_expr() const { return expr; } … … 800 751 InitAlternative( const InitAlternative & other ); 801 752 InitAlternative & operator=( const Initializer & other ) = delete; // at the moment this isn't used, and I don't want to implement it 802 ~InitAlternative();803 753 }; 804 754 … … 810 760 UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts ); 811 761 UntypedInitExpr( const UntypedInitExpr & other ); 812 ~UntypedInitExpr();813 762 814 763 Expression * get_expr() const { return expr; } … … 830 779 InitExpr( Expression * expr, Designation * designation ); 831 780 InitExpr( const InitExpr & other ); 832 ~InitExpr();833 781 834 782 Expression * get_expr() const { return expr; } … … 852 800 DeletedExpr( Expression * expr, BaseSyntaxNode * deleteStmt ); 853 801 DeletedExpr( const DeletedExpr & other ); 854 ~DeletedExpr();855 802 856 803 virtual DeletedExpr * clone() const { return new DeletedExpr( * this ); }
Note:
See TracChangeset
for help on using the changeset viewer.