Skip to content

Commit 4716970

Browse files
committed
[lldb] Unify WatchpointSP variable names (NFC)
LLDB uses `_up`, `_sp` and `_wp` suffixes for unique, shared and weak pointers respectively. This can become confusing in combination with watchpoints which are commonly abbreviated to `wp`. Update CommandObjectWatchpoint to use `watch_sp` for all `WatchpointSP` variables. (cherry picked from commit 147b609)
1 parent 307dd7c commit 4716970

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

lldb/source/Commands/CommandObjectWatchpoint.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
using namespace lldb;
3030
using namespace lldb_private;
3131

32-
static void AddWatchpointDescription(Stream *s, Watchpoint *wp,
32+
static void AddWatchpointDescription(Stream &s, Watchpoint &wp,
3333
lldb::DescriptionLevel level) {
34-
s->IndentMore();
35-
wp->GetDescription(s, level);
36-
s->IndentLess();
37-
s->EOL();
34+
s.IndentMore();
35+
wp.GetDescription(&s, level);
36+
s.IndentLess();
37+
s.EOL();
3838
}
3939

4040
static bool CheckTargetForWatchpointOperations(Target *target,
@@ -237,8 +237,8 @@ class CommandObjectWatchpointList : public CommandObjectParsed {
237237
// No watchpoint selected; show info about all currently set watchpoints.
238238
result.AppendMessage("Current watchpoints:");
239239
for (size_t i = 0; i < num_watchpoints; ++i) {
240-
Watchpoint *wp = watchpoints.GetByIndex(i).get();
241-
AddWatchpointDescription(&output_stream, wp, m_options.m_level);
240+
WatchpointSP watch_sp = watchpoints.GetByIndex(i);
241+
AddWatchpointDescription(output_stream, *watch_sp, m_options.m_level);
242242
}
243243
result.SetStatus(eReturnStatusSuccessFinishNoResult);
244244
} else {
@@ -252,9 +252,9 @@ class CommandObjectWatchpointList : public CommandObjectParsed {
252252

253253
const size_t size = wp_ids.size();
254254
for (size_t i = 0; i < size; ++i) {
255-
Watchpoint *wp = watchpoints.FindByID(wp_ids[i]).get();
256-
if (wp)
257-
AddWatchpointDescription(&output_stream, wp, m_options.m_level);
255+
WatchpointSP watch_sp = watchpoints.FindByID(wp_ids[i]);
256+
if (watch_sp)
257+
AddWatchpointDescription(output_stream, *watch_sp, m_options.m_level);
258258
result.SetStatus(eReturnStatusSuccessFinishNoResult);
259259
}
260260
}
@@ -758,8 +758,8 @@ class CommandObjectWatchpointModify : public CommandObjectParsed {
758758
}
759759

760760
if (command.GetArgumentCount() == 0) {
761-
WatchpointSP wp_sp = target->GetLastCreatedWatchpoint();
762-
wp_sp->SetCondition(m_options.m_condition.c_str());
761+
WatchpointSP watch_sp = target->GetLastCreatedWatchpoint();
762+
watch_sp->SetCondition(m_options.m_condition.c_str());
763763
result.SetStatus(eReturnStatusSuccessFinishNoResult);
764764
} else {
765765
// Particular watchpoints selected; set condition on them.
@@ -773,9 +773,9 @@ class CommandObjectWatchpointModify : public CommandObjectParsed {
773773
int count = 0;
774774
const size_t size = wp_ids.size();
775775
for (size_t i = 0; i < size; ++i) {
776-
WatchpointSP wp_sp = watchpoints.FindByID(wp_ids[i]);
777-
if (wp_sp) {
778-
wp_sp->SetCondition(m_options.m_condition.c_str());
776+
WatchpointSP watch_sp = watchpoints.FindByID(wp_ids[i]);
777+
if (watch_sp) {
778+
watch_sp->SetCondition(m_options.m_condition.c_str());
779779
++count;
780780
}
781781
}
@@ -949,19 +949,19 @@ corresponding to the byte size of the data type.");
949949
uint32_t watch_type = m_option_watchpoint.watch_type;
950950

951951
error.Clear();
952-
WatchpointSP wp =
952+
WatchpointSP watch_sp =
953953
target->CreateWatchpoint(addr, size, &compiler_type, watch_type, error);
954-
if (wp) {
955-
wp->SetWatchSpec(command.GetArgumentAtIndex(0));
956-
wp->SetWatchVariable(true);
954+
if (watch_sp) {
955+
watch_sp->SetWatchSpec(command.GetArgumentAtIndex(0));
956+
watch_sp->SetWatchVariable(true);
957957
if (var_sp && var_sp->GetDeclaration().GetFile()) {
958958
StreamString ss;
959959
// True to show fullpath for declaration file.
960960
var_sp->GetDeclaration().DumpStopContext(&ss, true);
961-
wp->SetDeclInfo(std::string(ss.GetString()));
961+
watch_sp->SetDeclInfo(std::string(ss.GetString()));
962962
}
963963
output_stream.Printf("Watchpoint created: ");
964-
wp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
964+
watch_sp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
965965
output_stream.EOL();
966966
result.SetStatus(eReturnStatusSuccessFinishResult);
967967
} else {
@@ -1116,13 +1116,13 @@ class CommandObjectWatchpointSetExpression : public CommandObjectRaw {
11161116
CompilerType compiler_type(valobj_sp->GetCompilerType());
11171117

11181118
Status error;
1119-
WatchpointSP wp =
1119+
WatchpointSP watch_sp =
11201120
target->CreateWatchpoint(addr, size, &compiler_type, watch_type, error);
1121-
if (wp) {
1122-
wp->SetWatchSpec(std::string(expr));
1121+
if (watch_sp) {
1122+
watch_sp->SetWatchSpec(std::string(expr));
11231123
Stream &output_stream = result.GetOutputStream();
11241124
output_stream.Printf("Watchpoint created: ");
1125-
wp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
1125+
watch_sp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
11261126
output_stream.EOL();
11271127
result.SetStatus(eReturnStatusSuccessFinishResult);
11281128
} else {

0 commit comments

Comments
 (0)