[RFC] Remove User::OperandList

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Jun 1 09:50:48 PDT 2015


> On 2015-May-29, at 10:35, Pete Cooper <peter_cooper at apple.com> wrote:
> 
> 
>> On May 29, 2015, at 10:31 AM, Owen Anderson <resistor at mac.com> wrote:
>> 
>>> Finally, fixed all callers of the User::new to call the correct version of the method.  This involved adding (unsigned) casts or changing for example 1 to 1U in callers to disambiguate the 'new' we want.
>> 
>> This seems kind of gross.  Is there any cleaner way to get the same effect?
> Yeah, I agree.  I considered just adding the bool to the end of the existing User::new and making it default to false.  Then I could assert in there that we ask for 0 Use’s if we need hung off uses.  That would mean I only need to rewrite the hung off use calls to new.

This rejected alternative sounds better to me.

Alternatively, you could avoid the `bool` altogether:

    /// Allocate a User with an operand pointer co-allocated.
    void *operator new(size_t Size);

    /// Allocate a User with the operands co-allocated.
    void *operator new(size_t Size, unsigned NumOps);

Then you also don't need an assertion.  Thoughts?



More information about the llvm-commits mailing list