This diff adds a data formatter for libstdcpp's forward_list. Besides, it refactors the existing code by extracting the common functionality between libstdcpp forward_list and list formatters into the AbstractListSynthProvider class.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Hi Walter:) Please, could you advise what can I change/do more? As a next step, I will unify the tests across the libcxx and libstdcpp formatters.
very good start!
lldb/examples/synthetic/gnu_libstdcpp.py | ||
---|---|---|
5–6 | remove this | |
26–168 | remove all these _abstract suffixes. They make reading harder | |
32 | here you should call the method get_end_of_list_address that i mention below | |
41–42 | don't remove this command. It's useful to know what's going on | |
102 | what is this? try to come up with a better name with documentation to make this easier to understand | |
215 | don't pass the is_valid_break_condition variable everywhere. It makes code more confusing. Instead, you should create a method "get_end_of_list_address" that should be overridden by each child implementation. Then you add a comment that this address is used to identify if a node traversal has reached its end | |
215 | don't pass 'type' here, instead, in the constructor of the parent in line 158 pass a boolean flag 'has_prev'. That should be enough for the parent class to know if there's a prev pointer or not | |
215 | similarly, pass incoming_size to the constructor, and a better name is "node_value_pointer_offset", and you add a comment explaining that lists have 1 or more pointers followed by the value |
All of the requested changes are done. Please, let me know if any other corrections are needed
Much better. Just some better patterns that you could follow. Read my comments.
Besides that, now you can unify the tests across libcxx and libstdcpp
lldb/examples/synthetic/gnu_libstdcpp.py | ||
---|---|---|
13–15 | Add these comments and remove the node_value_pointer_offset, as it can be inferred from has_prev | |
23 | remove | |
76 | remove this trailing space | |
89–95 | nice | |
96 | let's better initialize this with a simpler value | |
102–104 | remove this or do any necessary corrections here | |
129–131 | ||
171–174 | good | |
181–184 | remove | |
187–194 | you can delete these | |
196–200 | instead of this, declare a method in the parent class def updateNodes(self) ... # don't return anything that is invoked by 'update'. | |
211–214 | remove |
remove this