Changeset 640b3df for src/SynTree/Type.h
- Timestamp:
- Feb 21, 2023, 4:24:34 PM (3 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 257a8f5, ce44c5f
- Parents:
- 1180175 (diff), 9a533ba (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Type.h
r1180175 r640b3df 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed Jul 14 15:40:00 202113 // Update Count : 17 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Feb 19 22:37:10 2023 13 // Update Count : 176 14 14 // 15 15 … … 23 23 24 24 #include "BaseSyntaxNode.h" // for BaseSyntaxNode 25 #include "Common/utility.h" // for operator+ 25 #include "Common/Iterate.hpp"// for operator+ 26 #include "Common/utility.h" // for toCString 26 27 #include "Mutator.h" // for Mutator 27 28 #include "SynTree.h" // for AST nodes … … 124 125 bool operator!=( Qualifiers other ) const { return (val & Mask) != (other.val & Mask); } 125 126 bool operator<=( Qualifiers other ) const { 126 return is_const <= other.is_const // Any non-const converts to const without cost127 && is_volatile <= other.is_volatile //Any non-volatile converts to volatile without cost128 && is_mutex >= other.is_mutex //Any mutex converts to non-mutex without cost129 && is_atomic == other.is_atomic; //No conversion from atomic to non atomic is free127 return is_const <= other.is_const // Any non-const converts to const without cost 128 && is_volatile <= other.is_volatile // Any non-volatile converts to volatile without cost 129 && is_mutex >= other.is_mutex // Any mutex converts to non-mutex without cost 130 && is_atomic == other.is_atomic; // No conversion from atomic to non atomic is free 130 131 } 131 132 bool operator<( Qualifiers other ) const { return *this != other && *this <= other; } … … 189 190 virtual TypeSubstitution genericSubstitution() const; 190 191 191 virtual Type * clone() const = 0;192 virtual Type * clone() const = 0; 192 193 virtual void accept( Visitor & v ) = 0; 193 194 virtual void accept( Visitor & v ) const = 0; 194 virtual Type * acceptMutator( Mutator & m ) = 0;195 virtual Type * acceptMutator( Mutator & m ) = 0; 195 196 virtual void print( std::ostream & os, Indenter indent = {} ) const; 196 197 }; … … 207 208 virtual bool isComplete() const override { return false; } 208 209 209 virtual VoidType * clone() const override { return new VoidType( *this ); }210 virtual void accept( Visitor & v ) override { v.visit( this ); } 211 virtual void accept( Visitor & v ) const override { v.visit( this ); } 212 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }210 virtual VoidType * clone() const override { return new VoidType( *this ); } 211 virtual void accept( Visitor & v ) override { v.visit( this ); } 212 virtual void accept( Visitor & v ) const override { v.visit( this ); } 213 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 213 214 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 214 215 }; … … 259 260 // GENERATED END 260 261 261 static const char * typeNames[];// string names for basic types, MUST MATCH with Kind262 static const char * typeNames[]; // string names for basic types, MUST MATCH with Kind 262 263 263 264 BasicType( const Type::Qualifiers & tq, Kind bt, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); … … 266 267 void set_kind( Kind newValue ) { kind = newValue; } 267 268 268 virtual BasicType * clone() const override { return new BasicType( *this ); }269 virtual void accept( Visitor & v ) override { v.visit( this ); } 270 virtual void accept( Visitor & v ) const override { v.visit( this ); } 271 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }269 virtual BasicType * clone() const override { return new BasicType( *this ); } 270 virtual void accept( Visitor & v ) override { v.visit( this ); } 271 virtual void accept( Visitor & v ) const override { v.visit( this ); } 272 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 272 273 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 273 274 bool isInteger() const; … … 279 280 280 281 // In C99, pointer types can be qualified in many ways e.g., int f( int a[ static 3 ] ) 281 Expression * dimension;282 Expression * dimension; 282 283 bool isVarLen; 283 284 bool isStatic; 284 285 285 PointerType( const Type::Qualifiers & tq, Type * base, const std::list< Attribute * > & attributes = std::list< Attribute * >() );286 PointerType( const Type::Qualifiers & tq, Type * base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );286 PointerType( const Type::Qualifiers & tq, Type * base, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 287 PointerType( const Type::Qualifiers & tq, Type * base, Expression * dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 287 288 PointerType( const PointerType& ); 288 289 virtual ~PointerType(); 289 290 290 Type * get_base() { return base; }291 void set_base( Type * newValue ) { base = newValue; }292 Expression * get_dimension() { return dimension; }293 void set_dimension( Expression * newValue ) { dimension = newValue; }291 Type * get_base() { return base; } 292 void set_base( Type * newValue ) { base = newValue; } 293 Expression * get_dimension() { return dimension; } 294 void set_dimension( Expression * newValue ) { dimension = newValue; } 294 295 bool get_isVarLen() { return isVarLen; } 295 296 void set_isVarLen( bool newValue ) { isVarLen = newValue; } … … 301 302 virtual bool isComplete() const override { return ! isVarLen; } 302 303 303 virtual PointerType * clone() const override { return new PointerType( *this ); }304 virtual void accept( Visitor & v ) override { v.visit( this ); } 305 virtual void accept( Visitor & v ) const override { v.visit( this ); } 306 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }304 virtual PointerType * clone() const override { return new PointerType( * this ); } 305 virtual void accept( Visitor & v ) override { v.visit( this ); } 306 virtual void accept( Visitor & v ) const override { v.visit( this ); } 307 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 307 308 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 308 309 }; … … 310 311 class ArrayType : public Type { 311 312 public: 312 Type * base;313 Expression * dimension;313 Type * base; 314 Expression * dimension; 314 315 bool isVarLen; 315 316 bool isStatic; 316 317 317 ArrayType( const Type::Qualifiers & tq, Type * base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );318 ArrayType( const Type::Qualifiers & tq, Type * base, Expression * dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 318 319 ArrayType( const ArrayType& ); 319 320 virtual ~ArrayType(); 320 321 321 Type * get_base() { return base; }322 void set_base( Type * newValue ) { base = newValue; }323 Expression * get_dimension() { return dimension; }324 void set_dimension( Expression * newValue ) { dimension = newValue; }322 Type * get_base() { return base; } 323 void set_base( Type * newValue ) { base = newValue; } 324 Expression * get_dimension() { return dimension; } 325 void set_dimension( Expression * newValue ) { dimension = newValue; } 325 326 bool get_isVarLen() { return isVarLen; } 326 327 void set_isVarLen( bool newValue ) { isVarLen = newValue; } … … 333 334 virtual bool isComplete() const override { return dimension || isVarLen; } 334 335 335 virtual ArrayType * clone() const override { return new ArrayType( *this ); }336 virtual void accept( Visitor & v ) override { v.visit( this ); } 337 virtual void accept( Visitor & v ) const override { v.visit( this ); } 338 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }336 virtual ArrayType * clone() const override { return new ArrayType( *this ); } 337 virtual void accept( Visitor & v ) override { v.visit( this ); } 338 virtual void accept( Visitor & v ) const override { v.visit( this ); } 339 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 339 340 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 340 341 }; … … 348 349 virtual ~QualifiedType(); 349 350 350 virtual QualifiedType * clone() const override { return new QualifiedType( *this ); }351 virtual void accept( Visitor & v ) override { v.visit( this ); } 352 virtual void accept( Visitor & v ) const override { v.visit( this ); } 353 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }351 virtual QualifiedType * clone() const override { return new QualifiedType( *this ); } 352 virtual void accept( Visitor & v ) override { v.visit( this ); } 353 virtual void accept( Visitor & v ) const override { v.visit( this ); } 354 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 354 355 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 355 356 }; … … 357 358 class ReferenceType : public Type { 358 359 public: 359 Type * base;360 361 ReferenceType( const Type::Qualifiers & tq, Type * base, const std::list< Attribute * > & attributes = std::list< Attribute * >() );360 Type * base; 361 362 ReferenceType( const Type::Qualifiers & tq, Type * base, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 362 363 ReferenceType( const ReferenceType & ); 363 364 virtual ~ReferenceType(); 364 365 365 Type * get_base() { return base; }366 void set_base( Type * newValue ) { base = newValue; }366 Type * get_base() { return base; } 367 void set_base( Type * newValue ) { base = newValue; } 367 368 368 369 virtual int referenceDepth() const override; … … 375 376 virtual TypeSubstitution genericSubstitution() const override; 376 377 377 virtual ReferenceType * clone() const override { return new ReferenceType( *this ); }378 virtual void accept( Visitor & v ) override { v.visit( this ); } 379 virtual void accept( Visitor & v ) const override { v.visit( this ); } 380 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }378 virtual ReferenceType * clone() const override { return new ReferenceType( *this ); } 379 virtual void accept( Visitor & v ) override { v.visit( this ); } 380 virtual void accept( Visitor & v ) const override { v.visit( this ); } 381 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 381 382 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 382 383 }; … … 405 406 bool isUnprototyped() const { return isVarArgs && parameters.size() == 0; } 406 407 407 virtual FunctionType * clone() const override { return new FunctionType( *this ); }408 virtual void accept( Visitor & v ) override { v.visit( this ); } 409 virtual void accept( Visitor & v ) const override { v.visit( this ); } 410 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }408 virtual FunctionType * clone() const override { return new FunctionType( *this ); } 409 virtual void accept( Visitor & v ) override { v.visit( this ); } 410 virtual void accept( Visitor & v ) const override { v.visit( this ); } 411 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 411 412 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 412 413 }; … … 414 415 class ReferenceToType : public Type { 415 416 public: 416 std::list< Expression * > parameters;417 std::list< Expression * > parameters; 417 418 std::string name; 418 419 bool hoistType; … … 428 429 void set_hoistType( bool newValue ) { hoistType = newValue; } 429 430 430 virtual ReferenceToType * clone() const override = 0;431 virtual ReferenceToType * clone() const override = 0; 431 432 virtual void accept( Visitor & v ) override = 0; 432 virtual Type * acceptMutator( Mutator & m ) override = 0;433 virtual Type * acceptMutator( Mutator & m ) override = 0; 433 434 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 434 435 … … 443 444 // this decl is not "owned" by the struct inst; it is merely a pointer to elsewhere in the tree, 444 445 // where the structure used in this type is actually defined 445 StructDecl * baseStruct;446 StructDecl * baseStruct; 446 447 447 448 StructInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >() ) : Parent( tq, name, attributes ), baseStruct( 0 ) {} … … 449 450 StructInstType( const StructInstType & other ) : Parent( other ), baseStruct( other.baseStruct ) {} 450 451 451 StructDecl * get_baseStruct() const { return baseStruct; }452 void set_baseStruct( StructDecl * newValue ) { baseStruct = newValue; }452 StructDecl * get_baseStruct() const { return baseStruct; } 453 void set_baseStruct( StructDecl * newValue ) { baseStruct = newValue; } 453 454 454 455 /// Accesses generic parameters of base struct (NULL if none such) … … 466 467 void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const override; 467 468 468 virtual StructInstType * clone() const override { return new StructInstType( *this ); }469 virtual void accept( Visitor & v ) override { v.visit( this ); } 470 virtual void accept( Visitor & v ) const override { v.visit( this ); } 471 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }469 virtual StructInstType * clone() const override { return new StructInstType( *this ); } 470 virtual void accept( Visitor & v ) override { v.visit( this ); } 471 virtual void accept( Visitor & v ) const override { v.visit( this ); } 472 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 472 473 473 474 virtual void print( std::ostream & os, Indenter indent = {} ) const override; … … 481 482 // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree, 482 483 // where the union used in this type is actually defined 483 UnionDecl * baseUnion;484 UnionDecl * baseUnion; 484 485 485 486 UnionInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >() ) : Parent( tq, name, attributes ), baseUnion( 0 ) {} … … 487 488 UnionInstType( const UnionInstType & other ) : Parent( other ), baseUnion( other.baseUnion ) {} 488 489 489 UnionDecl * get_baseUnion() const { return baseUnion; }490 UnionDecl * get_baseUnion() const { return baseUnion; } 490 491 void set_baseUnion( UnionDecl * newValue ) { baseUnion = newValue; } 491 492 … … 504 505 void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const override; 505 506 506 virtual UnionInstType * clone() const override { return new UnionInstType( *this ); }507 virtual void accept( Visitor & v ) override { v.visit( this ); } 508 virtual void accept( Visitor & v ) const override { v.visit( this ); } 509 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }507 virtual UnionInstType * clone() const override { return new UnionInstType( *this ); } 508 virtual void accept( Visitor & v ) override { v.visit( this ); } 509 virtual void accept( Visitor & v ) const override { v.visit( this ); } 510 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 510 511 511 512 virtual void print( std::ostream & os, Indenter indent = {} ) const override; … … 519 520 // this decl is not "owned" by the enum inst; it is merely a pointer to elsewhere in the tree, 520 521 // where the enum used in this type is actually defined 521 EnumDecl * baseEnum = nullptr;522 EnumDecl * baseEnum = nullptr; 522 523 523 524 EnumInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >() ) : Parent( tq, name, attributes ) {} … … 525 526 EnumInstType( const EnumInstType & other ) : Parent( other ), baseEnum( other.baseEnum ) {} 526 527 527 EnumDecl * get_baseEnum() const { return baseEnum; }528 void set_baseEnum( EnumDecl * newValue ) { baseEnum = newValue; }528 EnumDecl * get_baseEnum() const { return baseEnum; } 529 void set_baseEnum( EnumDecl * newValue ) { baseEnum = newValue; } 529 530 530 531 virtual bool isComplete() const override; … … 532 533 virtual AggregateDecl * getAggr() const override; 533 534 534 virtual EnumInstType * clone() const override { return new EnumInstType( *this ); }535 virtual void accept( Visitor & v ) override { v.visit( this ); } 536 virtual void accept( Visitor & v ) const override { v.visit( this ); } 537 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }535 virtual EnumInstType * clone() const override { return new EnumInstType( *this ); } 536 virtual void accept( Visitor & v ) override { v.visit( this ); } 537 virtual void accept( Visitor & v ) const override { v.visit( this ); } 538 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 538 539 539 540 virtual void print( std::ostream & os, Indenter indent = {} ) const override; … … 556 557 virtual bool isComplete() const override; 557 558 558 virtual TraitInstType * clone() const override { return new TraitInstType( *this ); }559 virtual void accept( Visitor & v ) override { v.visit( this ); } 560 virtual void accept( Visitor & v ) const override { v.visit( this ); } 561 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }559 virtual TraitInstType * clone() const override { return new TraitInstType( *this ); } 560 virtual void accept( Visitor & v ) override { v.visit( this ); } 561 virtual void accept( Visitor & v ) const override { v.visit( this ); } 562 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 562 563 private: 563 564 virtual std::string typeString() const override; … … 569 570 // this decl is not "owned" by the type inst; it is merely a pointer to elsewhere in the tree, 570 571 // where the type used here is actually defined 571 TypeDecl * baseType;572 TypeDecl * baseType; 572 573 bool isFtype; 573 574 574 TypeInstType( const Type::Qualifiers & tq, const std::string & name, TypeDecl * baseType, const std::list< Attribute * > & attributes = std::list< Attribute * >() );575 TypeInstType( const Type::Qualifiers & tq, const std::string & name, TypeDecl * baseType, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 575 576 TypeInstType( const Type::Qualifiers & tq, const std::string & name, bool isFtype, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 576 577 TypeInstType( const TypeInstType & other ); 577 578 ~TypeInstType(); 578 579 579 TypeDecl * get_baseType() const { return baseType; }580 void set_baseType( TypeDecl * newValue );580 TypeDecl * get_baseType() const { return baseType; } 581 void set_baseType( TypeDecl * newValue ); 581 582 bool get_isFtype() const { return isFtype; } 582 583 void set_isFtype( bool newValue ) { isFtype = newValue; } … … 584 585 virtual bool isComplete() const override; 585 586 586 virtual TypeInstType * clone() const override { return new TypeInstType( *this ); }587 virtual void accept( Visitor & v ) override { v.visit( this ); } 588 virtual void accept( Visitor & v ) const override { v.visit( this ); } 589 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }587 virtual TypeInstType * clone() const override { return new TypeInstType( *this ); } 588 virtual void accept( Visitor & v ) override { v.visit( this ); } 589 virtual void accept( Visitor & v ) const override { v.visit( this ); } 590 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 590 591 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 591 592 private: … … 622 623 // virtual bool isComplete() const override { return true; } // xxx - not sure if this is right, might need to recursively check complete-ness 623 624 624 virtual TupleType * clone() const override { return new TupleType( *this ); }625 virtual void accept( Visitor & v ) override { v.visit( this ); } 626 virtual void accept( Visitor & v ) const override { v.visit( this ); } 627 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }625 virtual TupleType * clone() const override { return new TupleType( *this ); } 626 virtual void accept( Visitor & v ) override { v.visit( this ); } 627 virtual void accept( Visitor & v ) const override { v.visit( this ); } 628 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 628 629 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 629 630 }; … … 631 632 class TypeofType : public Type { 632 633 public: 633 Expression * expr;///< expression to take the type of634 bool is_basetypeof; 635 636 TypeofType( const Type::Qualifiers & tq, Expression * expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() );637 TypeofType( const Type::Qualifiers & tq, Expression * expr, bool is_basetypeof,634 Expression * expr; ///< expression to take the type of 635 bool is_basetypeof; ///< true iff is basetypeof type 636 637 TypeofType( const Type::Qualifiers & tq, Expression * expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 638 TypeofType( const Type::Qualifiers & tq, Expression * expr, bool is_basetypeof, 638 639 const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 639 640 TypeofType( const TypeofType& ); 640 641 virtual ~TypeofType(); 641 642 642 Expression * get_expr() const { return expr; }643 void set_expr( Expression * newValue ) { expr = newValue; }643 Expression * get_expr() const { return expr; } 644 void set_expr( Expression * newValue ) { expr = newValue; } 644 645 645 646 virtual bool isComplete() const override { assert( false ); return false; } 646 647 647 virtual TypeofType * clone() const override { return new TypeofType( *this ); }648 virtual void accept( Visitor & v ) override { v.visit( this ); } 649 virtual void accept( Visitor & v ) const override { v.visit( this ); } 650 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }648 virtual TypeofType * clone() const override { return new TypeofType( *this ); } 649 virtual void accept( Visitor & v ) override { v.visit( this ); } 650 virtual void accept( Visitor & v ) const override { v.visit( this ); } 651 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 651 652 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 652 653 }; … … 654 655 class VTableType : public Type { 655 656 public: 656 Type * base;657 658 VTableType( const Type::Qualifiers & tq, Type * base,657 Type * base; 658 659 VTableType( const Type::Qualifiers & tq, Type * base, 659 660 const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 660 661 VTableType( const VTableType & ); 661 662 virtual ~VTableType(); 662 663 663 Type * get_base() { return base; }664 void set_base( Type * newValue ) { base = newValue; }665 666 virtual VTableType * clone() const override { return new VTableType( *this ); }667 virtual void accept( Visitor & v ) override { v.visit( this ); } 668 virtual void accept( Visitor & v ) const override { v.visit( this ); } 669 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }664 Type * get_base() { return base; } 665 void set_base( Type * newValue ) { base = newValue; } 666 667 virtual VTableType * clone() const override { return new VTableType( *this ); } 668 virtual void accept( Visitor & v ) override { v.visit( this ); } 669 virtual void accept( Visitor & v ) const override { v.visit( this ); } 670 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 670 671 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 671 672 }; … … 674 675 public: 675 676 std::string name; 676 Expression * expr;677 Type * type;677 Expression * expr; 678 Type * type; 678 679 bool isType; 679 680 680 AttrType( const Type::Qualifiers & tq, const std::string & name, Expression * expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() );681 AttrType( const Type::Qualifiers & tq, const std::string & name, Type * type, const std::list< Attribute * > & attributes = std::list< Attribute * >() );681 AttrType( const Type::Qualifiers & tq, const std::string & name, Expression * expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 682 AttrType( const Type::Qualifiers & tq, const std::string & name, Type * type, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 682 683 AttrType( const AttrType& ); 683 684 virtual ~AttrType(); … … 685 686 const std::string & get_name() const { return name; } 686 687 void set_name( const std::string & newValue ) { name = newValue; } 687 Expression * get_expr() const { return expr; }688 void set_expr( Expression * newValue ) { expr = newValue; }689 Type * get_type() const { return type; }690 void set_type( Type * newValue ) { type = newValue; }688 Expression * get_expr() const { return expr; } 689 void set_expr( Expression * newValue ) { expr = newValue; } 690 Type * get_type() const { return type; } 691 void set_type( Type * newValue ) { type = newValue; } 691 692 bool get_isType() const { return isType; } 692 693 void set_isType( bool newValue ) { isType = newValue; } … … 694 695 virtual bool isComplete() const override { assert( false ); } // xxx - not sure what to do here 695 696 696 virtual AttrType * clone() const override { return new AttrType( *this ); }697 virtual void accept( Visitor & v ) override { v.visit( this ); } 698 virtual void accept( Visitor & v ) const override { v.visit( this ); } 699 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }697 virtual AttrType * clone() const override { return new AttrType( *this ); } 698 virtual void accept( Visitor & v ) override { v.visit( this ); } 699 virtual void accept( Visitor & v ) const override { v.visit( this ); } 700 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 700 701 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 701 702 }; … … 709 710 virtual bool isComplete() const override{ return true; } // xxx - is this right? 710 711 711 virtual VarArgsType * clone() const override { return new VarArgsType( *this ); }712 virtual void accept( Visitor & v ) override { v.visit( this ); } 713 virtual void accept( Visitor & v ) const override { v.visit( this ); } 714 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }712 virtual VarArgsType * clone() const override { return new VarArgsType( *this ); } 713 virtual void accept( Visitor & v ) override { v.visit( this ); } 714 virtual void accept( Visitor & v ) const override { v.visit( this ); } 715 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 715 716 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 716 717 }; … … 722 723 ZeroType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 723 724 724 virtual ZeroType * clone() const override { return new ZeroType( *this ); }725 virtual void accept( Visitor & v ) override { v.visit( this ); } 726 virtual void accept( Visitor & v ) const override { v.visit( this ); } 727 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }725 virtual ZeroType * clone() const override { return new ZeroType( *this ); } 726 virtual void accept( Visitor & v ) override { v.visit( this ); } 727 virtual void accept( Visitor & v ) const override { v.visit( this ); } 728 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 728 729 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 729 730 }; … … 735 736 OneType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 736 737 737 virtual OneType * clone() const override { return new OneType( *this ); }738 virtual void accept( Visitor & v ) override { v.visit( this ); } 739 virtual void accept( Visitor & v ) const override { v.visit( this ); } 740 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }738 virtual OneType * clone() const override { return new OneType( *this ); } 739 virtual void accept( Visitor & v ) override { v.visit( this ); } 740 virtual void accept( Visitor & v ) const override { v.visit( this ); } 741 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 741 742 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 742 743 }; … … 746 747 GlobalScopeType(); 747 748 748 virtual GlobalScopeType * clone() const override { return new GlobalScopeType( *this ); }749 virtual void accept( Visitor & v ) override { v.visit( this ); } 750 virtual void accept( Visitor & v ) const override { v.visit( this ); } 751 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); }749 virtual GlobalScopeType * clone() const override { return new GlobalScopeType( *this ); } 750 virtual void accept( Visitor & v ) override { v.visit( this ); } 751 virtual void accept( Visitor & v ) const override { v.visit( this ); } 752 virtual Type * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 752 753 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 753 754 };
Note:
See TracChangeset
for help on using the changeset viewer.