Ignore:
Timestamp:
Sep 1, 2020, 1:18:10 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
86c1f1c3, a77496cb
Parents:
8d8ac3b (diff), d3aa64f1 (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:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.impl.hpp

    r8d8ac3b r25a1cb0  
    2121
    2222#include "AST/TypeSubstitution.hpp"
     23// #include "AST/Copy.hpp"
    2324
    2425#define VISIT_START( node ) \
     
    5758
    5859namespace ast {
     60        template<typename node_t>
     61        node_t * shallowCopy( const node_t * node );
     62
    5963        namespace __pass {
    6064                // Check if this is either a null pointer or a pointer to an empty container
     
    6266                static inline bool empty( T * ptr ) {
    6367                        return !ptr || ptr->empty();
     68                }
     69
     70                template< typename core_t, typename node_t >
     71                static inline node_t* mutate(const node_t *node) {
     72                        return std::is_base_of<PureVisitor, core_t>::value ? ::ast::shallowCopy(node) : ::ast::mutate(node);
    6473                }
    6574
     
    320329
    321330                if( __pass::differs(old_val, new_val) ) {
    322                         auto new_parent = mutate(parent);
     331                        // auto new_parent = mutate(parent);
     332                        auto new_parent = __pass::mutate<core_t>(parent);
    323333                        new_parent->*child = new_val;
    324334                        parent = new_parent;
     
    334344                        if ( node->forall.empty() ) return;
    335345
    336                         node_t * mut = mutate( node );
     346                        node_t * mut = __pass::mutate<core_t>( node );
    337347                        mut->forall = subs->clone( node->forall, *this );
    338348                        node = mut;
     
    894904
    895905                if(mutated) {
    896                         auto n = mutate(node);
     906                        auto n = __pass::mutate<core_t>(node);
    897907                        n->clauses = std::move( new_clauses );
    898908                        node = n;
     
    904914                        auto nval = call_accept( node->field ); \
    905915                        if(nval != node->field ) { \
    906                                 auto nparent = mutate(node); \
     916                                auto nparent = __pass::mutate<core_t>(node); \
    907917                                nparent->field = nval; \
    908918                                node = nparent; \
     
    16101620
    16111621                if(mutated) {
    1612                         auto n = mutate(node);
     1622                        auto n = __pass::mutate<core_t>(node);
    16131623                        n->associations = std::move( new_kids );
    16141624                        node = n;
     
    19401950                        }
    19411951                        if (mutated) {
    1942                                 auto new_node = mutate( node );
     1952                                auto new_node = __pass::mutate<core_t>( node );
    19431953                                new_node->typeEnv.swap( new_map );
    19441954                                node = new_node;
     
    19561966                        }
    19571967                        if (mutated) {
    1958                                 auto new_node = mutate( node );
     1968                                auto new_node = __pass::mutate<core_t>( node );
    19591969                                new_node->varEnv.swap( new_map );
    19601970                                node = new_node;
Note: See TracChangeset for help on using the changeset viewer.