[Lldb-commits] [PATCH] D13778: [SBValue] Add a method HasChildAtIndex.

Siva Chandra via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 15 11:38:28 PDT 2015


sivachandra added a comment.

As I mentioned in the first post, this is the use case:

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.


http://reviews.llvm.org/D13778





More information about the lldb-commits mailing list