This fixes a regression introduced by https://reviews.llvm.org/D131437. The intention of the patch was to avoid indexing DWO skeleton units, but it also skipped over full DWARF compile units linked via a -gmodules DW_AT_dwo_name attribute. This patch restores the functionality and adds a test for it.
Won't this return nullptr in the fission case where the .dwo file is missing or deleted?
Can we do a bit more to ensure we aren't using fission here? Are there no other differences between -gmodules and fission we can key off of? Existence of .debug_addr section for fission only?
I added an unambiguous check for DWARF5+. The remaining incorrectly handled case is a DWARF4 + GNU fission extension where the .dwo file has been deleted. Is there any harm in indexing the skeleton in that case? It shouldn't be able to interfere with the declarations in the (missing) .dwo file in that case, right?
Let me know if this is not enough and I'll try finding another heuristic that we could apply here.
Maybe I should have bothered reading your comment in the code. That's exactly the case you were trying to avoid m-(
The .debug_addr section only exists in DWARF 5 so the IsSkeletonUnit() check covers this.
Much better, thanks for making sure we don't end up indexing real skeleton units as they cause problems if they do get indexed.