Skip to content

Commit 5a40af3

Browse files
author
Kevin Frei
committed
Code formatting
1 parent 2cdc496 commit 5a40af3

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -496,42 +496,36 @@ void DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
496496
}
497497

498498
Error DWARFUnit::tryExtractDIEsIfNeeded(bool CUDieOnly) {
499-
// read-lock:
500499
{
501500
llvm::sys::ScopedReader Lock(m_cu_die_array_mutex);
502-
if ((CUDieOnly && !DieArray.empty()) ||
503-
DieArray.size() > 1)
501+
if ((CUDieOnly && !DieArray.empty()) || DieArray.size() > 1)
504502
return Error::success(); // Already parsed.
505503
}
506504
bool HasCUDie = false;
507-
// write-lock:
508505
{
509506
llvm::sys::ScopedWriter Lock(m_cu_die_array_mutex);
510-
if ((CUDieOnly && !DieArray.empty()) ||
511-
DieArray.size() > 1)
507+
if ((CUDieOnly && !DieArray.empty()) || DieArray.size() > 1)
512508
return Error::success(); // Already parsed.
513509
HasCUDie = !DieArray.empty();
514510
extractDIEsToVector(!HasCUDie, !CUDieOnly, DieArray);
515511
}
512+
{
513+
llvm::sys::ScopedReader Lock(m_all_die_array_mutex);
514+
if (DieArray.empty())
515+
return Error::success();
516516

517-
// read-lock:
518-
{
519-
llvm::sys::ScopedReader Lock(m_all_die_array_mutex);
517+
// If CU DIE was just parsed, copy several attribute values from it.
518+
if (HasCUDie)
519+
return Error::success();
520+
}
521+
llvm::sys::ScopedWriter Lock(m_all_die_array_mutex);
520522
if (DieArray.empty())
521523
return Error::success();
522524

523525
// If CU DIE was just parsed, copy several attribute values from it.
524526
if (HasCUDie)
525527
return Error::success();
526-
}
527-
// write-lock:
528-
llvm::sys::ScopedWriter Lock(m_all_die_array_mutex);
529-
if (DieArray.empty())
530-
return Error::success();
531528

532-
// If CU DIE was just parsed, copy several attribute values from it.
533-
if (HasCUDie)
534-
return Error::success();
535529
DWARFDie UnitDie(this, &DieArray[0]);
536530
if (std::optional<uint64_t> DWOId =
537531
toUnsigned(UnitDie.find(DW_AT_GNU_dwo_id)))

llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,9 @@ Error DwarfTransformer::convert(uint32_t NumThreads, OutputAggregator &Out) {
589589
handleDie(Out, CUI, Die);
590590
// Release the line table, once we're done.
591591
DICtx.clearLineTableForUnit(CU.get());
592+
// Free any DIEs that were allocated by the DWARF parser.
593+
// If/when they're needed by other CU's, they'll be recreated.
594+
CU->clearDIEs(false);
592595
}
593596
} else {
594597
// LLVM Dwarf parser is not thread-safe and we need to parse all DWARF up
@@ -631,7 +634,6 @@ Error DwarfTransformer::convert(uint32_t NumThreads, OutputAggregator &Out) {
631634
Out << storage;
632635
}
633636
Out.Merge(ThreadOut);
634-
635637
});
636638
}
637639
}

0 commit comments

Comments
 (0)