Changeset 10a1225 for src/AST/Node.cpp
- Timestamp:
- May 17, 2019, 12:09:51 PM (5 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Node.cpp
r77bfc80 r10a1225 16 16 #include "Node.hpp" 17 17 #include "Fwd.hpp" 18 19 #include "Attribute.hpp" 18 20 #include "Decl.hpp" 19 21 #include "Expr.hpp" 22 #include "Init.hpp" 20 23 #include "Stmt.hpp" 21 24 #include "Type.hpp" 25 #include "TypeSubstitution.hpp" 22 26 23 27 template< typename node_t, enum ast::Node::ref_type ref_t > … … 26 30 template< typename node_t, enum ast::Node::ref_type ref_t > 27 31 void 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. 35 template< typename node_t, enum ast::Node::ref_type ref_t > 36 node_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 } 28 45 29 46 template class ast::ptr_base< ast::Node, ast::Node::ref_type::weak >; … … 227 244 template class ast::ptr_base< ast::ConstructorInit, ast::Node::ref_type::weak >; 228 245 template 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 >;231 246 template class ast::ptr_base< ast::Attribute, ast::Node::ref_type::weak >; 232 247 template class ast::ptr_base< ast::Attribute, ast::Node::ref_type::strong >;
Note: See TracChangeset
for help on using the changeset viewer.