[PATCH] LLDB formatter for llvm::Optional

Justin Bogner mail at justinbogner.com
Mon Jan 19 16:39:09 PST 2015


I'm not all that familiar with lldb formatters, so please point out if
this is done strangely.

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/20150119/e578c954/attachment.bin>


More information about the llvm-commits mailing list