Changeset 312029a for src/SynTree/Declaration.h
- Timestamp:
- Dec 11, 2019, 8:52:38 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 737c98a
- Parents:
- 98d6965d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Declaration.h
r98d6965d r312029a 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 : Thr May 2 10:47:00 201913 // Update Count : 1 3511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 11 16:48:20 2019 13 // Update Count : 149 14 14 // 15 15 … … 25 25 #include "Mutator.h" // for Mutator 26 26 #include "Parser/LinkageSpec.h" // for Spec, Cforall 27 #include "Parser/ParseNode.h" // for DeclarationNode, DeclarationNode::Ag...28 27 #include "SynTree.h" // for UniqueId 29 28 #include "SynTree/Type.h" // for Type, Type::StorageClasses, Type::Fu... … … 194 193 std::list< DeclarationWithType* >& get_assertions() { return assertions; } 195 194 196 virtual std::stringtypeString() const = 0;195 virtual const char * typeString() const = 0; 197 196 198 197 virtual NamedTypeDecl *clone() const override = 0; … … 237 236 TypeDecl * set_sized( bool newValue ) { sized = newValue; return this; } 238 237 239 virtual std::stringtypeString() const override;240 virtual std::stringgenTypeString() const;238 virtual const char * typeString() const override; 239 virtual const char * genTypeString() const; 241 240 242 241 virtual TypeDecl *clone() const override { return new TypeDecl( *this ); } … … 257 256 TypedefDecl( const TypedefDecl &other ) : Parent( other ) {} 258 257 259 virtual std::stringtypeString() const override;258 virtual const char * typeString() const override; 260 259 261 260 virtual TypedefDecl *clone() const override { return new TypedefDecl( *this ); } … … 269 268 typedef Declaration Parent; 270 269 public: 270 enum Aggregate { Struct, Union, Enum, Exception, Trait, Generator, Coroutine, Monitor, Thread, NoAggregate }; 271 static const char * aggrString( Aggregate aggr ); 272 271 273 std::list<Declaration*> members; 272 274 std::list<TypeDecl*> parameters; … … 291 293 virtual void printShort( std::ostream &os, Indenter indent = {} ) const override; 292 294 protected: 293 virtual std::stringtypeString() const = 0;295 virtual const char * typeString() const = 0; 294 296 }; 295 297 … … 297 299 typedef AggregateDecl Parent; 298 300 public: 299 StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ) {}301 StructDecl( const std::string &name, Aggregate kind = Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ) {} 300 302 StructDecl( const StructDecl &other ) : Parent( other ), kind( other.kind ) {} 301 303 302 bool is_coroutine() { return kind == DeclarationNode::Coroutine; }303 bool is_monitor() { return kind == DeclarationNode::Monitor; }304 bool is_thread() { return kind == DeclarationNode::Thread; }304 bool is_coroutine() { return kind == Coroutine; } 305 bool is_monitor() { return kind == Monitor; } 306 bool is_thread() { return kind == Thread; } 305 307 306 308 virtual StructDecl *clone() const override { return new StructDecl( *this ); } … … 308 310 virtual void accept( Visitor & v ) const override { v.visit( this ); } 309 311 virtual Declaration *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 310 DeclarationNode::Aggregate kind;311 private: 312 virtual std::stringtypeString() const override;312 Aggregate kind; 313 private: 314 virtual const char * typeString() const override; 313 315 }; 314 316 … … 324 326 virtual Declaration *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 325 327 private: 326 virtual std::stringtypeString() const override;328 virtual const char * typeString() const override; 327 329 }; 328 330 … … 341 343 private: 342 344 std::unordered_map< std::string, long long int > enumValues; 343 virtual std::stringtypeString() const override;345 virtual const char * typeString() const override; 344 346 }; 345 347 … … 357 359 virtual Declaration *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 358 360 private: 359 virtual std::stringtypeString() const override;361 virtual const char * typeString() const override; 360 362 }; 361 363
Note: See TracChangeset
for help on using the changeset viewer.