Changeset a62749f
- Timestamp:
- Jun 10, 2019, 12:08:15 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:
- 6e3e0717
- Parents:
- 61c7239
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r61c7239 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, … … 1390 1395 // Local Utilities: 1391 1396 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 1397 template<typename NewT, typename OldT> 1399 1398 NewT * getAccept1( OldT old ) { … … 1409 1408 1410 1409 template<typename NewT, typename OldC> 1411 std::vector< ast::ptr<NewT> > getAcceptV( OldC& old ) {1410 std::vector< ast::ptr<NewT> > getAcceptV( const OldC& old ) { 1412 1411 std::vector< ast::ptr<NewT> > ret; 1413 1412 ret.reserve( old.size() ); … … 1422 1421 # define GET_ACCEPT_V(child, type) \ 1423 1422 getAcceptV< ast::type, decltype( old->child ) >( old->child ) 1424 1423 1425 1424 template<typename NewT, typename OldC> 1426 std::deque< ast::ptr<NewT> > getAcceptD( OldC& old ) {1425 std::deque< ast::ptr<NewT> > getAcceptD( const OldC& old ) { 1427 1426 std::deque< ast::ptr<NewT> > ret; 1428 1427 for ( auto a : old ) { … … 1437 1436 getAcceptD< ast::type, decltype( old->child ) >( old->child ) 1438 1437 1439 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(); 1440 1441 return ast::Label( 1441 old->labelled->location,1442 location, 1442 1443 old->name, 1443 1444 GET_ACCEPT_V(attributes, Attribute) … … 1827 1828 } 1828 1829 1829 Label label = old->originalTarget;1830 1830 auto stmt = new ast::BranchStmt( 1831 1831 old->location, 1832 1832 kind, 1833 make_label(& label),1833 make_label(&old->originalTarget), 1834 1834 GET_LABELS_V(old->labels) 1835 1835 );
Note: See TracChangeset
for help on using the changeset viewer.