Skip to content

Commit 9f9134e

Browse files
committed
Final tidy up feedback and run clang-format
1 parent 479e6b5 commit 9f9134e

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

lldb/include/lldb/Target/Statistics.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ struct StatisticsOptions {
182182
class SummaryStatistics {
183183
public:
184184
explicit SummaryStatistics(std::string name, std::string impl_type)
185-
: m_total_time(), m_impl_type(std::move(impl_type)), m_name(std::move(name)), m_count(0) {}
185+
: m_total_time(), m_impl_type(std::move(impl_type)),
186+
m_name(std::move(name)), m_count(0) {}
186187

187188
std::string GetName() const { return m_name; };
188189
double GetTotalTime() const { return m_total_time.get().count(); }
@@ -237,7 +238,7 @@ class SummaryStatisticsCache {
237238
GetSummaryStatisticsForProvider(lldb_private::TypeSummaryImpl &provider) {
238239
std::lock_guard<std::mutex> guard(m_map_mutex);
239240
if (auto iterator = m_summary_stats_map.find(provider.GetName());
240-
iterator != m_summary_stats_map.end())
241+
iterator != m_summary_stats_map.end())
241242
return iterator->second;
242243

243244
auto it = m_summary_stats_map.try_emplace(

lldb/source/DataFormatters/TypeSummary.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ ScriptSummaryFormat::ScriptSummaryFormat(const TypeSummaryImpl::Flags &flags,
157157
const char *python_script)
158158
: TypeSummaryImpl(Kind::eScript, flags), m_function_name(),
159159
m_python_script(), m_script_function_sp() {
160-
// Take preference in the python script name over the function name.;
160+
// Take preference in the python script name over the function name.
161161
if (function_name) {
162162
m_function_name.assign(function_name);
163163
m_script_formatter_name = function_name;
@@ -167,6 +167,8 @@ ScriptSummaryFormat::ScriptSummaryFormat(const TypeSummaryImpl::Flags &flags,
167167
m_script_formatter_name = python_script;
168168
}
169169

170+
// Python scripts include the tabbing of the function def so we remove the
171+
// leading spaces.
170172
m_script_formatter_name = m_script_formatter_name.erase(
171173
0, m_script_formatter_name.find_first_not_of(' '));
172174
}

lldb/unittests/Target/SummaryStatisticsTest.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ using Duration = std::chrono::duration<double>;
1313

1414
class DummySummaryImpl : public lldb_private::TypeSummaryImpl {
1515
public:
16-
DummySummaryImpl(Duration sleepTime)
16+
DummySummaryImpl()
1717
: TypeSummaryImpl(TypeSummaryImpl::Kind::eSummaryString,
18-
TypeSummaryImpl::Flags()),
19-
m_sleepTime(sleepTime) {}
18+
TypeSummaryImpl::Flags()) {}
2019

2120
std::string GetName() override { return "DummySummary"; }
2221

@@ -28,23 +27,18 @@ class DummySummaryImpl : public lldb_private::TypeSummaryImpl {
2827
const TypeSummaryOptions &options) override {
2928
return false;
3029
}
31-
32-
void FakeFormat() { std::this_thread::sleep_for(m_sleepTime); }
33-
34-
private:
35-
Duration m_sleepTime;
3630
};
3731

3832
TEST(MultithreadFormatting, Multithread) {
3933
SummaryStatisticsCache statistics_cache;
40-
DummySummaryImpl summary(Duration(1));
34+
DummySummaryImpl summary;
4135
std::vector<std::thread> threads;
4236
for (int i = 0; i < 10; ++i) {
4337
threads.emplace_back(std::thread([&statistics_cache, &summary]() {
4438
auto sp = statistics_cache.GetSummaryStatisticsForProvider(summary);
4539
{
4640
SummaryStatistics::SummaryInvocation invocation(sp);
47-
summary.FakeFormat();
41+
std::this_thread::sleep_for(Duration(1));
4842
}
4943
}));
5044
}

0 commit comments

Comments
 (0)