[RFC] Remove User::OperandList
Pete Cooper
peter_cooper at apple.com
Mon Jun 1 09:53:13 PDT 2015
> On Jun 1, 2015, at 9:50 AM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
>
>
>> 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?
Yeah, sounds good to be. So long as I put a comment explaining that the default does the collocated Use* then i think it’ll be fine.
More information about the llvm-commits
mailing list