Changeset 4eb43fa
- Timestamp:
- Jul 22, 2019, 4:23:33 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 96ac72c
- Parents:
- f53acdf8 (diff), f6cc734e (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. - Location:
- src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Attribute.hpp
rf53acdf8 r4eb43fa 51 51 template<typename node_t> 52 52 friend node_t * mutate(const node_t * node); 53 template<typename node_t> 54 friend node_t * shallowCopy(const node_t * node); 53 55 }; 54 56 -
src/AST/Convert.cpp
rf53acdf8 r4eb43fa 608 608 609 609 tgt->result = get<Type>().accept1(src->result); 610 // Unconditionally use a clone of the result type. 611 // We know this will leak some objects: much of the immediate conversion result. 612 // In some cases, using the conversion result directly gives unintended object sharing. 613 // A parameter (ObjectDecl, a child of a FunctionType) is shared by the weak-ref cache. 614 // But tgt->result must be fully owned privately by tgt. 615 // Applying these conservative copies here means 616 // - weak references point at the declaration's copy, not these expr.result copies (good) 617 // - we copy more objects than really needed (bad, tolerated) 618 if (tgt->result) { 619 tgt->result = tgt->result->clone(); 620 } 610 621 return visitBaseExpr_skipResultType(src, tgt); 611 622 } -
src/AST/Copy.hpp
rf53acdf8 r4eb43fa 23 23 24 24 template<typename node_t> 25 const node_t * shallowCopy( const node_t * node ) { 25 node_t * shallowCopy( const node_t * node ); 26 26 /* Create a shallow copy of the node given. 27 27 * … … 31 31 32 32 template<typename node_t> 33 node_t * deepCopy( node_t const * localRoot );33 node_t * deepCopy( const node_t * localRoot ); 34 34 /* Create a deep copy of the tree rooted at localRoot. 35 35 * … … 106 106 107 107 template<typename node_t> 108 node_t * shallowCopy( node_t const * localRoot ) {108 node_t * shallowCopy( const node_t * localRoot ) { 109 109 return localRoot->clone(); 110 110 } 111 111 112 112 template<typename node_t> 113 node_t * deepCopy( node_t const * localRoot ) {113 node_t * deepCopy( const node_t * localRoot ) { 114 114 Pass< DeepCopyCore > dc; 115 115 node_t const * newRoot = localRoot->accept( dc ); -
src/AST/Decl.hpp
rf53acdf8 r4eb43fa 32 32 33 33 // Must be included in *all* AST classes; should be #undef'd at the end of the file 34 #define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node); 34 #define MUTATE_FRIEND \ 35 template<typename node_t> friend node_t * mutate(const node_t * node); \ 36 template<typename node_t> friend node_t * shallowCopy(const node_t * node); 35 37 36 38 namespace ast { -
src/AST/Expr.hpp
rf53acdf8 r4eb43fa 30 30 31 31 // Must be included in *all* AST classes; should be #undef'd at the end of the file 32 #define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node); 32 #define MUTATE_FRIEND \ 33 template<typename node_t> friend node_t * mutate(const node_t * node); \ 34 template<typename node_t> friend node_t * shallowCopy(const node_t * node); 35 33 36 34 37 class ConverterOldToNew; -
src/AST/Init.hpp
rf53acdf8 r4eb43fa 25 25 26 26 // Must be included in *all* AST classes; should be #undef'd at the end of the file 27 #define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node); 27 #define MUTATE_FRIEND \ 28 template<typename node_t> friend node_t * mutate(const node_t * node); \ 29 template<typename node_t> friend node_t * shallowCopy(const node_t * node); 28 30 29 31 namespace ast { -
src/AST/Node.hpp
rf53acdf8 r4eb43fa 57 57 template<typename node_t> 58 58 friend node_t * mutate(const node_t * node); 59 template<typename node_t> 60 friend node_t * shallowCopy(const node_t * node); 59 61 60 62 mutable size_t strong_count = 0; -
src/AST/Stmt.hpp
rf53acdf8 r4eb43fa 27 27 28 28 // Must be included in *all* AST classes; should be #undef'd at the end of the file 29 #define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node); 29 #define MUTATE_FRIEND \ 30 template<typename node_t> friend node_t * mutate(const node_t * node); \ 31 template<typename node_t> friend node_t * shallowCopy(const node_t * node); 30 32 31 33 namespace ast { -
src/AST/Type.hpp
rf53acdf8 r4eb43fa 30 30 31 31 // Must be included in *all* AST classes; should be #undef'd at the end of the file 32 #define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node); 32 #define MUTATE_FRIEND \ 33 template<typename node_t> friend node_t * mutate(const node_t * node); \ 34 template<typename node_t> friend node_t * shallowCopy(const node_t * node); 33 35 34 36 namespace ast { -
src/ResolvExpr/RenameVars.cc
rf53acdf8 r4eb43fa 30 30 #include "SynTree/Type.h" // for Type, TypeInstType, TraitInstType 31 31 #include "SynTree/Visitor.h" // for acceptAll, maybeAccept 32 33 #include "AST/Copy.hpp" 32 34 33 35 namespace ResolvExpr { … … 172 174 173 175 const ast::Type * renameTyVars( const ast::Type * t ) { 176 ast::Type *tc = ast::deepCopy(t); 174 177 ast::Pass<RenameVars_new> renamer; 175 return t->accept( renamer ); 178 // return t->accept( renamer ); 179 return tc->accept( renamer ); 176 180 } 177 181
Note: See TracChangeset
for help on using the changeset viewer.