Changeset 777ed2b for src/SynTree
- Timestamp:
- Jul 11, 2018, 11:55:59 AM (7 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, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 0fc52b6
- Parents:
- fc20514 (diff), 7de22b28 (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. - Location:
- src/SynTree
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Declaration.h
rfc20514 r777ed2b 266 266 bool body; 267 267 std::list< Attribute * > attributes; 268 AggregateDecl * parent = nullptr; 268 269 269 270 AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ); -
src/SynTree/Mutator.h
rfc20514 r777ed2b 101 101 virtual Type * mutate( ArrayType * arrayType ) = 0; 102 102 virtual Type * mutate( ReferenceType * refType ) = 0; 103 virtual Type * mutate( QualifiedType * qualType ) = 0; 103 104 virtual Type * mutate( FunctionType * functionType ) = 0; 104 105 virtual Type * mutate( StructInstType * aggregateUseType ) = 0; … … 113 114 virtual Type * mutate( ZeroType * zeroType ) = 0; 114 115 virtual Type * mutate( OneType * oneType ) = 0; 116 virtual Type * mutate( GlobalScopeType * globalType ) = 0; 115 117 116 118 virtual Designation * mutate( Designation * designation ) = 0 ; -
src/SynTree/ReferenceToType.cc
rfc20514 r777ed2b 76 76 bool StructInstType::isComplete() const { return baseStruct ? baseStruct->has_body() : false; } 77 77 78 AggregateDecl * StructInstType::getAggr() { return baseStruct; }78 AggregateDecl * StructInstType::getAggr() const { return baseStruct; } 79 79 80 80 TypeSubstitution StructInstType::genericSubstitution() const { … … 119 119 bool UnionInstType::isComplete() const { return baseUnion ? baseUnion->has_body() : false; } 120 120 121 AggregateDecl * UnionInstType::getAggr() { return baseUnion; }121 AggregateDecl * UnionInstType::getAggr() const { return baseUnion; } 122 122 123 123 TypeSubstitution UnionInstType::genericSubstitution() const { … … 152 152 bool EnumInstType::isComplete() const { return baseEnum ? baseEnum->has_body() : false; } 153 153 154 AggregateDecl * EnumInstType::getAggr() const { return baseEnum; } 155 154 156 void EnumInstType::print( std::ostream &os, Indenter indent ) const { 155 157 using std::endl; -
src/SynTree/SynTree.h
rfc20514 r777ed2b 110 110 class ArrayType; 111 111 class ReferenceType; 112 class QualifiedType; 112 113 class FunctionType; 113 114 class ReferenceToType; … … 123 124 class ZeroType; 124 125 class OneType; 126 class GlobalScopeType; 125 127 126 128 class Designation; -
src/SynTree/Type.cc
rfc20514 r777ed2b 105 105 } 106 106 107 108 QualifiedType::QualifiedType( const Type::Qualifiers & tq, Type * parent, Type * child ) : Type( tq, {} ), parent( parent ), child( child ) { 109 } 110 111 QualifiedType::QualifiedType( const QualifiedType & other ) : Type( other ), parent( maybeClone( other.parent ) ), child( maybeClone( other.child ) ) { 112 } 113 114 QualifiedType::~QualifiedType() { 115 delete parent; 116 delete child; 117 } 118 119 void QualifiedType::print( std::ostream & os, Indenter indent ) const { 120 os << "Qualified Type: " << endl; 121 os << indent+1; 122 parent->print( os, indent+1 ); 123 os << endl << indent+1; 124 child->print( os, indent+1 ); 125 os << endl; 126 Type::print( os, indent+1 ); 127 } 128 129 GlobalScopeType::GlobalScopeType() : Type( Type::Qualifiers(), {} ) {} 130 131 void GlobalScopeType::print( std::ostream & os, Indenter ) const { 132 os << "Global Scope Type" << endl; 133 } 134 135 107 136 // Empty Variable declarations: 108 137 const Type::FuncSpecifiers noFuncSpecifiers; -
src/SynTree/Type.h
rfc20514 r777ed2b 178 178 virtual bool isComplete() const { return true; } 179 179 180 virtual AggregateDecl * getAggr() { assertf( false, "Non-aggregate type: %s", toCString( this ) ); }180 virtual AggregateDecl * getAggr() const { assertf( false, "Non-aggregate type: %s", toCString( this ) ); } 181 181 182 182 virtual TypeSubstitution genericSubstitution() const; … … 315 315 }; 316 316 317 class QualifiedType : public Type { 318 public: 319 Type * parent; 320 Type * child; 321 322 QualifiedType( const Type::Qualifiers & tq, Type * parent, Type * child ); 323 QualifiedType( const QualifiedType & tq ); 324 virtual ~QualifiedType(); 325 326 virtual QualifiedType *clone() const override { return new QualifiedType( *this ); } 327 virtual void accept( Visitor & v ) override { v.visit( this ); } 328 virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); } 329 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 330 }; 331 317 332 class ReferenceType : public Type { 318 333 public: … … 416 431 virtual bool isComplete() const override; 417 432 418 virtual AggregateDecl * getAggr() override;433 virtual AggregateDecl * getAggr() const override; 419 434 420 435 virtual TypeSubstitution genericSubstitution() const override; … … 453 468 virtual bool isComplete() const override; 454 469 455 virtual AggregateDecl * getAggr() override;470 virtual AggregateDecl * getAggr() const override; 456 471 457 472 virtual TypeSubstitution genericSubstitution() const override; … … 485 500 486 501 virtual bool isComplete() const override; 502 503 virtual AggregateDecl * getAggr() const override; 487 504 488 505 virtual EnumInstType *clone() const override { return new EnumInstType( *this ); } … … 665 682 }; 666 683 684 class GlobalScopeType : public Type { 685 public: 686 GlobalScopeType(); 687 688 virtual GlobalScopeType *clone() const override { return new GlobalScopeType( *this ); } 689 virtual void accept( Visitor & v ) override { v.visit( this ); } 690 virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); } 691 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 692 }; 693 667 694 // Local Variables: // 668 695 // tab-width: 4 // -
src/SynTree/Visitor.h
rfc20514 r777ed2b 103 103 virtual void visit( ArrayType * arrayType ) = 0; 104 104 virtual void visit( ReferenceType * refType ) = 0; 105 virtual void visit( QualifiedType * qualType ) = 0; 105 106 virtual void visit( FunctionType * functionType ) = 0; 106 107 virtual void visit( StructInstType * aggregateUseType ) = 0; … … 115 116 virtual void visit( ZeroType * zeroType ) = 0; 116 117 virtual void visit( OneType * oneType ) = 0; 118 virtual void visit( GlobalScopeType * globalType ) = 0; 117 119 118 120 virtual void visit( Designation * designation ) = 0;
Note:
See TracChangeset
for help on using the changeset viewer.