xref: /llvm-project-15.0.7/lldb/test/API/functionalities/data-formatter/synthcapping/fooSynthProvider.py (revision c6f7b720)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import lldb
2
3
4class fooSynthProvider:
5
6    def __init__(self, valobj, dict):
7        self.valobj = valobj
8        self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
9
10    def num_children(self):
11        return 3
12
13    def get_child_at_index(self, index):
14        if index == 0:
15            child = self.valobj.GetChildMemberWithName('a')
16        if index == 1:
17            child = self.valobj.CreateChildAtOffset('fake_a', 1, self.int_type)
18        if index == 2:
19            child = self.valobj.GetChildMemberWithName('r')
20        return child
21
22    def get_child_index(self, name):
23        if name == 'a':
24            return 0
25        if name == 'fake_a':
26            return 1
27        return 2
28

served by {OpenGrok

Last Index Update: Tue Oct 21 18:42:31 GMT 2025