Changeset 6949c45 for src/AST/Convert.cpp
- Timestamp:
- Jun 10, 2019, 1:51:24 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 2773ab8, 558d13b
- Parents:
- 891b827 (diff), f9a7cf0 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r891b827 r6949c45 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 ) ) { 156 if(node->name == "tmp") {157 std::cerr << (void*)node << "(new) in cache " << (void*)this->node << "(old)" << std::endl;158 }159 161 return nullptr; 160 162 } … … 169 171 Type::FuncSpecifiers( node->funcSpec.val ) 170 172 ); 171 if(node->name == "tmp") {172 std::cerr << (void*)node << "(new) created " << (void*)decl << "(old)" << std::endl;173 }174 173 return declWithTypePostamble( decl, node ); 175 174 } … … 1390 1389 // Local Utilities: 1391 1390 1392 #define construct(T, key, ...) ({ \1393 void * data = ::operator new(sizeof(T)); \1394 cache.emplace( key, (T*)data ); \1395 new (data) T( __VA_ARGS__ ); \1396 })1397 1398 1391 template<typename NewT, typename OldT> 1399 1392 NewT * getAccept1( OldT old ) { … … 1409 1402 1410 1403 template<typename NewT, typename OldC> 1411 std::vector< ast::ptr<NewT> > getAcceptV( OldC& old ) {1404 std::vector< ast::ptr<NewT> > getAcceptV( const OldC& old ) { 1412 1405 std::vector< ast::ptr<NewT> > ret; 1413 1406 ret.reserve( old.size() ); … … 1422 1415 # define GET_ACCEPT_V(child, type) \ 1423 1416 getAcceptV< ast::type, decltype( old->child ) >( old->child ) 1424 1417 1425 1418 template<typename NewT, typename OldC> 1426 std::deque< ast::ptr<NewT> > getAcceptD( OldC& old ) {1419 std::deque< ast::ptr<NewT> > getAcceptD( const OldC& old ) { 1427 1420 std::deque< ast::ptr<NewT> > ret; 1428 1421 for ( auto a : old ) { … … 1437 1430 getAcceptD< ast::type, decltype( old->child ) >( old->child ) 1438 1431 1439 ast::Label make_label(Label* old) { 1432 ast::Label make_label(const Label* old) { 1433 CodeLocation const & location = 1434 ( old->labelled ) ? old->labelled->location : CodeLocation(); 1440 1435 return ast::Label( 1441 old->labelled->location,1436 location, 1442 1437 old->name, 1443 1438 GET_ACCEPT_V(attributes, Attribute) … … 1470 1465 1471 1466 virtual void visit( ObjectDecl * old ) override final { 1472 if( old->name == "tmp" ) {1473 std::cerr << "building parameters for" << (void*)old << std::endl;1474 }1475 1467 auto&& type = GET_ACCEPT_1(type, Type); 1476 1468 auto&& init = GET_ACCEPT_1(init, Init); 1477 1469 auto&& bfwd = GET_ACCEPT_1(bitfieldWidth, Expr); 1478 1470 auto&& attr = GET_ACCEPT_V(attributes, Attribute); 1479 if( old->name == "tmp" ) {1480 std::cerr << "checking cache for " << (void*)old << std::endl;1481 }1482 1471 if ( inCache( old ) ) { 1483 if( old->name == "tmp" ) {1484 std::cerr << (void*)old << "(old) in cache " << (void*)this->node << "(new)" << std::endl;1485 }1486 1472 return; 1487 1473 } … … 1498 1484 ); 1499 1485 cache.emplace(old, decl); 1500 if( old->name == "tmp" ) {1501 std::cerr << (void*)old << "(old) added to cache with " << (void*)decl << "(new)" << std::endl;1502 }1503 1486 assert(cache.find( old ) != cache.end()); 1504 1487 decl->scopeLevel = old->scopeLevel; … … 1509 1492 1510 1493 this->node = decl; 1511 1512 if( old->name == "tmp" ) {1513 std::cerr << (void*)old << "(old) created " << (void*)this->node << "(new)" << std::endl;1514 }1515 1494 } 1516 1495 … … 1827 1806 } 1828 1807 1829 Label label = old->originalTarget;1830 1808 auto stmt = new ast::BranchStmt( 1831 1809 old->location, 1832 1810 kind, 1833 make_label(& label),1811 make_label(&old->originalTarget), 1834 1812 GET_LABELS_V(old->labels) 1835 1813 );
Note: See TracChangeset
for help on using the changeset viewer.