Changes in src/AST/Convert.cpp [6355ba7:a62749f]
- File:
-
- 1 edited
-
src/AST/Convert.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r6355ba7 ra62749f 10 10 // Created On : Thu May 09 15::37::05 2019 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu May 06 19:51:00 201913 // Update Count : 1 012 // Last Modified On : Man Jun 10 11:51:00 2019 13 // Update Count : 11 14 14 // 15 15 … … 92 92 93 93 Label makeLabel(Statement * labelled, const ast::Label& label) { 94 // This probably will leak memory, but only until we get rid of the old tree. 95 if ( nullptr == labelled && label.location.isSet() ) { 96 labelled = new NullStmt(); 97 labelled->location = label.location; 98 } 94 99 return Label( 95 100 label.name, … … 154 159 auto&& attr = get<Attribute>().acceptL( node->attributes ); 155 160 if ( inCache( node ) ) { 161 if(node->name == "tmp") { 162 std::cerr << (void*)node << "(new) in cache " << (void*)this->node << "(old)" << std::endl; 163 } 156 164 return nullptr; 157 165 } … … 166 174 Type::FuncSpecifiers( node->funcSpec.val ) 167 175 ); 176 if(node->name == "tmp") { 177 std::cerr << (void*)node << "(new) created " << (void*)decl << "(old)" << std::endl; 178 } 168 179 return declWithTypePostamble( decl, node ); 169 180 } … … 1384 1395 // Local Utilities: 1385 1396 1386 #define construct(T, key, ...) ({ \1387 void * data = ::operator new(sizeof(T)); \1388 cache.emplace( key, (T*)data ); \1389 new (data) T( __VA_ARGS__ ); \1390 })1391 1392 1397 template<typename NewT, typename OldT> 1393 1398 NewT * getAccept1( OldT old ) { … … 1403 1408 1404 1409 template<typename NewT, typename OldC> 1405 std::vector< ast::ptr<NewT> > getAcceptV( OldC& old ) {1410 std::vector< ast::ptr<NewT> > getAcceptV( const OldC& old ) { 1406 1411 std::vector< ast::ptr<NewT> > ret; 1407 1412 ret.reserve( old.size() ); … … 1418 1423 1419 1424 template<typename NewT, typename OldC> 1420 std::deque< ast::ptr<NewT> > getAcceptD( OldC& old ) {1425 std::deque< ast::ptr<NewT> > getAcceptD( const OldC& old ) { 1421 1426 std::deque< ast::ptr<NewT> > ret; 1422 1427 for ( auto a : old ) { … … 1431 1436 getAcceptD< ast::type, decltype( old->child ) >( old->child ) 1432 1437 1433 ast::Label make_label(Label* old) { 1438 ast::Label make_label(const Label* old) { 1439 CodeLocation const & location = 1440 ( old->labelled ) ? old->labelled->location : CodeLocation(); 1434 1441 return ast::Label( 1435 old->labelled->location,1442 location, 1436 1443 old->name, 1437 1444 GET_ACCEPT_V(attributes, Attribute) … … 1464 1471 1465 1472 virtual void visit( ObjectDecl * old ) override final { 1473 if( old->name == "tmp" ) { 1474 std::cerr << "building parameters for" << (void*)old << std::endl; 1475 } 1466 1476 auto&& type = GET_ACCEPT_1(type, Type); 1467 1477 auto&& init = GET_ACCEPT_1(init, Init); 1468 1478 auto&& bfwd = GET_ACCEPT_1(bitfieldWidth, Expr); 1469 1479 auto&& attr = GET_ACCEPT_V(attributes, Attribute); 1480 if( old->name == "tmp" ) { 1481 std::cerr << "checking cache for " << (void*)old << std::endl; 1482 } 1470 1483 if ( inCache( old ) ) { 1484 if( old->name == "tmp" ) { 1485 std::cerr << (void*)old << "(old) in cache " << (void*)this->node << "(new)" << std::endl; 1486 } 1471 1487 return; 1472 1488 } … … 1483 1499 ); 1484 1500 cache.emplace(old, decl); 1501 if( old->name == "tmp" ) { 1502 std::cerr << (void*)old << "(old) added to cache with " << (void*)decl << "(new)" << std::endl; 1503 } 1485 1504 assert(cache.find( old ) != cache.end()); 1486 1505 decl->scopeLevel = old->scopeLevel; … … 1491 1510 1492 1511 this->node = decl; 1512 1513 if( old->name == "tmp" ) { 1514 std::cerr << (void*)old << "(old) created " << (void*)this->node << "(new)" << std::endl; 1515 } 1493 1516 } 1494 1517 … … 1805 1828 } 1806 1829 1807 Label label = old->originalTarget;1808 1830 auto stmt = new ast::BranchStmt( 1809 1831 old->location, 1810 1832 kind, 1811 make_label(& label),1833 make_label(&old->originalTarget), 1812 1834 GET_LABELS_V(old->labels) 1813 1835 );
Note:
See TracChangeset
for help on using the changeset viewer.