TableGen Object Ownership

I'm adding some new operators to TableGen and I've run into a memory ownership
issue.

We have all of these Inits and RecTys flying around but I don't see any scheme
to assign ownership. It looks like we're leaking memory all over.

This is getting worse as I'm adding operators because I need to create new
objects on-the-fly and/or return operands of operators as the result of
the folding of the operation.

Is there an ownership scheme or should we consider smart pointers or a similar
mechanism?

                                -Dave

I'm adding some new operators to TableGen and I've run into a memory ownership
issue.

We have all of these Inits and RecTys flying around but I don't see any scheme
to assign ownership. It looks like we're leaking memory all over.

This is getting worse as I'm adding operators because I need to create new
objects on-the-fly and/or return operands of operators as the result of
the folding of the operation.

Yes, this is horrible. It would be really nice (tm) if C++ allowed you to say "anything derived from this class should be garbage collected". Alas, that doesn't exist. :slight_smile:

Is there an ownership scheme or should we consider smart pointers or a similar
mechanism?

I think smart pointers would make sense, though I generally prefer an explicit ownership model. I'm happy with whatever you think is best,

-Chris