[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.

http://reviews.llvm.org/D13778

Files:
  include/lldb/API/SBValue.h
  include/lldb/Core/ValueObject.h
  include/lldb/Core/ValueObjectSyntheticFilter.h
  include/lldb/DataFormatters/TypeSynthetic.h
  include/lldb/Interpreter/ScriptInterpreter.h
  scripts/Python/python-wrapper.swig
  scripts/interface/SBValue.i
  source/API/SBValue.cpp
  source/API/SystemInitializerFull.cpp
  source/Core/ValueObject.cpp
  source/Core/ValueObjectSyntheticFilter.cpp
  source/DataFormatters/TypeSynthetic.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13778.37501.patch
Type: text/x-patch
Size: 15766 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151015/9af376f8/attachment-0001.bin>


More information about the lldb-commits mailing list