Changeset 6e3e0717


Ignore:
Timestamp:
Jun 10, 2019, 12:21:35 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
aaeacf4, f9a7cf0
Parents:
6355ba7 (diff), a62749f (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r6355ba7 r6e3e0717  
    1010// Created On       : Thu May 09 15::37::05 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu May 06 19:51:00 2019
    13 // Update Count     : 10
     12// Last Modified On : Man Jun 10 11:51:00 2019
     13// Update Count     : 11
    1414//
    1515
     
    9292
    9393        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                }
    9499                return Label(
    95100                        label.name,
     
    13841389        // Local Utilities:
    13851390
    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 
    13921391        template<typename NewT, typename OldT>
    13931392        NewT * getAccept1( OldT old ) {
     
    14031402
    14041403        template<typename NewT, typename OldC>
    1405         std::vector< ast::ptr<NewT> > getAcceptV( OldC& old ) {
     1404        std::vector< ast::ptr<NewT> > getAcceptV( const OldC& old ) {
    14061405                std::vector< ast::ptr<NewT> > ret;
    14071406                ret.reserve( old.size() );
     
    14181417
    14191418        template<typename NewT, typename OldC>
    1420         std::deque< ast::ptr<NewT> > getAcceptD( OldC& old ) {
     1419        std::deque< ast::ptr<NewT> > getAcceptD( const OldC& old ) {
    14211420                std::deque< ast::ptr<NewT> > ret;
    14221421                for ( auto a : old ) {
     
    14311430                getAcceptD< ast::type, decltype( old->child ) >( old->child )
    14321431
    1433         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();
    14341435                return ast::Label(
    1435                         old->labelled->location,
     1436                        location,
    14361437                        old->name,
    14371438                        GET_ACCEPT_V(attributes, Attribute)
     
    18051806                        }
    18061807
    1807                         Label label = old->originalTarget;
    18081808                        auto stmt = new ast::BranchStmt(
    18091809                                old->location,
    18101810                                kind,
    1811                                 make_label(&label),
     1811                                make_label(&old->originalTarget),
    18121812                                GET_LABELS_V(old->labels)
    18131813                        );
Note: See TracChangeset for help on using the changeset viewer.