[Lldb-commits] [PATCH] D97165: [lldb] Add deref support and tests to shared_ptr synthetic

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Feb 21 15:06:09 PST 2021


kastiglione added inline comments.


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp:410-433
-    if (!m_count_sp) {
-      ValueObjectSP shared_owners_sp(m_cntrl->GetChildMemberWithName(
-          ConstString("__shared_owners_"), true));
-      if (!shared_owners_sp)
-        return lldb::ValueObjectSP();
-      uint64_t count = 1 + shared_owners_sp->GetValueAsUnsigned(0);
-      DataExtractor data(&count, 8, m_byte_order, m_ptr_size);
----------------
Note that these two indexes were not accessed because `CalculateNumChildren` returns either 0 or 1. So this is actually NFC despite its looks.


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp:472-475
-  if (name == "count")
+  if (name == "$$dereference$$")
     return 1;
-  if (name == "weak_count")
-    return 2;
----------------
Note that `count` and `weak_count` were not accessed because `CalculateNumChildren` returns either 0 or 1. So this is actually NFC despite its looks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97165



More information about the lldb-commits mailing list