Changeset 6312b1c for src/GenPoly/Box.cc


Ignore:
Timestamp:
May 17, 2021, 9:28:08 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
02a43ff
Parents:
d7ae173
Message:

In box pass that creates pointer + VLA for generics:
I now move the attribute cleanup from the pointer to the buffer.
fixed #250?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    rd7ae173 r6312b1c  
    15251525                                        stmtsToAddBefore.push_back( new DeclStmt( newBuf ) );
    15261526
     1527                                        // if the object has a cleanup attribute, the cleanup should be on the buffer, not the pointer
     1528                                        auto matchAndMove = [newBuf](Attribute * attr){
     1529                                                if(attr->name == "cleanup") {
     1530                                                        newBuf->attributes.push_back(attr);
     1531                                                        return true;
     1532                                                }
     1533                                                return false;
     1534                                        };
     1535
     1536                                        objectDecl->attributes.remove_if(matchAndMove);
     1537
    15271538                                        delete objectDecl->get_init();
    15281539                                        objectDecl->set_init( new SingleInit( new VariableExpr( newBuf ) ) );
Note: See TracChangeset for help on using the changeset viewer.