Changeset 1f44196 for src/SynTree/Type.h
- Timestamp:
- Nov 29, 2016, 3:30:59 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 8e5724e
- Parents:
- 3a2128f (diff), 9129a84 (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
r3a2128f r1f44196 20 20 #include "Visitor.h" 21 21 #include "Mutator.h" 22 #include "Common/utility.h" 22 23 23 24 class Type { … … 27 28 Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic, bool isAttribute ): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ), isAttribute( isAttribute ) {} 28 29 30 Qualifiers &operator&=( const Qualifiers &other ); 29 31 Qualifiers &operator+=( const Qualifiers &other ); 30 32 Qualifiers &operator-=( const Qualifiers &other ); … … 63 65 void set_isAtomic( bool newValue ) { tq.isAtomic = newValue; } 64 66 void set_isAttribute( bool newValue ) { tq.isAttribute = newValue; } 65 std::list<TypeDecl*>& get_forall() { return forall; } 67 68 typedef std::list<TypeDecl *> ForallList; 69 ForallList& get_forall() { return forall; } 70 71 /// How many elemental types are represented by this type 72 virtual unsigned size() const { return 1; }; 73 virtual bool isVoid() const { return size() == 0; } 66 74 67 75 virtual Type *clone() const = 0; … … 71 79 private: 72 80 Qualifiers tq; 73 std::list<TypeDecl*>forall;81 ForallList forall; 74 82 }; 75 83 … … 77 85 public: 78 86 VoidType( const Type::Qualifiers &tq ); 87 88 virtual unsigned size() const { return 0; }; 79 89 80 90 virtual VoidType *clone() const { return new VoidType( *this ); } … … 234 244 public: 235 245 StructInstType( const Type::Qualifiers &tq, const std::string &name ) : Parent( tq, name ), baseStruct( 0 ) {} 246 StructInstType( const Type::Qualifiers &tq, StructDecl * baseStruct ); 236 247 StructInstType( const StructInstType &other ) : Parent( other ), baseStruct( other.baseStruct ) {} 237 248 … … 348 359 class TupleType : public Type { 349 360 public: 350 TupleType( const Type::Qualifiers &tq );361 TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types = std::list< Type * >() ); 351 362 TupleType( const TupleType& ); 352 363 virtual ~TupleType(); 353 364 365 typedef std::list<Type*> value_type; 366 typedef value_type::iterator iterator; 367 354 368 std::list<Type*>& get_types() { return types; } 369 virtual unsigned size() const { return types.size(); }; 370 371 iterator begin() { return types.begin(); } 372 iterator end() { return types.end(); } 355 373 356 374 virtual TupleType *clone() const { return new TupleType( *this ); } … … 442 460 }; 443 461 462 inline Type::Qualifiers &Type::Qualifiers::operator&=( const Type::Qualifiers &other ) { 463 isConst &= other.isConst; 464 isVolatile &= other.isVolatile; 465 isRestrict &= other.isRestrict; 466 isLvalue &= other.isLvalue; 467 isAtomic &= other.isAtomic; 468 return *this; 469 } 470 444 471 inline Type::Qualifiers &Type::Qualifiers::operator+=( const Type::Qualifiers &other ) { 445 472 isConst |= other.isConst;
Note:
See TracChangeset
for help on using the changeset viewer.