[lldb/DWARF] Refactor DWARFDIE::Get{Decl,TypeLookup}Context (#93291)
After a bug (the bug is that the functions don't handle DW_AT_signature, aka type units) led me to one of these similar-but-different functions, I started to realize that most of the differences between these two functions are actually bugs. As a first step towards merging them, this patch rewrites both of them to follow the same pattern, while preserving all of their differences. The main change is that GetTypeLookupContext now also uses a `seen` list to avoid reference loops (currently that's not necessary because the function strictly follows parent links, but that will change with DW_AT_signatures). I've also optimized both functions to avoid recursion by starting contruction with the deepest scope first (and then reversing it).
parent
35f2caf7
Please register or sign in to comment