- Timestamp:
- May 22, 2019, 5:23:02 PM (6 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:
- 722c4831
- Parents:
- 76ed81f (diff), ef5ef56 (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:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r76ed81f r893e106 1342 1342 }; 1343 1343 1344 std::list< Declaration * > convert( std::list< ast::ptr< ast::Decl > > && translationUnit ) {1344 std::list< Declaration * > convert( const std::list< ast::ptr< ast::Decl > > && translationUnit ) { 1345 1345 ConverterNewToOld c; 1346 1346 std::list< Declaration * > decls; 1347 1347 for(auto d : translationUnit) { 1348 1348 decls.emplace_back( c.decl( d ) ); 1349 delete d;1350 1349 } 1351 1350 return decls; … … 1436 1435 { old->get_funcSpec().val } 1437 1436 ); 1437 cache.emplace( old, decl ); 1438 1438 decl->scopeLevel = old->scopeLevel; 1439 1439 decl->mangleName = old->mangleName; … … 1441 1441 decl->uniqueId = old->uniqueId; 1442 1442 decl->extension = old->extension; 1443 cache.emplace( old, decl );1444 1443 1445 1444 this->node = decl; … … 1458 1457 { old->get_funcSpec().val } 1459 1458 }; 1459 cache.emplace( old, decl ); 1460 1460 decl->scopeLevel = old->scopeLevel; 1461 1461 decl->mangleName = old->mangleName; … … 1463 1463 decl->uniqueId = old->uniqueId; 1464 1464 decl->extension = old->extension; 1465 cache.emplace( old, decl );1466 1465 1467 1466 this->node = decl; … … 1477 1476 { old->linkage.val } 1478 1477 ); 1478 cache.emplace( old, decl ); 1479 1479 decl->parent = GET_ACCEPT_1(parent, AggregateDecl); 1480 1480 decl->body = old->body; … … 1484 1484 decl->uniqueId = old->uniqueId; 1485 1485 decl->storage = { old->storageClasses.val }; 1486 cache.emplace( old, decl );1487 1486 1488 1487 this->node = decl; … … 1497 1496 { old->linkage.val } 1498 1497 ); 1498 cache.emplace( old, decl ); 1499 1499 decl->parent = GET_ACCEPT_1(parent, AggregateDecl); 1500 1500 decl->body = old->body; … … 1504 1504 decl->uniqueId = old->uniqueId; 1505 1505 decl->storage = { old->storageClasses.val }; 1506 cache.emplace( old, decl );1507 1506 1508 1507 this->node = decl; … … 1517 1516 { old->linkage.val } 1518 1517 ); 1518 cache.emplace( old, decl ); 1519 1519 decl->parent = GET_ACCEPT_1(parent, AggregateDecl); 1520 1520 decl->body = old->body; … … 1524 1524 decl->uniqueId = old->uniqueId; 1525 1525 decl->storage = { old->storageClasses.val }; 1526 cache.emplace( old, decl );1527 1526 1528 1527 this->node = decl; … … 1537 1536 { old->linkage.val } 1538 1537 ); 1538 cache.emplace( old, decl ); 1539 1539 decl->parent = GET_ACCEPT_1(parent, AggregateDecl); 1540 1540 decl->body = old->body; … … 1544 1544 decl->uniqueId = old->uniqueId; 1545 1545 decl->storage = { old->storageClasses.val }; 1546 cache.emplace( old, decl );1547 1546 1548 1547 this->node = decl; … … 1560 1559 GET_ACCEPT_1(init, Type) 1561 1560 }; 1561 cache.emplace( old, decl ); 1562 1562 decl->assertions = GET_ACCEPT_V(assertions, DeclWithType); 1563 1563 decl->params = GET_ACCEPT_V(parameters, TypeDecl); 1564 1564 decl->extension = old->extension; 1565 1565 decl->uniqueId = old->uniqueId; 1566 cache.emplace( old, decl );1567 1566 1568 1567 this->node = decl; … … 1912 1911 ast::TypeSubstitution * convertTypeSubstitution(const TypeSubstitution * old) { 1913 1912 1913 if (!old) return nullptr; 1914 1914 1915 ast::TypeSubstitution *rslt = new ast::TypeSubstitution(); 1915 1916 … … 2703 2704 d->accept( c ); 2704 2705 decls.emplace_back( c.decl() ); 2705 delete d;2706 }2706 } 2707 deleteAll(translationUnit); 2707 2708 return decls; 2708 2709 } -
src/AST/Expr.cpp
r76ed81f r893e106 159 159 assert( aggregate->result ); 160 160 161 <<<<<<< HEAD 161 162 // #warning Needs GenericSubsitution.cpp building to work correctly 162 163 // result.set_and_mutate( mem->get_type() )->qualifiers |= aggregate->result->qualifiers | CV::Lvalue; // FIXME temporary patch … … 168 169 // ensure lvalue and appropriate restrictions from aggregate type 169 170 result.get_and_mutate()->qualifiers |= aggregate->result->qualifiers | CV::Lvalue; 171 ======= 172 // assert(!"unimplemented; need TypeSubstitution, genericSubstitution"); 173 >>>>>>> ef5ef56042ce2b547da955746d9986e26cf628ca 170 174 } 171 175 -
src/AST/Node.hpp
r76ed81f r893e106 121 121 template<typename o_node_t> 122 122 ptr_base & operator=( const o_node_t * node ) { 123 assign( strict_dynamic_cast<const node_t *>(node));123 assign( node ? strict_dynamic_cast<const node_t *>(node) : nullptr ); 124 124 return *this; 125 125 } -
src/AST/Pass.proto.hpp
r76ed81f r893e106 107 107 bool * m_prev; 108 108 bool_ref * m_ref; 109 }; 110 111 template<typename pass_t, typename node_t> 112 struct is_valid_previsit { 113 using ret_t = decltype( ((pass_t*)nullptr)->previsit( (const node_t *)nullptr ) ); 114 115 static constexpr bool value = std::is_void< ret_t >::value || 116 std::is_base_of<const node_t, typename std::remove_pointer<ret_t>::type >::value; 109 117 }; 110 118 … … 127 135 static inline auto previsit( pass_t & pass, const node_t * & node, int ) -> decltype( pass.previsit( node ), void() ) { 128 136 static_assert( 129 std::is_base_of<const node_t, typename std::remove_pointer<decltype( pass.previsit( node ) )>::type>::value,130 "Previsit may not change the type of the node. Use postvisit instead."137 is_valid_previsit<pass_t, node_t>::value, 138 "Previsit may not change the type of the node. It must return its paremeter or void." 131 139 ); 132 node = pass.previsit( node ); 133 assert(node); 140 if(std::is_void< decltype( pass.previsit(node) ) >::value) { 141 pass.previsit( node ); 142 } else { 143 node = pass.previsit( node ); 144 assert(node); 145 } 134 146 } 135 147 … … 139 151 // PostVisit : never mutates the passed pointer but may return a different node 140 152 template<typename pass_t, typename node_t> 141 static inline auto postvisit( pass_t & pass, const node_t * node, int ) -> decltype( pass.postvisit( node ), (const node_t *)nullptr ) { 153 static inline auto postvisit( pass_t & pass, const node_t * node, int ) -> 154 decltype( pass.postvisit( node ), node->accept( *(Visitor*)nullptr ) ) 155 { 142 156 return pass.postvisit( node ); 143 157 } -
src/Common/utility.h
r76ed81f r893e106 74 74 75 75 template< typename Container > 76 void deleteAll( Container &container ) {77 for ( typename Container::iterator i = container.begin(); i != container.end(); ++i) {78 delete *i;76 void deleteAll( const Container &container ) { 77 for ( const auto &i : container ) { 78 delete i; 79 79 } // for 80 80 } -
src/include/cassert
r76ed81f r893e106 44 44 45 45 template<typename T, typename U> 46 static inline T strict_dynamic_cast( const U & src ) { 46 static inline __attribute__((nonnull)) T strict_dynamic_cast( const U & src ) { 47 assert(src); 47 48 T ret = dynamic_cast<T>(src); 48 49 assertf(ret, "%s", toString(src).c_str());
Note: See TracChangeset
for help on using the changeset viewer.