-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[LLDB] Add formatters for MSVC STL std::shared_ptr #147575
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
Changes from 1 commit
8894b65
083687d
51b5615
91fd149
3784e17
9b88cec
d5367f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ lldb::ValueObjectSP lldb_private::formatters::GetDesugaredSmartPointerValue( | |
|
|
||
| auto arg = container_type.GetTypeTemplateArgument(0); | ||
| if (!arg) | ||
| return nullptr; | ||
| return ptr.GetSP(); // FIXME: PDB doesn't have info about template arguments | ||
|
||
|
|
||
| return ptr.Cast(arg.GetPointerType()); | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,170 @@ | ||||||||||
| //===-- MsvcStlSmartPointer.cpp -------------------------------------------===// | ||||||||||
| // | ||||||||||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||||||||
| // See https://llvm.org/LICENSE.txt for license information. | ||||||||||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||||||||
| // | ||||||||||
| //===----------------------------------------------------------------------===// | ||||||||||
|
|
||||||||||
| #include "Generic.h" | ||||||||||
| #include "MsvcStl.h" | ||||||||||
|
|
||||||||||
| #include "lldb/DataFormatters/FormattersHelpers.h" | ||||||||||
| #include "lldb/DataFormatters/TypeSynthetic.h" | ||||||||||
|
|
||||||||||
| using namespace lldb; | ||||||||||
|
|
||||||||||
| bool lldb_private::formatters::IsMsvcStlSmartPointer(ValueObject &valobj) { | ||||||||||
| std::vector<uint32_t> indexes; | ||||||||||
| return valobj.GetCompilerType().GetIndexOfChildMemberWithName("_Ptr", true, | ||||||||||
| indexes) > 0; | ||||||||||
|
||||||||||
| std::vector<uint32_t> indexes; | |
| return valobj.GetCompilerType().GetIndexOfChildMemberWithName("_Ptr", true, | |
| indexes) > 0; | |
| return valobj.GetChildMemberWithName("_Ptr") != nullptr; |
?
Nerixyz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Nerixyz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -118,3 +118,9 @@ def test_libcxx(self): | |||||||||
| def test_libstdcxx(self): | ||||||||||
| self.build(dictionary={"USE_LIBSTDCPP": 1}) | ||||||||||
| self.do_test() | ||||||||||
|
|
||||||||||
| @add_test_categories(["msvcstl"]) | ||||||||||
| def test_msvcstl(self): | ||||||||||
| # No flags, because the "msvcstl" category checks that the MSVC STL is used by default. | ||||||||||
| self.build(dictionary={}) | ||||||||||
|
||||||||||
| # No flags, because the "msvcstl" category checks that the MSVC STL is used by default. | |
| self.build(dictionary={}) | |
| # No flags, because the "msvcstl" category checks that the MSVC STL is used by default. | |
| self.build() |
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.
These registrations are getting a bit noisy in my opinion. Could we move all this to a separate helper called
RegisterCommonStlSmartPtrFormatters(or something like that?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.
This will be a problem for the other types as well. What about having a
Common{Type}SyntheticFrontEndCreatorandCommon{Type}SummaryProviderinGeneric.h(or maybe a new header)?