Skip to content

Commit f025bdb

Browse files
committed
formatting
1 parent f875c85 commit f025bdb

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

lldb/include/lldb/Core/Telemetry.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
#include "lldb/Interpreter/CommandReturnObject.h"
1414
#include "lldb/Utility/LLDBLog.h"
1515
#include "lldb/Utility/StructuredData.h"
16-
#include "lldb/Utility/LLDBLog.h"
1716
#include "lldb/lldb-forward.h"
1817
#include "llvm/ADT/FunctionExtras.h"
1918
#include "llvm/ADT/StringExtras.h"
2019
#include "llvm/ADT/StringRef.h"
21-
#include "llvm/ADT/FunctionExtras.h"
2220
#include "llvm/Support/JSON.h"
2321
#include "llvm/Telemetry/Telemetry.h"
2422
#include <atomic>
@@ -31,14 +29,15 @@
3129
namespace lldb_private {
3230
namespace telemetry {
3331

34-
3532
struct LLDBConfig : public ::llvm::telemetry::Config {
36-
// If true, we will collect full details about a debug command (eg., args and original command).
37-
// Note: This may contain PII, hence can only be enabled by the vendor while creating the Manager.
33+
// If true, we will collect full details about a debug command (eg., args and
34+
// original command). Note: This may contain PII, hence can only be enabled by
35+
// the vendor while creating the Manager.
3836
const bool m_detailed_command_telemetry;
3937

4038
explicit LLDBConfig(bool enable_telemetry, bool detailed_command_telemetry)
41-
: ::llvm::telemetry::Config(enable_telemetry), m_detailed_command_telemetry(detailed_command_telemetry) {}
39+
: ::llvm::telemetry::Config(enable_telemetry),
40+
m_detailed_command_telemetry(detailed_command_telemetry) {}
4241
};
4342

4443
// We expect each (direct) subclass of LLDBTelemetryInfo to
@@ -94,7 +93,8 @@ struct CommandInfo : public LLDBBaseTelemetryInfo {
9493
// Eg., "breakpoint set"
9594
std::string command_name;
9695
// !!NOTE!! These two fields are not collected by default due to PII risks.
97-
// Vendor may allow them by setting the LLDBConfig::m_detailed_command_telemetry.
96+
// Vendor may allow them by setting the
97+
// LLDBConfig::m_detailed_command_telemetry.
9898
std::string original_command;
9999
std::string args;
100100
// Return status of a command and any error description in case of error.
@@ -103,14 +103,17 @@ struct CommandInfo : public LLDBBaseTelemetryInfo {
103103

104104
CommandInfo() = default;
105105

106-
llvm::telemetry::KindType getKind() const override { return LLDBEntryKind::CommandInfo; }
106+
llvm::telemetry::KindType getKind() const override {
107+
return LLDBEntryKind::CommandInfo;
108+
}
107109

108110
static bool classof(const llvm::telemetry::TelemetryInfo *T) {
109-
return (T->getKind() & LLDBEntryKind::CommandInfo) == LLDBEntryKind::CommandInfo;
111+
return (T->getKind() & LLDBEntryKind::CommandInfo) ==
112+
LLDBEntryKind::CommandInfo;
110113
}
111114

112115
void serialize(llvm::telemetry::Serializer &serializer) const override;
113-
};
116+
};
114117

115118
struct DebuggerInfo : public LLDBBaseTelemetryInfo {
116119
std::string lldb_version;
@@ -142,7 +145,7 @@ class TelemetryManager : public llvm::telemetry::Manager {
142145
/// Returns the next unique ID to assign to a command entry.
143146
int MakeNextCommandId();
144147

145-
const LLDBConfig* GetConfig() { return m_config.get(); }
148+
const LLDBConfig *GetConfig() { return m_config.get(); }
146149

147150
virtual llvm::StringRef GetInstanceName() const = 0;
148151

@@ -155,7 +158,7 @@ class TelemetryManager : public llvm::telemetry::Manager {
155158

156159
private:
157160
std::unique_ptr<LLDBConfig> m_config;
158-
// Each instance of a TelemetryManager is assigned a unique ID.
161+
// Each instance of a TelemetryManager is assigned a unique ID.
159162
const std::string m_id;
160163
// We assign each command (in the same session) a unique id so that their
161164
// "start" and "end" entries can be matched up.
@@ -216,8 +219,7 @@ template <typename Info> struct ScopedDispatcher {
216219
private:
217220
SteadyTimePoint m_start_time;
218221
llvm::unique_function<void(Info *info)> m_final_callback;
219-
Debugger * debugger;
220-
222+
Debugger *debugger;
221223
};
222224

223225
} // namespace telemetry

lldb/source/Core/Telemetry.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,21 @@ class NoOpTelemetryManager : public TelemetryManager {
111111

112112
llvm::Error dispatch(llvm::telemetry::TelemetryInfo *entry) override {
113113
// Does nothing.
114-
return llvm::Error::success();
114+
return llvm::Error::success();
115115
}
116116

117117
static NoOpTelemetryManager *GetInstance() {
118-
static std::unique_ptr<NoOpTelemetryManager> g_ins = std::make_unique<NoOpTelemetryManager>();
118+
static std::unique_ptr<NoOpTelemetryManager> g_ins =
119+
std::make_unique<NoOpTelemetryManager>();
119120
return g_ins.get();
120121
}
121122
};
122123

123124
std::unique_ptr<TelemetryManager> TelemetryManager::g_instance = nullptr;
124125
TelemetryManager *TelemetryManager::GetInstance() {
125-
// If Telemetry is disabled or if there is no default instance, then use the NoOp manager.
126-
// We use a dummy instance to avoid having to do nullchecks in various places.
126+
// If Telemetry is disabled or if there is no default instance, then use the
127+
// NoOp manager. We use a dummy instance to avoid having to do nullchecks in
128+
// various places.
127129
if (!Config::BuildTimeEnableTelemetry || !g_instance)
128130
return NoOpTelemetryManager::GetInstance();
129131
return g_instance.get();

lldb/source/Interpreter/CommandInterpreter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1901,7 +1901,7 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
19011901

19021902
helper.DispatchNow([&](lldb_private::telemetry::CommandInfo *info) {
19031903
info->command_id = command_id;
1904-
if (Target* target = GetExecutionContext().GetTargetPtr()) {
1904+
if (Target *target = GetExecutionContext().GetTargetPtr()) {
19051905
// If we have a target attached to this command, then get the UUID.
19061906
info->target_uuid =
19071907
target->GetExecutableModule() != nullptr

0 commit comments

Comments
 (0)