LLD already has a mechanism for caching creation of DWARCContext:
llvm::call_once(initDwarfLine, [this]() { initializeDwarf(); });
Though it is not used in all places.
I need that patch for implementing "Remove obsolete debug info" feature
(D74169). But this caching mechanism is useful by itself, and I think it
would be good to use it without connection to "Remove obsolete debug info"
feature. So this patch changes inplace creation of DWARFContext with
its cached version.
Additionally, that patch makes that RecoverableErrors would not be fatal
errors. i.e., If some RecoverableErrors occurred while parsing Debug Info,
LLD would still return 0.
Depends on D74308
I think you don't need to change this line