[llvm][utils] Support dereferencing llvm::Optional lldb formatter
authorDave Lee <davelee.com@gmail.com>
Mon, 22 Feb 2021 05:45:04 +0000 (21:45 -0800)
committerDave Lee <davelee.com@gmail.com>
Fri, 26 Feb 2021 15:43:33 +0000 (07:43 -0800)
commit408456f53eccd9b2280840aff8fa99f865024544
treed60288a12122bb794a19acef6a167f06a56f29e6
parent3a677b29a3b3f6a2539843db4d56ba59689fc0a0
[llvm][utils] Support dereferencing llvm::Optional lldb formatter

Add deref support to `llvm::Optional` in `lldbDataFormatters.py`.

This creates a synthetic provider that adds dereference support, but otherwise proxies all access to the underlying value.

With this change, an optional value can be displayed by running `v *someOptional`, and its contents can be accessed with the arrow `operator->`, for example `v someOpt->HasThing`. This matches expressions usable from expression evaluation.

See also D97165 and D97524.

Differential Revision: https://reviews.llvm.org/D97525
llvm/utils/lldbDataFormatters.py