================
@@ -6754,12 +6754,12 @@ size_t TypeSystemClang::GetIndexOfChildMemberWithName(
llvm::StringRef field_name = field->getName();
if (field_name.empty()) {
CompilerType field_type = GetType(field->getType());
+ std::vector<uint32_t> save_indices = child_indexes;
----------------
labath wrote:
So, my preferred solution would be to have this function return a `vector<int>`
(apparently, there's even a TODO in the header about that (*)). That way you
can build the result from the bottom up, and only add things to the vector when
you've found the thing you're searching for and are certain that you're going
to return successfully. That's going to be slightly slower than passing the
same vector always (but maybe not slower than making a copy of it
preemptively). However, I can live with both yours and Michael's solution
(which I think could still work if you keep the `pop_back` statement so that
the next iteration starts with a valid state). I'll leave it up to Michael to
decide, as he spends most of the time looking at this code.
(*) Technically the TODO is about returning a `vector<vector<int>>` of all
possible matches -- which may be a good idea overall, but I don't think we
want to do that now.
https://github.com/llvm/llvm-project/pull/117808
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits