Changeset 2c57025 for src/SynTree
- Timestamp:
- Nov 25, 2016, 6:11:03 PM (8 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:
- 0f35657
- Parents:
- 186fd86
- Location:
- src/SynTree
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/ApplicationExpr.cc
r186fd86 r2c57025 30 30 if ( &other == this ) return *this; 31 31 decl = other.decl; 32 // xxx - this looks like a memory leak 32 33 actualType = maybeClone( other.actualType ); 33 34 formalType = maybeClone( other.formalType ); -
src/SynTree/Declaration.h
r186fd86 r2c57025 176 176 public: 177 177 enum Kind { Any, Dtype, Ftype }; 178 /// Data extracted from a type decl 179 struct Data { 180 TypeDecl::Kind kind; 181 bool isComplete; 182 Data() : kind( (TypeDecl::Kind)-1 ), isComplete( false ) {} 183 Data( TypeDecl * typeDecl ) : Data( typeDecl->get_kind(), typeDecl->isComplete() ) {} 184 Data( Kind kind, bool isComplete ) : kind( kind ), isComplete( isComplete ) {} 185 bool operator==(const Data & other) const { return kind == other.kind && isComplete == other.isComplete; } 186 bool operator!=(const Data & other) const { return !(*this == other);} 187 }; 178 188 179 189 TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ); … … 182 192 Kind get_kind() const { return kind; } 183 193 194 bool isComplete() const { return kind == Any || sized; } 195 bool get_sized() const { return sized; } 196 TypeDecl * set_sized( bool newValue ) { sized = newValue; return this; } 197 184 198 virtual TypeDecl *clone() const { return new TypeDecl( *this ); } 185 199 virtual void accept( Visitor &v ) { v.visit( this ); } … … 188 202 virtual std::string typeString() const; 189 203 Kind kind; 204 bool sized; 190 205 }; 191 206 … … 280 295 281 296 std::ostream & operator<<( std::ostream & out, const Declaration * decl ); 297 std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ); 282 298 283 299 #endif // DECLARATION_H -
src/SynTree/ReferenceToType.cc
r186fd86 r2c57025 128 128 } 129 129 130 TypeInstType::TypeInstType( const TypeInstType &other ) : Parent( other ), baseType( other.baseType ), isFtype( other.isFtype ) { 131 } 132 133 130 134 TypeInstType::~TypeInstType() { 131 135 // delete baseType; //This is shared and should not be deleted -
src/SynTree/Type.h
r186fd86 r2c57025 337 337 TypeInstType( const Type::Qualifiers &tq, const std::string &name, TypeDecl *baseType ); 338 338 TypeInstType( const Type::Qualifiers &tq, const std::string &name, bool isFtype ); 339 TypeInstType( const TypeInstType &other ) : Parent( other ), baseType( other.baseType ), isFtype( other.isFtype ) {}339 TypeInstType( const TypeInstType &other ); 340 340 ~TypeInstType(); 341 341 -
src/SynTree/TypeDecl.cc
r186fd86 r2c57025 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // TypeDecl.cc -- 7 // TypeDecl.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 18 18 #include "Common/utility.h" 19 19 20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ) {20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ), sized( kind == Any ) { 21 21 } 22 22 23 TypeDecl::TypeDecl( const TypeDecl &other ) : Parent( other ), kind( other.kind ) {23 TypeDecl::TypeDecl( const TypeDecl &other ) : Parent( other ), kind( other.kind ), sized( other.sized ) { 24 24 } 25 25 … … 29 29 } 30 30 31 std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ) { 32 return os << data.kind << ", " << data.isComplete; 33 } 34 31 35 // Local Variables: // 32 36 // tab-width: 4 //
Note: See TracChangeset
for help on using the changeset viewer.