ThinLTOCodeGenerator currently does not preserve llvm.used symbols and
it can internalize them. In order to pass the necessary information to the
legacy ThinLTOCodeGenerator, the input to the code generator is
rewritten to be based on lto::InputFile.
This fixes: PR41236
rdar://problem/49293439
This and the functions below take an InputFile pointer with a nullptr default - why the default (and null check in these routines), since it looks like it is always being passed (other than emitImports, note on that further down). Can you remove the default parameter value, and also make this take a reference and remove the null checks?