Skip to content

Commit eaf60a4

Browse files
committed
[lldb] Remove redundant calls to set eReturnStatusFailed
This is part 2, covering the commands source. Some uses remain where it's tricky to see what the logic is or they are not used with AppendError. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D104448
1 parent 3f59684 commit eaf60a4

29 files changed

+3
-516
lines changed

lldb/source/Commands/CommandObjectApropos.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,9 @@ bool CommandObjectApropos::DoExecute(Args &args, CommandReturnObject &result) {
8686
result.SetStatus(eReturnStatusSuccessFinishNoResult);
8787
} else {
8888
result.AppendError("'' is not a valid search word.\n");
89-
result.SetStatus(eReturnStatusFailed);
9089
}
9190
} else {
9291
result.AppendError("'apropos' must be called with exactly one argument.\n");
93-
result.SetStatus(eReturnStatusFailed);
9492
}
9593

9694
return result.Succeeded();

lldb/source/Commands/CommandObjectBreakpoint.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -566,13 +566,11 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
566566
if (num_files == 0) {
567567
if (!GetDefaultFile(target, file, result)) {
568568
result.AppendError("No file supplied and no default file available.");
569-
result.SetStatus(eReturnStatusFailed);
570569
return false;
571570
}
572571
} else if (num_files > 1) {
573572
result.AppendError("Only one file at a time is allowed for file and "
574573
"line breakpoints.");
575-
result.SetStatus(eReturnStatusFailed);
576574
return false;
577575
} else
578576
file = m_options.m_filenames.GetFileSpecAtIndex(0);
@@ -604,7 +602,6 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
604602
} else {
605603
result.AppendError("Only one shared library can be specified for "
606604
"address breakpoints.");
607-
result.SetStatus(eReturnStatusFailed);
608605
return false;
609606
}
610607
break;
@@ -639,7 +636,6 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
639636
result.AppendWarning(
640637
"Function name regex does not accept glob patterns.");
641638
}
642-
result.SetStatus(eReturnStatusFailed);
643639
return false;
644640
}
645641

@@ -657,7 +653,6 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
657653
if (!GetDefaultFile(target, file, result)) {
658654
result.AppendError(
659655
"No files provided and could not find default file.");
660-
result.SetStatus(eReturnStatusFailed);
661656
return false;
662657
} else {
663658
m_options.m_filenames.Append(file);
@@ -669,7 +664,6 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
669664
result.AppendErrorWithFormat(
670665
"Source text regular expression could not be compiled: \"%s\"",
671666
llvm::toString(std::move(err)).c_str());
672-
result.SetStatus(eReturnStatusFailed);
673667
return false;
674668
}
675669
bp_sp = target.CreateSourceRegexBreakpoint(
@@ -688,7 +682,6 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
688682
"Error setting extra exception arguments: %s",
689683
precond_error.AsCString());
690684
target.RemoveBreakpointByID(bp_sp->GetID());
691-
result.SetStatus(eReturnStatusFailed);
692685
return false;
693686
}
694687
} break;
@@ -703,7 +696,6 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
703696
result.AppendErrorWithFormat(
704697
"Error setting extra exception arguments: %s", error.AsCString());
705698
target.RemoveBreakpointByID(bp_sp->GetID());
706-
result.SetStatus(eReturnStatusFailed);
707699
return false;
708700
}
709701
} break;
@@ -723,7 +715,6 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
723715
result.AppendErrorWithFormat("Invalid breakpoint name: %s",
724716
name.c_str());
725717
target.RemoveBreakpointByID(bp_sp->GetID());
726-
result.SetStatus(eReturnStatusFailed);
727718
return false;
728719
}
729720
}
@@ -750,7 +741,6 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
750741
result.SetStatus(eReturnStatusSuccessFinishResult);
751742
} else if (!bp_sp) {
752743
result.AppendError("Breakpoint creation failed: No breakpoint created.");
753-
result.SetStatus(eReturnStatusFailed);
754744
}
755745

756746
return result.Succeeded();
@@ -767,12 +757,10 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
767757
if (cur_frame == nullptr) {
768758
result.AppendError(
769759
"No selected frame to use to find the default file.");
770-
result.SetStatus(eReturnStatusFailed);
771760
return false;
772761
} else if (!cur_frame->HasDebugInformation()) {
773762
result.AppendError("Cannot use the selected frame to find the default "
774763
"file, it has no debug info.");
775-
result.SetStatus(eReturnStatusFailed);
776764
return false;
777765
} else {
778766
const SymbolContext &sc =
@@ -782,7 +770,6 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
782770
} else {
783771
result.AppendError("Can't find the file for the selected frame to "
784772
"use as the default file.");
785-
result.SetStatus(eReturnStatusFailed);
786773
return false;
787774
}
788775
}
@@ -923,7 +910,6 @@ class CommandObjectBreakpointEnable : public CommandObjectParsed {
923910

924911
if (num_breakpoints == 0) {
925912
result.AppendError("No breakpoints exist to be enabled.");
926-
result.SetStatus(eReturnStatusFailed);
927913
return false;
928914
}
929915

@@ -1037,7 +1023,6 @@ the second re-enables the first location.");
10371023

10381024
if (num_breakpoints == 0) {
10391025
result.AppendError("No breakpoints exist to be disabled.");
1040-
result.SetStatus(eReturnStatusFailed);
10411026
return false;
10421027
}
10431028

@@ -1223,7 +1208,6 @@ class CommandObjectBreakpointList : public CommandObjectParsed {
12231208
result.SetStatus(eReturnStatusSuccessFinishNoResult);
12241209
} else {
12251210
result.AppendError("Invalid breakpoint ID.");
1226-
result.SetStatus(eReturnStatusFailed);
12271211
}
12281212
}
12291213

@@ -1321,7 +1305,6 @@ class CommandObjectBreakpointClear : public CommandObjectParsed {
13211305
// Early return if there's no breakpoint at all.
13221306
if (num_breakpoints == 0) {
13231307
result.AppendError("Breakpoint clear: No breakpoint cleared.");
1324-
result.SetStatus(eReturnStatusFailed);
13251308
return result.Succeeded();
13261309
}
13271310

@@ -1368,7 +1351,6 @@ class CommandObjectBreakpointClear : public CommandObjectParsed {
13681351
result.SetStatus(eReturnStatusSuccessFinishNoResult);
13691352
} else {
13701353
result.AppendError("Breakpoint clear: No breakpoint cleared.");
1371-
result.SetStatus(eReturnStatusFailed);
13721354
}
13731355

13741356
return result.Succeeded();
@@ -1473,7 +1455,6 @@ class CommandObjectBreakpointDelete : public CommandObjectParsed {
14731455

14741456
if (num_breakpoints == 0) {
14751457
result.AppendError("No breakpoints exist to be deleted.");
1476-
result.SetStatus(eReturnStatusFailed);
14771458
return false;
14781459
}
14791460

@@ -1512,7 +1493,6 @@ class CommandObjectBreakpointDelete : public CommandObjectParsed {
15121493
}
15131494
if (valid_bp_ids.GetSize() == 0) {
15141495
result.AppendError("No disabled breakpoints.");
1515-
result.SetStatus(eReturnStatusFailed);
15161496
return false;
15171497
}
15181498
} else {
@@ -1726,7 +1706,6 @@ class CommandObjectBreakpointNameConfigure : public CommandObjectParsed {
17261706
const size_t argc = command.GetArgumentCount();
17271707
if (argc == 0) {
17281708
result.AppendError("No names provided.");
1729-
result.SetStatus(eReturnStatusFailed);
17301709
return false;
17311710
}
17321711

@@ -1741,7 +1720,6 @@ class CommandObjectBreakpointNameConfigure : public CommandObjectParsed {
17411720
if (!BreakpointID::StringIsBreakpointName(entry.ref(), error)) {
17421721
result.AppendErrorWithFormat("Invalid breakpoint name: %s - %s",
17431722
entry.c_str(), error.AsCString());
1744-
result.SetStatus(eReturnStatusFailed);
17451723
return false;
17461724
}
17471725
}
@@ -1754,7 +1732,6 @@ class CommandObjectBreakpointNameConfigure : public CommandObjectParsed {
17541732
if (!bp_sp) {
17551733
result.AppendErrorWithFormatv("Could not find specified breakpoint {0}",
17561734
bp_id);
1757-
result.SetStatus(eReturnStatusFailed);
17581735
return false;
17591736
}
17601737
}
@@ -1836,7 +1813,6 @@ class CommandObjectBreakpointNameAdd : public CommandObjectParsed {
18361813
size_t num_breakpoints = breakpoints.GetSize();
18371814
if (num_breakpoints == 0) {
18381815
result.SetError("No breakpoints, cannot add names.");
1839-
result.SetStatus(eReturnStatusFailed);
18401816
return false;
18411817
}
18421818

@@ -1849,7 +1825,6 @@ class CommandObjectBreakpointNameAdd : public CommandObjectParsed {
18491825
if (result.Succeeded()) {
18501826
if (valid_bp_ids.GetSize() == 0) {
18511827
result.SetError("No breakpoints specified, cannot add names.");
1852-
result.SetStatus(eReturnStatusFailed);
18531828
return false;
18541829
}
18551830
size_t num_valid_ids = valid_bp_ids.GetSize();
@@ -1923,7 +1898,6 @@ class CommandObjectBreakpointNameDelete : public CommandObjectParsed {
19231898
size_t num_breakpoints = breakpoints.GetSize();
19241899
if (num_breakpoints == 0) {
19251900
result.SetError("No breakpoints, cannot delete names.");
1926-
result.SetStatus(eReturnStatusFailed);
19271901
return false;
19281902
}
19291903

@@ -1936,7 +1910,6 @@ class CommandObjectBreakpointNameDelete : public CommandObjectParsed {
19361910
if (result.Succeeded()) {
19371911
if (valid_bp_ids.GetSize() == 0) {
19381912
result.SetError("No breakpoints specified, cannot delete names.");
1939-
result.SetStatus(eReturnStatusFailed);
19401913
return false;
19411914
}
19421915
ConstString bp_name(m_name_options.m_name.GetCurrentValue());
@@ -2212,7 +2185,6 @@ class CommandObjectBreakpointRead : public CommandObjectParsed {
22122185

22132186
if (!error.Success()) {
22142187
result.AppendError(error.AsCString());
2215-
result.SetStatus(eReturnStatusFailed);
22162188
return false;
22172189
}
22182190

@@ -2341,7 +2313,6 @@ class CommandObjectBreakpointWrite : public CommandObjectParsed {
23412313
if (!error.Success()) {
23422314
result.AppendErrorWithFormat("error serializing breakpoints: %s.",
23432315
error.AsCString());
2344-
result.SetStatus(eReturnStatusFailed);
23452316
}
23462317
return result.Succeeded();
23472318
}
@@ -2434,7 +2405,6 @@ void CommandObjectMultiwordBreakpoint::VerifyIDs(
24342405
} else {
24352406
result.AppendError(
24362407
"No breakpoint specified and no last created breakpoint.");
2437-
result.SetStatus(eReturnStatusFailed);
24382408
}
24392409
return;
24402410
}
@@ -2476,14 +2446,12 @@ void CommandObjectMultiwordBreakpoint::VerifyIDs(
24762446
result.AppendErrorWithFormat(
24772447
"'%s' is not a currently valid breakpoint/location id.\n",
24782448
id_str.GetData());
2479-
result.SetStatus(eReturnStatusFailed);
24802449
}
24812450
} else {
24822451
i = valid_ids->GetSize() + 1;
24832452
result.AppendErrorWithFormat(
24842453
"'%d' is not a currently valid breakpoint ID.\n",
24852454
cur_bp_id.GetBreakpointID());
2486-
result.SetStatus(eReturnStatusFailed);
24872455
}
24882456
}
24892457
}

lldb/source/Commands/CommandObjectBreakpointCommand.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ are no syntax errors may indicate that a function was declared but never called.
371371

372372
if (num_breakpoints == 0) {
373373
result.AppendError("No breakpoints exist to have commands added");
374-
result.SetStatus(eReturnStatusFailed);
375374
return false;
376375
}
377376

@@ -545,14 +544,12 @@ class CommandObjectBreakpointCommandDelete : public CommandObjectParsed {
545544

546545
if (num_breakpoints == 0) {
547546
result.AppendError("No breakpoints exist to have commands deleted");
548-
result.SetStatus(eReturnStatusFailed);
549547
return false;
550548
}
551549

552550
if (command.empty()) {
553551
result.AppendError(
554552
"No breakpoint specified from which to delete the commands");
555-
result.SetStatus(eReturnStatusFailed);
556553
return false;
557554
}
558555

@@ -577,7 +574,6 @@ class CommandObjectBreakpointCommandDelete : public CommandObjectParsed {
577574
result.AppendErrorWithFormat("Invalid breakpoint ID: %u.%u.\n",
578575
cur_bp_id.GetBreakpointID(),
579576
cur_bp_id.GetLocationID());
580-
result.SetStatus(eReturnStatusFailed);
581577
return false;
582578
}
583579
} else {
@@ -628,14 +624,12 @@ class CommandObjectBreakpointCommandList : public CommandObjectParsed {
628624

629625
if (num_breakpoints == 0) {
630626
result.AppendError("No breakpoints exist for which to list commands");
631-
result.SetStatus(eReturnStatusFailed);
632627
return false;
633628
}
634629

635630
if (command.empty()) {
636631
result.AppendError(
637632
"No breakpoint specified for which to list the commands");
638-
result.SetStatus(eReturnStatusFailed);
639633
return false;
640634
}
641635

@@ -660,7 +654,6 @@ class CommandObjectBreakpointCommandList : public CommandObjectParsed {
660654
result.AppendErrorWithFormat("Invalid breakpoint ID: %u.%u.\n",
661655
cur_bp_id.GetBreakpointID(),
662656
cur_bp_id.GetLocationID());
663-
result.SetStatus(eReturnStatusFailed);
664657
return false;
665658
}
666659
}
@@ -695,7 +688,6 @@ class CommandObjectBreakpointCommandList : public CommandObjectParsed {
695688
} else {
696689
result.AppendErrorWithFormat("Invalid breakpoint ID: %u.\n",
697690
cur_bp_id.GetBreakpointID());
698-
result.SetStatus(eReturnStatusFailed);
699691
}
700692
}
701693
}

0 commit comments

Comments
 (0)