[PATCH] LLDB formatter for llvm::Optional

Justin Bogner mail at justinbogner.com
Fri Jan 23 10:56:14 PST 2015


+enrico

Is this the right way to do this? Specifically, I wasn't very sure about
the use of str() to get the representation of the casted type.

Justin Bogner <mail at justinbogner.com> writes:
> This teaches lldb how to print Optional, so instead of
>
>     (llvm::Optional<int>) $1 = {
>       storage = {
>         llvm::AlignedCharArray<4, 4> = (buffer = "\x00\x00")
>       }
>       hasVal = true
>     }
>
> we get
>
>     (llvm::Optional<int>) $1 = 0
>
> or if the optional doesn't have a value, then
>
>     (llvm::Optional<int>) $1 = None

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lldb-optional-formatter.patch
Type: text/x-patch
Size: 1238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150123/1c70c413/attachment.bin>


More information about the llvm-commits mailing list