[Lldb-commits] [PATCH] D21984: Add data formatter for libstdc++ shared_ptr and weak_ptr

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 5 11:12:51 PDT 2016


tberghammer added inline comments.

================
Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:665
@@ +664,3 @@
+
+    stl_summary_flags.SetDontShowChildren(true);
+    AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibStdcppSmartPointerSummaryProvider,
----------------
granata.enrico wrote:
> Is there any reason to hide the children for a type that you provide synthetic children for?
Without hiding the children the content of the shard_ptr will be displayed 2 times. Once in the first line as part of the summary and then 2nd time as a children. I think it is cleaner if we display the value only once but it can make it more difficult to access to the content of the shared pointer.

If you think displaying the children is better then I am happy with that option too.

The 2 possible output for a type Foo:

```
(std::shared_ptr<Foo>) f = Foo @ 0x0000000000606118 {
  _M_ptr = 0x0000000000606118
}
```
```
(std::shared_ptr<Foo>) f = Foo @ 0x0000000000606118
```

The 2 possible output for an std::string:
```
(std::shared_ptr<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >) s = "123456" {
  _M_ptr = "123456"
}
```
```
(std::shared_ptr<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >) s = "123456"
```


http://reviews.llvm.org/D21984





More information about the lldb-commits mailing list