[Lldb-commits] [lldb] [lldb] Remove full stop from AppendErrorWithFormat format strings (part 2) (PR #194352)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 27 05:39:08 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: David Spickett (DavidSpickett)
<details>
<summary>Changes</summary>
To fit the style guide: https://llvm.org/docs/CodingStandards.html#error-and-warning-messages
I found these with:
* Find `(\.AppendErrorWithFormat\(([\s\r\n]+)?"(?:(?:\\.|[^"\\])*))\."` and replace with `$1"` using Visual Studio Code.
* Putting a call to `validate_diagnostic` in `AppendErrorWithFormat`.
* Manual inspection.
Note that this change *does not* include a call to `validate_diagnostic` because I do not know what's going to crash on platforms that I haven't tested on.
---
Patch is 36.90 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/194352.diff
12 Files Affected:
- (modified) lldb/source/Commands/CommandObjectMultiword.cpp (+1-1)
- (modified) lldb/source/Commands/CommandObjectProcess.cpp (+3-3)
- (modified) lldb/source/Commands/CommandObjectRegister.cpp (+3-3)
- (modified) lldb/source/Commands/CommandObjectSource.cpp (+10-12)
- (modified) lldb/source/Commands/CommandObjectTarget.cpp (+13-13)
- (modified) lldb/source/Commands/CommandObjectThread.cpp (+31-32)
- (modified) lldb/source/Commands/CommandObjectType.cpp (+13-14)
- (modified) lldb/source/Commands/CommandObjectWatchpoint.cpp (+2-2)
- (modified) lldb/source/Commands/CommandObjectWatchpointCommand.cpp (+2-2)
- (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+7-7)
- (modified) lldb/test/API/functionalities/wrong_commands/TestWrongCommands.py (+1-1)
- (modified) lldb/test/API/python_api/interpreter/TestCommandInterpreterAPI.py (+1-1)
``````````diff
diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp
index 243eacbd67336..937bcfe1e0687 100644
--- a/lldb/source/Commands/CommandObjectMultiword.cpp
+++ b/lldb/source/Commands/CommandObjectMultiword.cpp
@@ -164,7 +164,7 @@ void CommandObjectMultiword::Execute(const char *args_string,
}
if (m_subcommand_dict.empty()) {
- result.AppendErrorWithFormat("'%s' does not have any subcommands.",
+ result.AppendErrorWithFormat("'%s' does not have any subcommands",
GetCommandName().str().c_str());
return;
}
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 32a2b32f294b2..46de9e37d8f2e 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -731,12 +731,12 @@ class CommandObjectProcessContinue : public CommandObjectParsed {
result.SetStatus(eReturnStatusSuccessContinuingNoResult);
}
} else {
- result.AppendErrorWithFormat("Failed to resume process: %s.",
+ result.AppendErrorWithFormat("Failed to resume process: %s",
error.AsCString());
}
} else {
result.AppendErrorWithFormat(
- "Process cannot be continued from its current state (%s).",
+ "Process cannot be continued from its current state (%s)",
StateAsCString(state));
}
}
@@ -1178,7 +1178,7 @@ class CommandObjectProcessSignal : public CommandObjectParsed {
signo = process->GetUnixSignals()->GetSignalNumberFromName(signal_name);
if (signo == LLDB_INVALID_SIGNAL_NUMBER) {
- result.AppendErrorWithFormat("Invalid signal argument '%s'.",
+ result.AppendErrorWithFormat("Invalid signal argument '%s'",
command.GetArgumentAtIndex(0));
} else {
Status error(process->Signal(signo));
diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp
index daccac91ce7e3..29d1cd6dc13e4 100644
--- a/lldb/source/Commands/CommandObjectRegister.cpp
+++ b/lldb/source/Commands/CommandObjectRegister.cpp
@@ -214,7 +214,7 @@ class CommandObjectRegisterRead : public CommandObjectParsed {
print_flags))
strm.Printf("%-12s = error: unavailable\n", reg_info->name);
} else {
- result.AppendErrorWithFormat("Invalid register name '%s'.",
+ result.AppendErrorWithFormat("Invalid register name '%s'",
arg_str.str().c_str());
}
}
@@ -377,7 +377,7 @@ class CommandObjectRegisterWrite : public CommandObjectParsed {
reg_name.str().c_str(), value_str.str().c_str());
}
} else {
- result.AppendErrorWithFormat("Register not found for '%s'.",
+ result.AppendErrorWithFormat("Register not found for '%s'",
reg_name.str().c_str());
}
}
@@ -439,7 +439,7 @@ different for the same register when connected to different debug servers.)");
GetCommandInterpreter().GetDebugger().GetTerminalWidth());
result.SetStatus(eReturnStatusSuccessFinishResult);
} else
- result.AppendErrorWithFormat("No register found with name '%s'.",
+ result.AppendErrorWithFormat("No register found with name '%s'",
reg_name.str().c_str());
}
};
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index bcdc3891a7302..b2896e02264f7 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -403,7 +403,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
}
}
if (num_matches == 0) {
- result.AppendErrorWithFormat("Could not find function named \'%s\'.",
+ result.AppendErrorWithFormat("Could not find function named \'%s\'",
m_options.symbol_name.c_str());
return false;
}
@@ -464,15 +464,15 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
StreamString error_strm;
if (!GetSymbolContextsForAddress(target.GetImages(), m_options.address,
sc_list, error_strm)) {
- result.AppendErrorWithFormat("%s.", error_strm.GetData());
+ result.AppendErrorWithFormat("%s", error_strm.GetData());
return false;
}
ModuleList module_list;
FileSpec file_spec;
if (!DumpLinesInSymbolContexts(result.GetOutputStream(), sc_list,
module_list, file_spec)) {
- result.AppendErrorWithFormat(
- "No modules contain load address 0x%" PRIx64 ".", m_options.address);
+ result.AppendErrorWithFormat("No modules contain load address 0x%" PRIx64,
+ m_options.address);
return false;
}
return true;
@@ -834,7 +834,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
start_file, line_no, column, 0, m_options.num_lines, "",
&result.GetOutputStream(), GetBreakpointLocations());
} else {
- result.AppendErrorWithFormat("Could not find function info for: \"%s\".",
+ result.AppendErrorWithFormat("Could not find function info for: \"%s\"",
m_options.symbol_name.c_str());
}
return 0;
@@ -925,7 +925,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
}
if (sc_list.GetSize() == 0) {
- result.AppendErrorWithFormat("Could not find function named: \"%s\".",
+ result.AppendErrorWithFormat("Could not find function named: \"%s\"",
m_options.symbol_name.c_str());
return;
}
@@ -972,8 +972,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
if (sc_list.GetSize() == 0) {
result.AppendErrorWithFormat(
- "no modules have source information for file address 0x%" PRIx64
- ".",
+ "no modules have source information for file address 0x%" PRIx64,
m_options.address);
return;
}
@@ -994,7 +993,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
Address::DumpStyleModuleWithFileAddress);
result.AppendErrorWithFormat("address resolves to %s, but there "
"is no line table information "
- "available for this address.",
+ "available for this address",
error_strm.GetData());
return;
}
@@ -1003,8 +1002,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
if (sc_list.GetSize() == 0) {
result.AppendErrorWithFormat(
- "no modules contain load address 0x%" PRIx64 ".",
- m_options.address);
+ "no modules contain load address 0x%" PRIx64, m_options.address);
return;
}
}
@@ -1138,7 +1136,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
}
if (num_matches == 0) {
- result.AppendErrorWithFormat("Could not find source file \"%s\".",
+ result.AppendErrorWithFormat("Could not find source file \"%s\"",
m_options.file_name.c_str());
return;
}
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 381a6c2574f12..c1f2a55cc2bd2 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -450,7 +450,7 @@ class CommandObjectTargetCreate : public CommandObjectParsed {
}
} else {
result.AppendErrorWithFormat("'%s' takes exactly one executable path "
- "argument, or use the --core option.",
+ "argument, or use the --core option",
m_cmd_name.c_str());
}
}
@@ -1162,7 +1162,7 @@ class CommandObjectTargetModulesSearchPathsInsert : public CommandObjectParsed {
if (!llvm::to_integer(command.GetArgumentAtIndex(0), insert_idx)) {
result.AppendErrorWithFormat(
- "<index> parameter is not an integer: '%s'.",
+ "<index> parameter is not an integer: '%s'",
command.GetArgumentAtIndex(0));
return;
}
@@ -2180,7 +2180,7 @@ class CommandObjectTargetModulesDumpClangPCMInfo : public CommandObjectParsed {
protected:
void DoExecute(Args &command, CommandReturnObject &result) override {
if (command.GetArgumentCount() != 1) {
- result.AppendErrorWithFormat("'%s' takes exactly one pcm path argument.",
+ result.AppendErrorWithFormat("'%s' takes exactly one pcm path argument",
m_cmd_name.c_str());
return;
}
@@ -3069,7 +3069,7 @@ class CommandObjectTargetModulesLoad
FileSpec *module_spec_file = module_spec.GetFileSpecPtr();
if (module_spec_file) {
module_spec_file->GetPath(path, sizeof(path));
- result.AppendErrorWithFormat("invalid module '%s'.", path);
+ result.AppendErrorWithFormat("invalid module '%s'", path);
} else
result.AppendError("no module spec");
}
@@ -3095,7 +3095,7 @@ class CommandObjectTargetModulesLoad
}
} else {
result.AppendErrorWithFormat(
- "no modules were found that match%s%s%s%s.",
+ "no modules were found that match%s%s%s%s",
path[0] ? " file=" : "", path, !uuid_str.empty() ? " uuid=" : "",
uuid_str.c_str());
}
@@ -3193,12 +3193,12 @@ class CommandObjectTargetModulesList : public CommandObjectParsed {
result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
result.AppendErrorWithFormat(
- "Couldn't find module matching address: 0x%" PRIx64 ".",
+ "Couldn't find module matching address: 0x%" PRIx64,
m_options.m_module_addr);
}
} else {
result.AppendErrorWithFormat(
- "Couldn't find module containing address: 0x%" PRIx64 ".",
+ "Couldn't find module containing address: 0x%" PRIx64,
m_options.m_module_addr);
}
return;
@@ -3580,7 +3580,7 @@ class CommandObjectTargetModulesShowUnwind : public CommandObjectParsed {
}
if (sc_list.GetSize() == 0) {
- result.AppendErrorWithFormat("no unwind data found that matches '%s'.",
+ result.AppendErrorWithFormat("no unwind data found that matches '%s'",
m_options.m_str.c_str());
return;
}
@@ -4336,7 +4336,7 @@ class CommandObjectTargetSymbolsAdd : public CommandObjectParsed {
if (matching_modules.GetSize() > 1) {
result.AppendErrorWithFormat("multiple modules match symbol file '%s', "
"use the --uuid option to resolve the "
- "ambiguity.",
+ "ambiguity",
symfile_path);
return false;
}
@@ -5118,12 +5118,12 @@ it was deleted.
for (size_t i = 0; i < num_args; i++) {
lldb::user_id_t user_id;
if (!llvm::to_integer(command.GetArgumentAtIndex(i), user_id)) {
- result.AppendErrorWithFormat("invalid stop hook id: \"%s\".",
+ result.AppendErrorWithFormat("invalid stop hook id: \"%s\"",
command.GetArgumentAtIndex(i));
return;
}
if (!target.RemoveStopHookByID(user_id)) {
- result.AppendErrorWithFormat("unknown stop hook id: \"%s\".",
+ result.AppendErrorWithFormat("unknown stop hook id: \"%s\"",
command.GetArgumentAtIndex(i));
return;
}
@@ -5169,13 +5169,13 @@ class CommandObjectTargetStopHookEnableDisable : public CommandObjectParsed {
for (size_t i = 0; i < num_args; i++) {
lldb::user_id_t user_id;
if (!llvm::to_integer(command.GetArgumentAtIndex(i), user_id)) {
- result.AppendErrorWithFormat("invalid stop hook id: \"%s\".",
+ result.AppendErrorWithFormat("invalid stop hook id: \"%s\"",
command.GetArgumentAtIndex(i));
return;
}
success = target.SetStopHookActiveStateByID(user_id, m_enable);
if (!success) {
- result.AppendErrorWithFormat("unknown stop hook id: \"%s\".",
+ result.AppendErrorWithFormat("unknown stop hook id: \"%s\"",
command.GetArgumentAtIndex(i));
return;
}
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 96d424be1be14..c51cc837dc47b 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -613,7 +613,7 @@ class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed {
uint32_t step_thread_idx;
if (!llvm::to_integer(thread_idx_cstr, step_thread_idx)) {
- result.AppendErrorWithFormat("invalid thread index '%s'.",
+ result.AppendErrorWithFormat("invalid thread index '%s'",
thread_idx_cstr);
return;
}
@@ -621,7 +621,7 @@ class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed {
process->GetThreadList().FindThreadByIndexID(step_thread_idx).get();
if (thread == nullptr) {
result.AppendErrorWithFormat(
- "Thread index %u is out of range (valid values are 0 - %u).",
+ "Thread index %u is out of range (valid values are 0 - %u)",
step_thread_idx, num_threads);
return;
}
@@ -629,12 +629,12 @@ class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed {
if (m_step_type == eStepTypeScripted) {
if (m_class_options.GetName().empty()) {
- result.AppendErrorWithFormat("empty class name for scripted step.");
+ result.AppendErrorWithFormat("empty class name for scripted step");
return;
} else if (!GetDebugger().GetScriptInterpreter()->CheckObjectExists(
m_class_options.GetName().c_str())) {
result.AppendErrorWithFormat(
- "class for scripted step: \"%s\" does not exist.",
+ "class for scripted step: \"%s\" does not exist",
m_class_options.GetName().c_str());
return;
}
@@ -682,7 +682,7 @@ class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed {
Status error;
Block *block = frame->GetSymbolContext(eSymbolContextBlock).block;
if (!block) {
- result.AppendErrorWithFormat("Could not find the current block.");
+ result.AppendErrorWithFormat("Could not find the current block");
return;
}
@@ -691,7 +691,7 @@ class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed {
block->GetRangeContainingAddress(pc_address, block_range);
if (!block_range.GetBaseAddress().IsValid()) {
result.AppendErrorWithFormat(
- "Could not find the current block address.");
+ "Could not find the current block address");
return;
}
lldb::addr_t pc_offset_in_block =
@@ -857,7 +857,7 @@ class CommandObjectThreadContinue : public CommandObjectParsed {
uint32_t thread_idx;
if (entry.ref().getAsInteger(0, thread_idx)) {
result.AppendErrorWithFormat(
- "invalid thread index argument: \"%s\".", entry.c_str());
+ "invalid thread index argument: \"%s\"", entry.c_str());
return;
}
Thread *thread =
@@ -866,8 +866,7 @@ class CommandObjectThreadContinue : public CommandObjectParsed {
if (thread) {
resume_threads.push_back(thread);
} else {
- result.AppendErrorWithFormat("invalid thread index %u.",
- thread_idx);
+ result.AppendErrorWithFormat("invalid thread index %u", thread_idx);
return;
}
}
@@ -958,7 +957,7 @@ class CommandObjectThreadContinue : public CommandObjectParsed {
}
} else {
result.AppendErrorWithFormat(
- "Process cannot be continued from its current state (%s).",
+ "Process cannot be continued from its current state (%s)",
StateAsCString(state));
}
}
@@ -1082,7 +1081,7 @@ class CommandObjectThreadUntil : public CommandObjectParsed {
for (size_t i = 0; i < num_args; i++) {
uint32_t line_number;
if (!llvm::to_integer(command.GetArgumentAtIndex(i), line_number)) {
- result.AppendErrorWithFormat("invalid line number: '%s'.",
+ result.AppendErrorWithFormat("invalid line number: '%s'",
command.GetArgumentAtIndex(i));
return;
} else
@@ -1105,7 +1104,7 @@ class CommandObjectThreadUntil : public CommandObjectParsed {
if (thread == nullptr) {
const uint32_t num_threads = process->GetThreadList().GetSize();
result.AppendErrorWithFormat(
- "Thread index %u is out of range (valid values are 0 - %u).",
+ "Thread index %u is out of range (valid values are 0 - %u)",
m_options.m_thread_idx, num_threads);
return;
}
@@ -1116,7 +1115,7 @@ class CommandObjectThreadUntil : public CommandObjectParsed {
thread->GetStackFrameAtIndex(m_options.m_frame_idx).get();
if (frame == nullptr) {
result.AppendErrorWithFormat(
- "Frame index %u is out of range for thread id %" PRIu64 ".",
+ "Frame index %u is out of range for thread id %" PRIu64,
m_options.m_frame_idx, thread->GetID());
return;
}
@@ -1134,7 +1133,7 @@ class CommandObjectThreadUntil : public CommandObjectParsed {
if (line_table == nullptr) {
result.AppendErrorWithFormat("Failed to resolve the line table for "
- "frame %u of thread id %" PRIu64 ".",
+ "frame %u of thread id %" PRIu64,
m_options.m_frame_idx, thread->GetID());
return;
}
@@ -1146,7 +1145,7 @@ class CommandObjectThreadUntil : public CommandObjectParsed {
// sure it is valid:
if (!sc.function) {
result.AppendErrorWithFormat("Have debug information but no "
- "function info - can't get until range.");
+ "function info - can't get until range");
return;
}
@@ -1199,10 +1198,10 @@ class CommandObjectThreadUntil : public CommandObjectParsed {
if (address_list.empty()) {
if (found_something)
result.AppendErrorWithFormat(
- "Until target outside of the current function.");
+ "Until target outside of the current function");
else
result.AppendErrorWithFormat(
- "No line entries matching until target.");
+ "No line entries matching until target");
return;
}
@@ -1224,14 +1223,14 @@ class CommandObjectThreadUntil : public CommandObjectParsed {
}
} else {
result.AppendErrorWithFormat("Frame index %u of thread id %" PRIu64
- " has no debug information.",
+ " has no debug information",
m_options.m_frame_idx, thread->GetID());
return;
}
if (!process->GetThreadList().SetSelectedThreadByID(thread->GetID())) {
result.AppendErrorWithFormat(
- "Fai...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/194352
More information about the lldb-commits
mailing list