[Lldb-commits] [lldb] 147b609 - [lldb] Unify WatchpointSP variable names (NFC)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 17 10:09:47 PDT 2023
Author: Jonas Devlieghere
Date: 2023-03-17T10:09:40-07:00
New Revision: 147b60964064b17163f1788dcd24c366ba3d54b1
URL: https://github.com/llvm/llvm-project/commit/147b60964064b17163f1788dcd24c366ba3d54b1
DIFF: https://github.com/llvm/llvm-project/commit/147b60964064b17163f1788dcd24c366ba3d54b1.diff
LOG: [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.
Added:
Modified:
lldb/source/Commands/CommandObjectWatchpoint.cpp
Removed:
################################################################################
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index 9463050f40b36..8b8c196e4505b 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -29,12 +29,12 @@
using namespace lldb;
using namespace lldb_private;
-static void AddWatchpointDescription(Stream *s, Watchpoint *wp,
+static void AddWatchpointDescription(Stream &s, Watchpoint &wp,
lldb::DescriptionLevel level) {
- s->IndentMore();
- wp->GetDescription(s, level);
- s->IndentLess();
- s->EOL();
+ s.IndentMore();
+ wp.GetDescription(&s, level);
+ s.IndentLess();
+ s.EOL();
}
static bool CheckTargetForWatchpointOperations(Target *target,
@@ -237,8 +237,8 @@ class CommandObjectWatchpointList : public CommandObjectParsed {
// No watchpoint selected; show info about all currently set watchpoints.
result.AppendMessage("Current watchpoints:");
for (size_t i = 0; i < num_watchpoints; ++i) {
- Watchpoint *wp = watchpoints.GetByIndex(i).get();
- AddWatchpointDescription(&output_stream, wp, m_options.m_level);
+ WatchpointSP watch_sp = watchpoints.GetByIndex(i);
+ AddWatchpointDescription(output_stream, *watch_sp, m_options.m_level);
}
result.SetStatus(eReturnStatusSuccessFinishNoResult);
} else {
@@ -252,9 +252,9 @@ class CommandObjectWatchpointList : public CommandObjectParsed {
const size_t size = wp_ids.size();
for (size_t i = 0; i < size; ++i) {
- Watchpoint *wp = watchpoints.FindByID(wp_ids[i]).get();
- if (wp)
- AddWatchpointDescription(&output_stream, wp, m_options.m_level);
+ WatchpointSP watch_sp = watchpoints.FindByID(wp_ids[i]);
+ if (watch_sp)
+ AddWatchpointDescription(output_stream, *watch_sp, m_options.m_level);
result.SetStatus(eReturnStatusSuccessFinishNoResult);
}
}
@@ -758,8 +758,8 @@ class CommandObjectWatchpointModify : public CommandObjectParsed {
}
if (command.GetArgumentCount() == 0) {
- WatchpointSP wp_sp = target->GetLastCreatedWatchpoint();
- wp_sp->SetCondition(m_options.m_condition.c_str());
+ WatchpointSP watch_sp = target->GetLastCreatedWatchpoint();
+ watch_sp->SetCondition(m_options.m_condition.c_str());
result.SetStatus(eReturnStatusSuccessFinishNoResult);
} else {
// Particular watchpoints selected; set condition on them.
@@ -773,9 +773,9 @@ class CommandObjectWatchpointModify : public CommandObjectParsed {
int count = 0;
const size_t size = wp_ids.size();
for (size_t i = 0; i < size; ++i) {
- WatchpointSP wp_sp = watchpoints.FindByID(wp_ids[i]);
- if (wp_sp) {
- wp_sp->SetCondition(m_options.m_condition.c_str());
+ WatchpointSP watch_sp = watchpoints.FindByID(wp_ids[i]);
+ if (watch_sp) {
+ watch_sp->SetCondition(m_options.m_condition.c_str());
++count;
}
}
@@ -949,19 +949,19 @@ corresponding to the byte size of the data type.");
uint32_t watch_type = m_option_watchpoint.watch_type;
error.Clear();
- WatchpointSP wp =
+ WatchpointSP watch_sp =
target->CreateWatchpoint(addr, size, &compiler_type, watch_type, error);
- if (wp) {
- wp->SetWatchSpec(command.GetArgumentAtIndex(0));
- wp->SetWatchVariable(true);
+ if (watch_sp) {
+ watch_sp->SetWatchSpec(command.GetArgumentAtIndex(0));
+ watch_sp->SetWatchVariable(true);
if (var_sp && var_sp->GetDeclaration().GetFile()) {
StreamString ss;
// True to show fullpath for declaration file.
var_sp->GetDeclaration().DumpStopContext(&ss, true);
- wp->SetDeclInfo(std::string(ss.GetString()));
+ watch_sp->SetDeclInfo(std::string(ss.GetString()));
}
output_stream.Printf("Watchpoint created: ");
- wp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
+ watch_sp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
output_stream.EOL();
result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
@@ -1116,13 +1116,13 @@ class CommandObjectWatchpointSetExpression : public CommandObjectRaw {
CompilerType compiler_type(valobj_sp->GetCompilerType());
Status error;
- WatchpointSP wp =
+ WatchpointSP watch_sp =
target->CreateWatchpoint(addr, size, &compiler_type, watch_type, error);
- if (wp) {
- wp->SetWatchSpec(std::string(expr));
+ if (watch_sp) {
+ watch_sp->SetWatchSpec(std::string(expr));
Stream &output_stream = result.GetOutputStream();
output_stream.Printf("Watchpoint created: ");
- wp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
+ watch_sp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
output_stream.EOL();
result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
More information about the lldb-commits
mailing list