Skip to content

Commit ea4a348

Browse files
authored
[BOLT][DWARF][NFC] Move initialization of DWOName outside of lambda (#99728)
Followup to the splitting of processUnitDIE, moves code that accesses common resource to be outside of the function that will be parallelized. Followup to #99957
1 parent f9cf539 commit ea4a348

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -668,20 +668,12 @@ void DWARFRewriter::updateDebugInfo() {
668668
auto processSplitCU = [&](DWARFUnit &Unit, DWARFUnit &SplitCU,
669669
DIEBuilder &DIEBlder,
670670
DebugRangesSectionWriter &TempRangesSectionWriter,
671-
DebugAddrWriter &AddressWriter) {
671+
DebugAddrWriter &AddressWriter,
672+
const std::string &DWOName,
673+
const std::optional<std::string> &DwarfOutputPath) {
672674
DIEBuilder DWODIEBuilder(BC, &(SplitCU).getContext(), DebugNamesTable,
673675
&Unit);
674676
DWODIEBuilder.buildDWOUnit(SplitCU);
675-
std::string DWOName = "";
676-
std::optional<std::string> DwarfOutputPath =
677-
opts::DwarfOutputPath.empty()
678-
? std::nullopt
679-
: std::optional<std::string>(opts::DwarfOutputPath.c_str());
680-
{
681-
std::lock_guard<std::mutex> Lock(AccessMutex);
682-
DWOName = DIEBlder.updateDWONameCompDir(
683-
*StrOffstsWriter, *StrWriter, Unit, DwarfOutputPath, std::nullopt);
684-
}
685677
DebugStrOffsetsWriter DWOStrOffstsWriter(BC);
686678
DebugStrWriter DWOStrWriter((SplitCU).getContext(), true);
687679
DWODIEBuilder.updateDWONameCompDirForTypes(
@@ -759,8 +751,14 @@ void DWARFRewriter::updateDebugInfo() {
759751
DebugRangesSectionWriter *TempRangesSectionWriter =
760752
CU->getVersion() >= 5 ? RangeListsWritersByCU[*DWOId].get()
761753
: LegacyRangesWritersByCU[*DWOId].get();
754+
std::optional<std::string> DwarfOutputPath =
755+
opts::DwarfOutputPath.empty()
756+
? std::nullopt
757+
: std::optional<std::string>(opts::DwarfOutputPath.c_str());
758+
std::string DWOName = DIEBlder.updateDWONameCompDir(
759+
*StrOffstsWriter, *StrWriter, *CU, DwarfOutputPath, std::nullopt);
762760
processSplitCU(*CU, **SplitCU, DIEBlder, *TempRangesSectionWriter,
763-
AddressWriter);
761+
AddressWriter, DWOName, DwarfOutputPath);
764762
}
765763
for (DWARFUnit *CU : DIEBlder.getProcessedCUs())
766764
processMainBinaryCU(*CU, DIEBlder);

0 commit comments

Comments
 (0)