Changes in / [893e106:76ed81f]
- Location:
- src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r893e106 r76ed81f 1342 1342 }; 1343 1343 1344 std::list< Declaration * > convert( conststd::list< ast::ptr< ast::Decl > > && translationUnit ) {1344 std::list< Declaration * > convert( 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; 1349 1350 } 1350 1351 return decls; … … 1435 1436 { old->get_funcSpec().val } 1436 1437 ); 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 ); 1443 1444 1444 1445 this->node = decl; … … 1457 1458 { old->get_funcSpec().val } 1458 1459 }; 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 ); 1465 1466 1466 1467 this->node = decl; … … 1476 1477 { old->linkage.val } 1477 1478 ); 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 ); 1486 1487 1487 1488 this->node = decl; … … 1496 1497 { old->linkage.val } 1497 1498 ); 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 ); 1506 1507 1507 1508 this->node = decl; … … 1516 1517 { old->linkage.val } 1517 1518 ); 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 ); 1526 1527 1527 1528 this->node = decl; … … 1536 1537 { old->linkage.val } 1537 1538 ); 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 ); 1546 1547 1547 1548 this->node = decl; … … 1559 1560 GET_ACCEPT_1(init, Type) 1560 1561 }; 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 ); 1566 1567 1567 1568 this->node = decl; … … 1911 1912 ast::TypeSubstitution * convertTypeSubstitution(const TypeSubstitution * old) { 1912 1913 1913 if (!old) return nullptr;1914 1915 1914 ast::TypeSubstitution *rslt = new ast::TypeSubstitution(); 1916 1915 … … 2704 2703 d->accept( c ); 2705 2704 decls.emplace_back( c.decl() ); 2706 }2707 deleteAll(translationUnit);2705 delete d; 2706 } 2708 2707 return decls; 2709 2708 } -
src/AST/Expr.cpp
r893e106 r76ed81f 159 159 assert( aggregate->result ); 160 160 161 <<<<<<< HEAD162 161 // #warning Needs GenericSubsitution.cpp building to work correctly 163 162 // result.set_and_mutate( mem->get_type() )->qualifiers |= aggregate->result->qualifiers | CV::Lvalue; // FIXME temporary patch … … 169 168 // ensure lvalue and appropriate restrictions from aggregate type 170 169 result.get_and_mutate()->qualifiers |= aggregate->result->qualifiers | CV::Lvalue; 171 =======172 // assert(!"unimplemented; need TypeSubstitution, genericSubstitution");173 >>>>>>> ef5ef56042ce2b547da955746d9986e26cf628ca174 170 } 175 171 -
src/AST/Node.hpp
r893e106 r76ed81f 121 121 template<typename o_node_t> 122 122 ptr_base & operator=( const o_node_t * node ) { 123 assign( node ? strict_dynamic_cast<const node_t *>(node) : nullptr);123 assign(strict_dynamic_cast<const node_t *>(node)); 124 124 return *this; 125 125 } -
src/AST/Pass.proto.hpp
r893e106 r76ed81f 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;117 109 }; 118 110 … … 135 127 static inline auto previsit( pass_t & pass, const node_t * & node, int ) -> decltype( pass.previsit( node ), void() ) { 136 128 static_assert( 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."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." 139 131 ); 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 } 132 node = pass.previsit( node ); 133 assert(node); 146 134 } 147 135 … … 151 139 // PostVisit : never mutates the passed pointer but may return a different node 152 140 template<typename pass_t, typename node_t> 153 static inline auto postvisit( pass_t & pass, const node_t * node, int ) -> 154 decltype( pass.postvisit( node ), node->accept( *(Visitor*)nullptr ) ) 155 { 141 static inline auto postvisit( pass_t & pass, const node_t * node, int ) -> decltype( pass.postvisit( node ), (const node_t *)nullptr ) { 156 142 return pass.postvisit( node ); 157 143 } -
src/Common/utility.h
r893e106 r76ed81f 74 74 75 75 template< typename Container > 76 void deleteAll( constContainer &container ) {77 for ( const auto &i : container) {78 delete i;76 void deleteAll( Container &container ) { 77 for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { 78 delete *i; 79 79 } // for 80 80 } -
src/include/cassert
r893e106 r76ed81f 44 44 45 45 template<typename T, typename U> 46 static inline __attribute__((nonnull)) T strict_dynamic_cast( const U & src ) { 47 assert(src); 46 static inline T strict_dynamic_cast( const U & src ) { 48 47 T ret = dynamic_cast<T>(src); 49 48 assertf(ret, "%s", toString(src).c_str());
Note:
See TracChangeset
for help on using the changeset viewer.