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