A different trivial approach is to use the mmapped memory range <.debug_info ... garbage ... .debug_types>, then no dispatching is needed and it has no performance impact.
With this patch one could revert the new GetData() from D46606 but the code may be cleaner with it anyway. It is just no longer needed to be virtual so this patch removes its virtuality.
The core is new SymbolFileDWARF::get_debug_info_data().
It has no regressions.
That new class and inheritance of SectionReader (ObjectFileELF::SectionReaderCompressed, ObjectFileJIT::SectionReaderJIT) copying inheritance of ObjectFile' is there because SectionReader` may have local state (such as Decompressor) which is needed for each Section. Additionally ObjectFileELF may contain both uncompressed and compressed sections so it can choose the proper class for instantiation.