Skip to content

Commit 72c6f2f

Browse files
committed
Reformat code and add note
1 parent 4a2f234 commit 72c6f2f

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

lldb/include/lldb/Target/Statistics.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ struct StatisticsOptions {
178178
};
179179

180180
/// A class that represents statistics about a TypeSummaryProviders invocations
181+
/// \note All members of this class need to be accessed in a thread safe manner
181182
class SummaryStatistics {
182183
public:
183184
explicit SummaryStatistics(std::string name, std::string impl_type)
@@ -234,16 +235,15 @@ class SummaryStatisticsCache {
234235
SummaryStatisticsSP
235236
GetSummaryStatisticsForProviderName(lldb_private::TypeSummaryImpl &provider) {
236237
std::lock_guard<std::mutex> guard(m_map_mutex);
237-
auto iterator = m_summary_stats_map.find(provider.GetName());
238-
if (iterator != m_summary_stats_map.end())
238+
if (auto iterator = m_summary_stats_map.find(provider.GetName());
239+
iterator != m_summary_stats_map.end())
239240
return iterator->second;
240-
else {
241-
auto it = m_summary_stats_map.try_emplace(
242-
provider.GetName(),
243-
std::make_shared<SummaryStatistics>(provider.GetName(),
244-
provider.GetSummaryKindName()));
245-
return it.first->second;
246-
}
241+
242+
auto it = m_summary_stats_map.try_emplace(
243+
provider.GetName(),
244+
std::make_shared<SummaryStatistics>(provider.GetName(),
245+
provider.GetSummaryKindName()));
246+
return it.first->second;
247247
}
248248

249249
llvm::json::Value ToJSON();

lldb/source/Core/ValueObject.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,7 @@ bool ValueObject::GetSummaryAsCString(TypeSummaryImpl *summary_ptr,
616616
// the synthetic children being
617617
// up-to-date (e.g. ${svar%#})
618618

619-
TargetSP target_sp = GetExecutionContextRef().GetTargetSP();
620-
if (target_sp) {
619+
if (TargetSP target_sp = GetExecutionContextRef().GetTargetSP()) {
621620
// Get Shared pointer to the summary statistics container
622621
SummaryStatisticsSP stats_sp =
623622
target_sp->GetSummaryStatisticsCache()

0 commit comments

Comments
 (0)