Changeset 10a1225 for src/AST/Node.cpp


Ignore:
Timestamp:
May 17, 2019, 12:09:51 PM (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:
896737b
Parents:
77bfc80
Message:

Many errors and warning fixes.
More visit implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Node.cpp

    r77bfc80 r10a1225  
    1616#include "Node.hpp"
    1717#include "Fwd.hpp"
     18
     19#include "Attribute.hpp"
    1820#include "Decl.hpp"
    1921#include "Expr.hpp"
     22#include "Init.hpp"
    2023#include "Stmt.hpp"
    2124#include "Type.hpp"
     25#include "TypeSubstitution.hpp"
    2226
    2327template< typename node_t, enum ast::Node::ref_type ref_t >
     
    2630template< typename node_t, enum ast::Node::ref_type ref_t >
    2731void ast::ptr_base<node_t, ref_t>::_dec( const node_t * node ) { node->decrement(ref_t); }
     32
     33/// Sets this pointer to a mutated version of a pointer (possibly) owned elsehere.
     34/// Returns a mutable version of the pointer in this node.
     35template< typename node_t, enum ast::Node::ref_type ref_t >
     36node_t * ast::ptr_base<node_t, ref_t>::set_and_mutate( const node_t * n ) {
     37        // ensure ownership of `n` by this node to avoid spurious single-owner mutates
     38        assign( n );
     39        // get mutable version of `n`
     40        auto r = mutate( node );
     41        // re-assign mutable version in case `mutate()` produced a new pointer
     42        assign( r );
     43        return r;
     44}
    2845
    2946template class ast::ptr_base< ast::Node, ast::Node::ref_type::weak >;
     
    227244template class ast::ptr_base< ast::ConstructorInit, ast::Node::ref_type::weak >;
    228245template class ast::ptr_base< ast::ConstructorInit, ast::Node::ref_type::strong >;
    229 template class ast::ptr_base< ast::Constant, ast::Node::ref_type::weak >;
    230 template class ast::ptr_base< ast::Constant, ast::Node::ref_type::strong >;
    231246template class ast::ptr_base< ast::Attribute, ast::Node::ref_type::weak >;
    232247template class ast::ptr_base< ast::Attribute, ast::Node::ref_type::strong >;
Note: See TracChangeset for help on using the changeset viewer.