-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add a visualizer for _Ref_count_obj_alloc3
and _Ref_count_obj2
#2811
Conversation
_Ref_count_obj_alloc3
and _Ref_count_obj2
_Ref_count_obj_alloc3
and _Ref_count_obj2
Programmer-archaeology: MSVC-PR-179257 "Comply with The Rules for #309, merged 2020-04-08, shipped in VS 2019 16.7, introduced I don't think we absolutely need version comments, but I wouldn't object to them. |
test code: #include <memory>
template <typename T>
struct stateful_allocator
: std::allocator<T>
{
stateful_allocator() {}
template <typename U> stateful_allocator(stateful_allocator<U> const&) {}
typedef T value_type;
template <typename U> struct rebind { typedef stateful_allocator<U> other; };
T* allocate(size_t n) {
return static_cast<T*>(operator new(n * sizeof(T)));
}
void deallocate(T* p, size_t) { operator delete(p); }
int state = 0;
};
int main() {
std::allocator<int> alloc{};
stateful_allocator<int> salloc{};
auto ms = std::make_shared<int>();
auto as = std::allocate_shared<int>(alloc, 10);
auto as2 = std::allocate_shared<int>(salloc, 10);
return 0;
} |
I didn't test class __declspec(empty_bases) _Ref_count_obj_alloc2 : public _Ebco_base<_Alloc>, public _Ref_count_base { class _Ref_count_obj_alloc3 : public _Ebco_base<_Rebind_alloc_t<_Alloc, _Ty>>, public _Ref_count_base { |
to match the rest of our XML formatting.
<Type Name="std::_Ref_count_obj2<*>"> | ||
<DisplayString>make_shared</DisplayString> | ||
<Expand> | ||
<Item Condition="_Uses != 0" Name="[original ptr]">($T1 *) &_Storage</Item> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a fixed string to a _Uses == 0
condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we need to show a child item for an empty shared_ptr? (weak_ptrs will display themselves as expired, IIRC)
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
I've resolved a trivial merge conflict where #2804 deleted code next to this PR's addition. |
Thanks for fixing these important visualizers! 🎉 🚀 😸 |
…icrosoft#2811) Co-authored-by: Stephan T. Lavavej <[email protected]> Co-authored-by: Casey Carter <[email protected]>
Fixes #2787
test:
Do we need some comments for them like
<!-- VC 2019 -->
?