[Lldb-commits] [PATCH] D13778: [SBValue] Add a method HasChildAtIndex.
Siva Chandra via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 15 11:16:10 PDT 2015
sivachandra created this revision.
sivachandra added reviewers: clayborg, granata.enrico.
sivachandra added a subscriber: lldb-commits.
Along with this, support for an optional Python synthetic child provider
method "has_child_at_index" has also been added. These have been added
with the following use case in mind:
Synthetic child providers currently have a method "has_children" and
"get_num_children". While the former is good enough to know if there are
children, it does not give any insight into how many children there are.
Though the latter serves this purpose, calculating the number for children
of a data structure could be an O(N) operation if the data structure has N
children. The new methods added in this change provide a middle ground.
One can call HasChildAtIndex to know if a child exists at an index K which
can be as large as the callers tolerance can be. If the caller wants to
know about children beyond K, it can make an other call with 2K. If the
synthetic child provider maintains state about it counting till K
previosly, then the next call is only an O(K) operation. Infact, all
calls made progressively with steps of K will be O(K) operations.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 15766 bytes
Desc: not available
More information about the lldb-commits