Skip to content

Clean up the GSym error aggregation code, and pass the aggregator by reference #89688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions llvm/include/llvm/DebugInfo/GSYM/OutputAggregator.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ class OutputAggregator {
}

// For multi-threaded usage, we can collect stuff in another aggregator,
// then merge it in here
// then merge it in here. Note that this is *not* thread safe. It is up to
// the caller to ensure that this is only called from one thread at a time.
void Merge(const OutputAggregator &other) {
for (auto &&[name, count] : other.Aggregation) {
auto it = Aggregation.find(name);
if (it == Aggregation.end())
Aggregation.emplace(name, count);
else
auto [it, inserted] = Aggregation.emplace(name, count);
if (!inserted)
it->second += count;
}
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ Error DwarfTransformer::convert(uint32_t NumThreads, OutputAggregator &Out) {
DWARFDie Die = getDie(*CU);
if (Die) {
CUInfo CUI(DICtx, dyn_cast<DWARFCompileUnit>(CU.get()));
pool.async([this, CUI, &LogMutex, Out, Die]() mutable {
pool.async([this, CUI, &LogMutex, &Out, Die]() mutable {
std::string storage;
raw_string_ostream StrStream(storage);
OutputAggregator ThreadOut(Out.GetOS() ? &StrStream : nullptr);
Expand Down
Loading