[PATCH] LLDB formatter for llvm::Optional

Justin Bogner mail at justinbogner.com
Thu Feb 19 11:56:21 PST 2015


ping

Justin Bogner <mail at justinbogner.com> writes:
> Enrico Granata <egranata at apple.com> writes:
>> Without much awareness of the implementation details of
>> llvm::Optional, this storage.Cast worries me a little bit
>> SBValue::Cast() is a sharp and dangerous tool It is not the moral
>> equivalent of a language cast; it pretty simply replaces the type of
>> the data leaving it exactly intact - so your mileage may vary with it
>
> I believe this is exactly the correct behaviour in this
> case. llvm::Optional<T> basically creates a char[] of appropriate size
> for storage of the T. We really do just want to treat this as the
> particular type.
>
>> It looks like here it would work, because this is a correctly-sized buffer and
>> you really just want to swap the SBType, but I would test with more than int
>> to make sure
>
> I've tried this with a few llvm types, it works well :)
>
> Is the usage of str() appropriate?



More information about the llvm-commits mailing list