[Lldb-commits] [PATCH] D114450: Improve optional formatter

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 23 09:54:08 PST 2021


labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

I didn't realize that _M_engaged has type bool. That means the max value this could have is 255, which isn't nearly as bad as 0xffffffff. Nonetheless, this is a good change.

That said, I'm more worried about the strange interactions between libc++ and libstdc++ formatters I reported.



================
Comment at: lldb/examples/synthetic/gnu_libstdcpp.py:24
             self.value = self.payload.GetChildMemberWithName('_M_payload')
-            self.count = self.payload.GetChildMemberWithName('_M_engaged').GetValueAsUnsigned(0)
+            self.has_value = self.payload.GetChildMemberWithName('_M_engaged').GetValueAsUnsigned(0) == 1
         except:
----------------
I'd use `!= 0`, as matches what the actual implementation would do in this case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114450/new/

https://reviews.llvm.org/D114450



More information about the lldb-commits mailing list