Changeset 6d51bd7 for src/AST/Decl.hpp


Ignore:
Timestamp:
May 15, 2019, 10:15:44 AM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
be567e9
Parents:
712348a
Message:

Fixes to the new templated pass and started on conversions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.hpp

    r712348a r6d51bd7  
    5757        static readonly<Decl> fromId( UniqueId id );
    5858
    59         virtual Decl* accept( Visitor& v ) override = 0;
    60 private:
    61         virtual Decl* clone() const override = 0;
     59        virtual const Decl * accept( Visitor & v ) const override = 0;
     60private:
     61        virtual Decl * clone() const override = 0;
    6262};
    6363
     
    8585
    8686        /// Get type of this declaration. May be generated by subclass
    87         virtual const Type* get_type() const = 0;
     87        virtual const Type * get_type() const = 0;
    8888        /// Set type of this declaration. May be verified by subclass
    8989        virtual void set_type(Type*) = 0;
    9090
    91         virtual DeclWithType* accept( Visitor& v ) override = 0;
    92 private:
    93         virtual DeclWithType* clone() const override = 0;
     91        virtual const DeclWithType * accept( Visitor & v ) const override = 0;
     92private:
     93        virtual DeclWithType * clone() const override = 0;
    9494};
    9595
     
    110110        void set_type( Type* ty ) override { type = ty; }
    111111
    112         DeclWithType* accept( Visitor& v ) override { return v.visit( this ); }
    113 private:
    114         ObjectDecl* clone() const override { return new ObjectDecl{ *this }; }
     112        virtual const DeclWithType * accept( Visitor& v ) const override { return v.visit( this ); }
     113private:
     114        virtual ObjectDecl * clone() const override { return new ObjectDecl{ *this }; }
     115
     116        /// Must be copied in ALL derived classes
     117        template<typename node_t>
     118        friend auto mutate(const node_t * node);
    115119};
    116120
     
    166170        std::string genTypeString() const;
    167171
    168         Decl* accept( Visitor& v ) override { return v.visit( this ); }
    169 private:
    170         TypeDecl* clone() const override { return new TypeDecl{ *this }; }
     172        virtual const Decl * accept( Visitor & v ) const override { return v.visit( this ); }
     173private:
     174        virtual TypeDecl * clone() const override { return new TypeDecl{ *this }; }
    171175};
    172176
     
    180184        std::string typeString() const override { return "typedef"; }
    181185
    182         Decl* accept( Visitor& v ) override { return v.visit( this ); }
    183 private:
    184         TypedefDecl* clone() const override { return new TypedefDecl{ *this }; }
     186        virtual const Decl * accept( Visitor & v ) const override { return v.visit( this ); }
     187private:
     188        virtual TypedefDecl * clone() const override { return new TypedefDecl{ *this }; }
    185189};
    186190
     
    220224        bool is_thread() { return kind == DeclarationNode::Thread; }
    221225
    222         Decl* accept( Visitor& v ) override { return v.visit( this ); }
    223 private:
    224         StructDecl* clone() const override { return new StructDecl{ *this }; }
     226        virtual const Decl * accept( Visitor & v ) const override { return v.visit( this ); }
     227private:
     228        virtual StructDecl * clone() const override { return new StructDecl{ *this }; }
    225229
    226230        std::string typeString() const override { return "struct"; }
     
    234238        : AggregateDecl( loc, name, std::move(attrs), linkage ) {}
    235239
    236         Decl* accept( Visitor& v ) override { return v.visit( this ); }
    237 private:
    238         UnionDecl* clone() const override { return new UnionDecl{ *this }; }
     240        virtual const Decl * accept( Visitor& v ) const override { return v.visit( this ); }
     241private:
     242        virtual UnionDecl * clone() const override { return new UnionDecl{ *this }; }
    239243
    240244        std::string typeString() const override { return "union"; }
     
    251255        bool valueOf( Decl* enumerator, long long& value ) const;
    252256
    253         Decl* accept( Visitor& v ) override { return v.visit( this ); }
    254 private:
    255         EnumDecl* clone() const override { return new EnumDecl{ *this }; }
     257        virtual const Decl * accept( Visitor & v ) const override { return v.visit( this ); }
     258private:
     259        virtual EnumDecl * clone() const override { return new EnumDecl{ *this }; }
    256260
    257261        std::string typeString() const override { return "enum"; }
     
    268272        : AggregateDecl( loc, name, std::move(attrs), linkage ) {}
    269273
    270         Decl* accept( Visitor& v ) override { return v.visit( this ); }
    271 private:
    272         TraitDecl* clone() const override { return new TraitDecl{ *this }; }
     274        virtual const Decl * accept( Visitor & v ) const override { return v.visit( this ); }
     275private:
     276        virtual TraitDecl * clone() const override { return new TraitDecl{ *this }; }
    273277
    274278        std::string typeString() const override { return "trait"; }
     
    287291inline void increment( const class ObjectDecl * node, Node::ref_type ref ) { node->increment(ref); }
    288292inline void decrement( const class ObjectDecl * node, Node::ref_type ref ) { node->decrement(ref); }
    289 inline void increment( const class FunctionDecl * node, Node::ref_type ref ) { node->increment(ref); }
    290 inline void decrement( const class FunctionDecl * node, Node::ref_type ref ) { node->decrement(ref); }
     293// inline void increment( const class FunctionDecl * node, Node::ref_type ref ) { node->increment(ref); }
     294// inline void decrement( const class FunctionDecl * node, Node::ref_type ref ) { node->decrement(ref); }
    291295inline void increment( const class AggregateDecl * node, Node::ref_type ref ) { node->increment(ref); }
    292296inline void decrement( const class AggregateDecl * node, Node::ref_type ref ) { node->decrement(ref); }
     
    303307inline void increment( const class TypeDecl * node, Node::ref_type ref ) { node->increment(ref); }
    304308inline void decrement( const class TypeDecl * node, Node::ref_type ref ) { node->decrement(ref); }
    305 inline void increment( const class FtypeDecl * node, Node::ref_type ref ) { node->increment(ref); }
    306 inline void decrement( const class FtypeDecl * node, Node::ref_type ref ) { node->decrement(ref); }
    307 inline void increment( const class DtypeDecl * node, Node::ref_type ref ) { node->increment(ref); }
    308 inline void decrement( const class DtypeDecl * node, Node::ref_type ref ) { node->decrement(ref); }
     309// inline void increment( const class FtypeDecl * node, Node::ref_type ref ) { node->increment(ref); }
     310// inline void decrement( const class FtypeDecl * node, Node::ref_type ref ) { node->decrement(ref); }
     311// inline void increment( const class DtypeDecl * node, Node::ref_type ref ) { node->increment(ref); }
     312// inline void decrement( const class DtypeDecl * node, Node::ref_type ref ) { node->decrement(ref); }
    309313inline void increment( const class TypedefDecl * node, Node::ref_type ref ) { node->increment(ref); }
    310314inline void decrement( const class TypedefDecl * node, Node::ref_type ref ) { node->decrement(ref); }
    311 inline void increment( const class AsmDecl * node, Node::ref_type ref ) { node->increment(ref); }
    312 inline void decrement( const class AsmDecl * node, Node::ref_type ref ) { node->decrement(ref); }
    313 inline void increment( const class StaticAssertDecl * node, Node::ref_type ref ) { node->increment(ref); }
    314 inline void decrement( const class StaticAssertDecl * node, Node::ref_type ref ) { node->decrement(ref); }
     315// inline void increment( const class AsmDecl * node, Node::ref_type ref ) { node->increment(ref); }
     316// inline void decrement( const class AsmDecl * node, Node::ref_type ref ) { node->decrement(ref); }
     317// inline void increment( const class StaticAssertDecl * node, Node::ref_type ref ) { node->increment(ref); }
     318// inline void decrement( const class StaticAssertDecl * node, Node::ref_type ref ) { node->decrement(ref); }
    315319
    316320}
Note: See TracChangeset for help on using the changeset viewer.