This diff adds a data formatter for libstdcpp's set. Besides, it unifies the tests for set for libcxx and libstdcpp for maintainability.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
just some minor things left
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp | ||
---|---|---|
941–942 | to mimic the libcxx case that you can see in the line 710 of https://lldb.llvm.org/cpp_reference/CPlusPlusLanguage_8cpp_source.html, you can do stl_summary_flags.SetSkipPointers(false) in line 932 of this file. Then both standard libraries will be handled the same way. Make sure to execute the relevant tests for vector, map, set and list for libstdcpp. | |
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/set/Makefile | ||
4 | remove this line | |
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/set/TestDataFormatterGenericSet.py | ||
45 | can you add additional assertions like the one you did in https://reviews.llvm.org/D112180 that uses ValueCheck? |
Besides, given that you are using the same python implementation for map and set, better rename the class to StdSeOrMapSynthProvider and add a comment mentioning that it works both for set and maps because they have the same underlying structure
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/set/TestDataFormatterGenericSet.py | ||
---|---|---|
45 | I have made check method more generic and less verbose. Before it was specifically checking the "ii" variable, that was a set<int> of size 7. With value check approach we can now test set<string> and others. I guess, that I can delete all of the self.expect() and simply call check method with the expected size. Please, let me know if I should do it or leave it as it is. Thanks |
pretty good! Just some cosmetic changes needed and that's it
lldb/examples/synthetic/gnu_libstdcpp.py | ||
---|---|---|
318 ↗ | (On Diff #382668) | Make a comment above like ''' Set and Map have the same underlying data structure, therefore we can use exactly the same implementation for the formatter. ''' |
324–325 ↗ | (On Diff #382668) | As this is not just for maps, you can do something like: self.kind = "set" if "set" in valobj.GetTypeName() else "map" logger >> "Providing synthetic children for a " self.kind + " named " + \ str(valobj.GetName()) |
352 ↗ | (On Diff #382668) | |
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/set/TestDataFormatterGenericSet.py | ||
153–154 | remove these lines |
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/set/TestDataFormatterGenericSet.py | ||
---|---|---|
45 | yes, the code is good as you did it |
Just fix that last thing and I'll land your patch :) Thanks
lldb/examples/synthetic/gnu_libstdcpp.py | ||
---|---|---|
318 ↗ | (On Diff #382668) | actual python documentation uses ''' for comments, not # |
to mimic the libcxx case that you can see in the line 710 of https://lldb.llvm.org/cpp_reference/CPlusPlusLanguage_8cpp_source.html, you can do stl_summary_flags.SetSkipPointers(false) in line 932 of this file. Then both standard libraries will be handled the same way. Make sure to execute the relevant tests for vector, map, set and list for libstdcpp.
This also means that you don't need the new variable stl_set_summary_flags