Changeset f3cc5b6 for src/AST/Init.hpp


Ignore:
Timestamp:
May 16, 2019, 2:33:48 PM (5 years ago)
Author:
Aaron Moss <a3moss@…>
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:
204358b, 9b4f329
Parents:
24afc53
Message:

Ensure all node types have mutate() as friend

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Init.hpp

    r24afc53 rf3cc5b6  
    2323#include "Visitor.hpp"
    2424
     25// Must be included in *all* AST classes; should be #undef'd at the end of the file
     26#define MUTATE_FRIEND template<typename node_t> friend auto mutate(const node_t * node);
     27
    2528namespace ast {
    2629
     
    4043private:
    4144        Designation* clone() const override { return new Designation{ *this }; }
     45        MUTATE_FRIEND
    4246};
    4347
     
    5559private:
    5660        const Init * clone() const override = 0;
     61        MUTATE_FRIEND
    5762};
    5863
     
    6974private:
    7075        SingleInit * clone() const override { return new SingleInit{ *this }; }
    71 
    72         /// Must be copied in ALL derived classes
    73         template<typename node_t>
    74         friend auto mutate(const node_t * node);
     76        MUTATE_FRIEND
    7577};
    7678
     
    9799private:
    98100        ListInit * clone() const override { return new ListInit{ *this }; }
    99 
    100         /// Must be copied in ALL derived classes
    101         template<typename node_t>
    102         friend auto mutate(const node_t * node);
     101        MUTATE_FRIEND
    103102};
    104103
     
    120119private:
    121120        ConstructorInit * clone() const override { return new ConstructorInit{ *this }; }
    122 
    123         /// Must be copied in ALL derived classes
    124         template<typename node_t>
    125         friend auto mutate(const node_t * node);
     121        MUTATE_FRIEND
    126122};
    127123
     
    142138}
    143139
     140#undef MUTATE_FRIEND
     141
    144142// Local Variables: //
    145143// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.