Changeset 777ed2b for src/SynTree


Ignore:
Timestamp:
Jul 11, 2018, 11:55:59 AM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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.
Message:

fix conflicts

Location:
src/SynTree
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.h

    rfc20514 r777ed2b  
    266266        bool body;
    267267        std::list< Attribute * > attributes;
     268        AggregateDecl * parent = nullptr;
    268269
    269270        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  
    101101        virtual Type * mutate( ArrayType * arrayType ) = 0;
    102102        virtual Type * mutate( ReferenceType * refType ) = 0;
     103        virtual Type * mutate( QualifiedType * qualType ) = 0;
    103104        virtual Type * mutate( FunctionType * functionType ) = 0;
    104105        virtual Type * mutate( StructInstType * aggregateUseType ) = 0;
     
    113114        virtual Type * mutate( ZeroType * zeroType ) = 0;
    114115        virtual Type * mutate( OneType * oneType ) = 0;
     116        virtual Type * mutate( GlobalScopeType * globalType ) = 0;
    115117
    116118        virtual Designation * mutate( Designation * designation ) = 0 ;
  • src/SynTree/ReferenceToType.cc

    rfc20514 r777ed2b  
    7676bool StructInstType::isComplete() const { return baseStruct ? baseStruct->has_body() : false; }
    7777
    78 AggregateDecl * StructInstType::getAggr() { return baseStruct; }
     78AggregateDecl * StructInstType::getAggr() const { return baseStruct; }
    7979
    8080TypeSubstitution StructInstType::genericSubstitution() const {
     
    119119bool UnionInstType::isComplete() const { return baseUnion ? baseUnion->has_body() : false; }
    120120
    121 AggregateDecl * UnionInstType::getAggr() { return baseUnion; }
     121AggregateDecl * UnionInstType::getAggr() const { return baseUnion; }
    122122
    123123TypeSubstitution UnionInstType::genericSubstitution() const {
     
    152152bool EnumInstType::isComplete() const { return baseEnum ? baseEnum->has_body() : false; }
    153153
     154AggregateDecl * EnumInstType::getAggr() const { return baseEnum; }
     155
    154156void EnumInstType::print( std::ostream &os, Indenter indent ) const {
    155157        using std::endl;
  • src/SynTree/SynTree.h

    rfc20514 r777ed2b  
    110110class ArrayType;
    111111class ReferenceType;
     112class QualifiedType;
    112113class FunctionType;
    113114class ReferenceToType;
     
    123124class ZeroType;
    124125class OneType;
     126class GlobalScopeType;
    125127
    126128class Designation;
  • src/SynTree/Type.cc

    rfc20514 r777ed2b  
    105105}
    106106
     107
     108QualifiedType::QualifiedType( const Type::Qualifiers & tq, Type * parent, Type * child ) : Type( tq, {} ), parent( parent ), child( child ) {
     109}
     110
     111QualifiedType::QualifiedType( const QualifiedType & other ) : Type( other ), parent( maybeClone( other.parent ) ), child( maybeClone( other.child ) ) {
     112}
     113
     114QualifiedType::~QualifiedType() {
     115        delete parent;
     116        delete child;
     117}
     118
     119void 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
     129GlobalScopeType::GlobalScopeType() : Type( Type::Qualifiers(), {} ) {}
     130
     131void GlobalScopeType::print( std::ostream & os, Indenter ) const {
     132        os << "Global Scope Type" << endl;
     133}
     134
     135
    107136// Empty Variable declarations:
    108137const Type::FuncSpecifiers noFuncSpecifiers;
  • src/SynTree/Type.h

    rfc20514 r777ed2b  
    178178        virtual bool isComplete() const { return true; }
    179179
    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 ) ); }
    181181
    182182        virtual TypeSubstitution genericSubstitution() const;
     
    315315};
    316316
     317class QualifiedType : public Type {
     318public:
     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
    317332class ReferenceType : public Type {
    318333public:
     
    416431        virtual bool isComplete() const override;
    417432
    418         virtual AggregateDecl * getAggr() override;
     433        virtual AggregateDecl * getAggr() const override;
    419434
    420435        virtual TypeSubstitution genericSubstitution() const override;
     
    453468        virtual bool isComplete() const override;
    454469
    455         virtual AggregateDecl * getAggr() override;
     470        virtual AggregateDecl * getAggr() const override;
    456471
    457472        virtual TypeSubstitution genericSubstitution() const override;
     
    485500
    486501        virtual bool isComplete() const override;
     502
     503        virtual AggregateDecl * getAggr() const override;
    487504
    488505        virtual EnumInstType *clone() const override { return new EnumInstType( *this ); }
     
    665682};
    666683
     684class 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
    667694// Local Variables: //
    668695// tab-width: 4 //
  • src/SynTree/Visitor.h

    rfc20514 r777ed2b  
    103103        virtual void visit( ArrayType * arrayType ) = 0;
    104104        virtual void visit( ReferenceType * refType ) = 0;
     105        virtual void visit( QualifiedType * qualType ) = 0;
    105106        virtual void visit( FunctionType * functionType ) = 0;
    106107        virtual void visit( StructInstType * aggregateUseType ) = 0;
     
    115116        virtual void visit( ZeroType * zeroType ) = 0;
    116117        virtual void visit( OneType * oneType ) = 0;
     118        virtual void visit( GlobalScopeType * globalType ) = 0;
    117119
    118120        virtual void visit( Designation * designation ) = 0;
Note: See TracChangeset for help on using the changeset viewer.