================ @@ -23,6 +23,13 @@ STRING_EXTENSION_OUTSIDE(SBValue) if -count <= key < count: key %= count return self.sbvalue.GetChildAtIndex(key) + elif isinstance(key, str): + if child := self.sbvalue.GetChildMemberWithName(key): + return child + # Support base classes, which are children but not members. + for child in self.sbvalue: + if child.name == key: + return child ---------------- labath wrote:
I don't think this is a good idea, as it means every negative lookup could end up enumerating all children of the object -- and there could be millions of them. If you really want to support looking up base classes (*), I think it should be done by iterating through the base base classes. * I actually think we shouldn't be providing extra functionality here -- at least unless GetChildMemberWithName supports that as well. I think the fact that `operator[](string)` is shorthand for `GetChildMemberWithName(string)` makes things easy to understand. I think it'd be confusing if one of them provided functionality which is not available in the other one. You'd also have to be very careful about handling data formatters -- they can provide synthetic children, but not "synthetic base classes". https://github.com/llvm/llvm-project/pull/118814 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits