Skip to content

Commit 7e2901b

Browse files
committed
[lldb] Correct style of error messages
The LLVM Style Guide says the following about error and warning messages [1]: > [T]o match error message styles commonly produced by other tools, > start the first sentence with a lowercase letter, and finish the last > sentence without a period, if it would end in one otherwise. I often provide this feedback during code review, but we still have a bunch of places where we have inconsistent error message, which bothers me as a user. This PR identifies a handful of those places and updates the messages to be consistent. [1] https://llvm.org/docs/CodingStandards.html#error-and-warning-messages
1 parent d6a72cb commit 7e2901b

27 files changed

+84
-84
lines changed

lldb/source/API/SBCommandInterpreter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ void SBCommandInterpreter::HandleCommandsFromFile(
208208
LLDB_INSTRUMENT_VA(this, file, override_context, options, result);
209209

210210
if (!IsValid()) {
211-
result->AppendError("SBCommandInterpreter is not valid.");
211+
result->AppendError("SBCommandInterpreter is not valid");
212212
return;
213213
}
214214

lldb/source/Commands/CommandObjectBreakpoint.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -609,12 +609,12 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
609609
const size_t num_files = m_options.m_filenames.GetSize();
610610
if (num_files == 0) {
611611
if (!GetDefaultFile(target, file, result)) {
612-
result.AppendError("No file supplied and no default file available.");
612+
result.AppendError("no file supplied and no default file available");
613613
return;
614614
}
615615
} else if (num_files > 1) {
616-
result.AppendError("Only one file at a time is allowed for file and "
617-
"line breakpoints.");
616+
result.AppendError("only one file at a time is allowed for file and "
617+
"line breakpoints");
618618
return;
619619
} else
620620
file = m_options.m_filenames.GetFileSpecAtIndex(0);
@@ -784,7 +784,7 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
784784
}
785785
result.SetStatus(eReturnStatusSuccessFinishResult);
786786
} else if (!bp_sp) {
787-
result.AppendError("Breakpoint creation failed: No breakpoint created.");
787+
result.AppendError("breakpoint creation failed: no breakpoint created");
788788
}
789789
}
790790

@@ -940,7 +940,7 @@ class CommandObjectBreakpointEnable : public CommandObjectParsed {
940940
size_t num_breakpoints = breakpoints.GetSize();
941941

942942
if (num_breakpoints == 0) {
943-
result.AppendError("No breakpoints exist to be enabled.");
943+
result.AppendError("no breakpoints exist to be enabled");
944944
return;
945945
}
946946

@@ -1048,7 +1048,7 @@ the second re-enables the first location.");
10481048
size_t num_breakpoints = breakpoints.GetSize();
10491049

10501050
if (num_breakpoints == 0) {
1051-
result.AppendError("No breakpoints exist to be disabled.");
1051+
result.AppendError("no breakpoints exist to be disabled");
10521052
return;
10531053
}
10541054

@@ -1224,7 +1224,7 @@ class CommandObjectBreakpointList : public CommandObjectParsed {
12241224
}
12251225
result.SetStatus(eReturnStatusSuccessFinishNoResult);
12261226
} else {
1227-
result.AppendError("Invalid breakpoint ID.");
1227+
result.AppendError("invalid breakpoint ID");
12281228
}
12291229
}
12301230
}
@@ -1318,7 +1318,7 @@ class CommandObjectBreakpointClear : public CommandObjectParsed {
13181318

13191319
// Early return if there's no breakpoint at all.
13201320
if (num_breakpoints == 0) {
1321-
result.AppendError("Breakpoint clear: No breakpoint cleared.");
1321+
result.AppendError("breakpoint clear: no breakpoint cleared");
13221322
return;
13231323
}
13241324

@@ -1364,7 +1364,7 @@ class CommandObjectBreakpointClear : public CommandObjectParsed {
13641364
output_stream.EOL();
13651365
result.SetStatus(eReturnStatusSuccessFinishNoResult);
13661366
} else {
1367-
result.AppendError("Breakpoint clear: No breakpoint cleared.");
1367+
result.AppendError("breakpoint clear: no breakpoint cleared");
13681368
}
13691369
}
13701370

@@ -1459,7 +1459,7 @@ class CommandObjectBreakpointDelete : public CommandObjectParsed {
14591459
size_t num_breakpoints = breakpoints.GetSize();
14601460

14611461
if (num_breakpoints == 0) {
1462-
result.AppendError("No breakpoints exist to be deleted.");
1462+
result.AppendError("no breakpoints exist to be deleted");
14631463
return;
14641464
}
14651465

@@ -1504,7 +1504,7 @@ class CommandObjectBreakpointDelete : public CommandObjectParsed {
15041504
}
15051505
}
15061506
if (valid_bp_ids.GetSize() == 0) {
1507-
result.AppendError("No disabled breakpoints.");
1507+
result.AppendError("no disabled breakpoints");
15081508
return;
15091509
}
15101510
} else {
@@ -1712,7 +1712,7 @@ class CommandObjectBreakpointNameConfigure : public CommandObjectParsed {
17121712

17131713
const size_t argc = command.GetArgumentCount();
17141714
if (argc == 0) {
1715-
result.AppendError("No names provided.");
1715+
result.AppendError("no names provided");
17161716
return;
17171717
}
17181718

@@ -1799,7 +1799,7 @@ class CommandObjectBreakpointNameAdd : public CommandObjectParsed {
17991799
protected:
18001800
void DoExecute(Args &command, CommandReturnObject &result) override {
18011801
if (!m_name_options.m_name.OptionWasSet()) {
1802-
result.AppendError("No name option provided.");
1802+
result.AppendError("no name option provided");
18031803
return;
18041804
}
18051805

@@ -1813,7 +1813,7 @@ class CommandObjectBreakpointNameAdd : public CommandObjectParsed {
18131813

18141814
size_t num_breakpoints = breakpoints.GetSize();
18151815
if (num_breakpoints == 0) {
1816-
result.AppendError("No breakpoints, cannot add names.");
1816+
result.AppendError("no breakpoints, cannot add names");
18171817
return;
18181818
}
18191819

@@ -1825,7 +1825,7 @@ class CommandObjectBreakpointNameAdd : public CommandObjectParsed {
18251825

18261826
if (result.Succeeded()) {
18271827
if (valid_bp_ids.GetSize() == 0) {
1828-
result.AppendError("No breakpoints specified, cannot add names.");
1828+
result.AppendError("no breakpoints specified, cannot add names");
18291829
return;
18301830
}
18311831
size_t num_valid_ids = valid_bp_ids.GetSize();
@@ -1873,7 +1873,7 @@ class CommandObjectBreakpointNameDelete : public CommandObjectParsed {
18731873
protected:
18741874
void DoExecute(Args &command, CommandReturnObject &result) override {
18751875
if (!m_name_options.m_name.OptionWasSet()) {
1876-
result.AppendError("No name option provided.");
1876+
result.AppendError("no name option provided");
18771877
return;
18781878
}
18791879

@@ -1887,7 +1887,7 @@ class CommandObjectBreakpointNameDelete : public CommandObjectParsed {
18871887

18881888
size_t num_breakpoints = breakpoints.GetSize();
18891889
if (num_breakpoints == 0) {
1890-
result.AppendError("No breakpoints, cannot delete names.");
1890+
result.AppendError("no breakpoints, cannot delete names");
18911891
return;
18921892
}
18931893

@@ -1899,7 +1899,7 @@ class CommandObjectBreakpointNameDelete : public CommandObjectParsed {
18991899

19001900
if (result.Succeeded()) {
19011901
if (valid_bp_ids.GetSize() == 0) {
1902-
result.AppendError("No breakpoints specified, cannot delete names.");
1902+
result.AppendError("no breakpoints specified, cannot delete names");
19031903
return;
19041904
}
19051905
ConstString bp_name(m_name_options.m_name.GetCurrentValue());

lldb/source/Commands/CommandObjectCommands.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ other command as far as there is only one alias command match.");
418418
if ((pos != std::string::npos) && (pos > 0))
419419
raw_command_string = raw_command_string.substr(pos);
420420
} else {
421-
result.AppendError("Error parsing command string. No alias created.");
421+
result.AppendError("error parsing command string. No alias created");
422422
return;
423423
}
424424

@@ -2888,7 +2888,7 @@ class CommandObjectCommandsContainerDelete : public CommandObjectParsed {
28882888
size_t num_args = command.GetArgumentCount();
28892889

28902890
if (num_args == 0) {
2891-
result.AppendError("No command was specified.");
2891+
result.AppendError("no command was specified");
28922892
return;
28932893
}
28942894

lldb/source/Commands/CommandObjectFrame.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,15 @@ class CommandObjectFrameDiagnose : public CommandObjectParsed {
140140
} else {
141141
StopInfoSP stop_info_sp = thread->GetStopInfo();
142142
if (!stop_info_sp) {
143-
result.AppendError("No arguments provided, and no stop info.");
143+
result.AppendError("no arguments provided, and no stop info");
144144
return;
145145
}
146146

147147
valobj_sp = StopInfo::GetCrashingDereference(stop_info_sp);
148148
}
149149

150150
if (!valobj_sp) {
151-
result.AppendError("No diagnosis available.");
151+
result.AppendError("no diagnosis available");
152152
return;
153153
}
154154

@@ -310,7 +310,7 @@ class CommandObjectFrameSelect : public CommandObjectParsed {
310310
if (frame_idx == 0) {
311311
// If you are already at the bottom of the stack, then just warn
312312
// and don't reset the frame.
313-
result.AppendError("Already at the bottom of the stack.");
313+
result.AppendError("already at the bottom of the stack");
314314
return;
315315
} else
316316
frame_idx = 0;
@@ -335,7 +335,7 @@ class CommandObjectFrameSelect : public CommandObjectParsed {
335335
if (frame_idx == num_frames - 1) {
336336
// If we are already at the top of the stack, just warn and don't
337337
// reset the frame.
338-
result.AppendError("Already at the top of the stack.");
338+
result.AppendError("already at the top of the stack");
339339
return;
340340
} else
341341
frame_idx = num_frames - 1;

lldb/source/Commands/CommandObjectLog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ class CommandObjectLogTimerIncrement : public CommandObjectParsed {
547547
Timer::SetQuiet(!increment);
548548
result.SetStatus(eReturnStatusSuccessFinishNoResult);
549549
} else
550-
result.AppendError("Could not convert increment value to boolean.");
550+
result.AppendError("could not convert increment value to boolean");
551551
}
552552

553553
if (!result.Succeeded()) {

lldb/source/Commands/CommandObjectMultiword.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void CommandObjectMultiword::Execute(const char *args_string,
159159

160160
auto sub_command = args[0].ref();
161161
if (sub_command.empty()) {
162-
result.AppendError("Need to specify a non-empty subcommand.");
162+
result.AppendError("need to specify a non-empty subcommand");
163163
return;
164164
}
165165

lldb/source/Commands/CommandObjectProcess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach {
259259
if (!exe_module_sp)
260260
exe_module_sp = target->GetExecutableModule();
261261
if (!exe_module_sp) {
262-
result.AppendWarning("Could not get executable module after launch.");
262+
result.AppendWarning("could not get executable module after launch");
263263
} else {
264264

265265
const char *archname =

lldb/source/Commands/CommandObjectSource.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
513513
"No selected frame to use to find the default source.");
514514
return false;
515515
} else if (!cur_frame->HasDebugInformation()) {
516-
result.AppendError("No debug info for the selected frame.");
516+
result.AppendError("no debug info for the selected frame");
517517
return false;
518518
} else {
519519
const SymbolContext &sc =
@@ -553,11 +553,11 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
553553
}
554554
}
555555
if (!m_module_list.GetSize()) {
556-
result.AppendError("No modules match the input.");
556+
result.AppendError("no modules match the input");
557557
return;
558558
}
559559
} else if (target.GetImages().GetSize() == 0) {
560-
result.AppendError("The target has no associated executable images.");
560+
result.AppendError("the target has no associated executable images");
561561
return;
562562
}
563563

lldb/source/Commands/CommandObjectTarget.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,7 +2420,7 @@ class CommandObjectTargetModulesDumpLineTable
24202420
result.GetErrorStream().SetAddressByteSize(addr_byte_size);
24212421

24222422
if (command.GetArgumentCount() == 0) {
2423-
result.AppendError("file option must be specified.");
2423+
result.AppendError("file option must be specified");
24242424
return;
24252425
} else {
24262426
// Dump specified images (by basename or fullpath)
@@ -3565,13 +3565,13 @@ class CommandObjectTargetModulesShowUnwind : public CommandObjectParsed {
35653565

35663566
ThreadList threads(process->GetThreadList());
35673567
if (threads.GetSize() == 0) {
3568-
result.AppendError("The process must be paused to use this command.");
3568+
result.AppendError("the process must be paused to use this command");
35693569
return;
35703570
}
35713571

35723572
ThreadSP thread(threads.GetThreadAtIndex(0));
35733573
if (!thread) {
3574-
result.AppendError("The process must be paused to use this command.");
3574+
result.AppendError("the process must be paused to use this command");
35753575
return;
35763576
}
35773577

lldb/source/Commands/CommandObjectThread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ class CommandObjectThreadReturn : public CommandObjectRaw {
15701570
uint32_t frame_idx = frame_sp->GetFrameIndex();
15711571

15721572
if (frame_sp->IsInlined()) {
1573-
result.AppendError("Don't know how to return from inlined frames.");
1573+
result.AppendError("don't know how to return from inlined frames");
15741574
return;
15751575
}
15761576

0 commit comments

Comments
 (0)