Regarding the patch request quoted below, was this code or something related ever merged? If not then I strongly encourage doing so.
I came across the same problem using the ld LTO plugin via Clang, linking programs that use the QT library, and thus can often consist of hundreds or thousands of translation units. With Wan’s patch the time to link a program using QtCore and QtGui fell from 10 minutes to 3 minutes, thanks to not rerunning TypeFinder over the composite module every time a new module was linked in.
Regarding feedback given to the original patch request, the “running total” of types used in a module probably should be maintained by the Linker class rather than forming part of Module; however this requires that Linker’s composite Module is not modified other than by calling Linker’s LinkIn… methods, otherwise the running total may become inconsistent with the Composite Module, and I’m unsure whether that’s always true.
FWIW my hurriedly hacked-up version of Wan’s patch is attached, but at least the restriction that Composite and any supplied type set must be kept in sync would need to be documented. The variable names and comments are likely inaccurate as I’m not clear whether it is named struct types, all struct types or all types which are relevant.
linker.patch (6.39 KB)