Skip to content

Commit f875c85

Browse files
committed
fixed test
1 parent 2d7d713 commit f875c85

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

lldb/include/lldb/Core/Telemetry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class TelemetryManager : public llvm::telemetry::Manager {
161161
// "start" and "end" entries can be matched up.
162162
// These values don't need to be unique across runs (because they are
163163
// secondary-key), hence a simple counter is sufficent.
164-
std::atomic<int> command_id_seed = 0;
164+
std::atomic<int> m_command_id_seed = 0;
165165
static std::unique_ptr<TelemetryManager> g_instance;
166166
};
167167

lldb/source/Core/Telemetry.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void LLDBBaseTelemetryInfo::serialize(Serializer &serializer) const {
6060
serializer.write("end_time", ToNanosec(end_time.value()));
6161
}
6262
void CommandInfo::serialize(Serializer &serializer) const {
63-
LLDBBaseTelemetryInfo::serializer(serializer);
63+
LLDBBaseTelemetryInfo::serialize(serializer);
6464

6565
serializer.write("target_uuid", target_uuid);
6666
serializer.write("command_id", command_id);
@@ -78,7 +78,7 @@ void DebuggerInfo::serialize(Serializer &serializer) const {
7878
serializer.write("is_exit_entry", is_exit_entry);
7979
}
8080

81-
TelemetryManager::TelemetryManager(std::unique_ptr<Config> config)
81+
TelemetryManager::TelemetryManager(std::unique_ptr<LLDBConfig> config)
8282
: m_config(std::move(config)), m_id(MakeUUID()) {}
8383

8484
llvm::Error TelemetryManager::preDispatch(TelemetryInfo *entry) {
@@ -94,18 +94,20 @@ int TelemetryManager::MakeNextCommandId() {
9494
return m_command_id_seed.fetch_add(1);
9595
}
9696

97-
const LLDBConfig *TelemetryManager::GetConfig() { return m_config.get(); }
98-
99-
class NoOpTelemetryManager : final public TelemetryManager {
100-
public:
97+
class NoOpTelemetryManager : public TelemetryManager {
98+
public:
10199
llvm::Error preDispatch(llvm::telemetry::TelemetryInfo *entry) override {
102100
// Does nothing.
103101
return llvm::Error::success();
104102
}
105103

106-
explicit NoOpTelemetryManager() : TelemetryManager(std::make_unique<LLDBConfig(/*EnableTelemetry*/false, /*DetailedCommand*/false)>) {}
104+
explicit NoOpTelemetryManager()
105+
: TelemetryManager(std::make_unique<LLDBConfig>(
106+
/*EnableTelemetry*/ false, /*DetailedCommand*/ false)) {}
107107

108-
virtual llvm::StringRef GetInstanceName() const { return "NoOpTelemetryManager"; }
108+
virtual llvm::StringRef GetInstanceName() const override {
109+
return "NoOpTelemetryManager";
110+
}
109111

110112
llvm::Error dispatch(llvm::telemetry::TelemetryInfo *entry) override {
111113
// Does nothing.

lldb/source/Interpreter/CommandInterpreter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "Commands/CommandObjectWatchpoint.h"
4747

4848
#include "lldb/Core/Debugger.h"
49+
#include "lldb/Core/Module.h"
4950
#include "lldb/Core/PluginManager.h"
5051
#include "lldb/Core/Telemetry.h"
5152
#include "lldb/Host/StreamFile.h"
@@ -1887,7 +1888,7 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
18871888
bool force_repeat_command) {
18881889
lldb_private::telemetry::ScopedDispatcher<
18891890
lldb_private::telemetry::CommandInfo>
1890-
helper(m_debugger);
1891+
helper(&m_debugger);
18911892
lldb_private::telemetry::TelemetryManager *ins =
18921893
lldb_private::telemetry::TelemetryManager::GetInstance();
18931894
const int command_id = ins->MakeNextCommandId();
@@ -1922,9 +1923,8 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
19221923
cmd_obj ? cmd_obj->GetCommandName() : "<not found>";
19231924
info->command_name = command_name.str();
19241925
info->ret_status = result.GetStatus();
1925-
if (llvm::StringRef error_data = result.GetErrorData();
1926-
!error_data.empty())
1927-
info->error_data = error_data.str();
1926+
if (std::string error_str = result.GetErrorString(); !error_str.empty())
1927+
info->error_data = std::move(error_str);
19281928

19291929
if (ins->GetConfig()->m_detailed_command_telemetry)
19301930
info->args = parsed_command_args;

lldb/unittests/Core/TelemetryTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class FakePlugin : public telemetry::TelemetryManager {
5252
public:
5353
FakePlugin()
5454
: telemetry::TelemetryManager(
55-
std::make_unique<llvm::telemetry::Config>(true)) {}
55+
std::make_unique<telemetry::LLDBConfig>(true, true)) {}
5656

5757
// TelemetryManager interface
5858
llvm::Error preDispatch(llvm::telemetry::TelemetryInfo *entry) override {

0 commit comments

Comments
 (0)