Remove redundant return and continue statements (NFC)

Identified with readability-redundant-control-flow.
This commit is contained in:
Kazu Hirata 2021-12-24 23:17:53 -08:00
parent 70912420bb
commit 2d303e6781
41 changed files with 16 additions and 73 deletions

View File

@ -221,7 +221,6 @@ void DurationFactoryScaleCheck::check(const MatchFinder::MatchResult &Result) {
tooling::fixit::getText(*Remainder, *Result.Context) + ")")
.str());
}
return;
}
} // namespace abseil

View File

@ -41,7 +41,6 @@ void ImplementationInNamespaceCheck::check(
diag(MatchedDecl->getLocation(),
"declaration must be declared within the '%0' namespace")
<< RequiredNamespace;
return;
}
} // namespace llvm_libc

View File

@ -1035,7 +1035,6 @@ public:
void getArgKinds(ASTNodeKind ThisKind, unsigned,
std::vector<ArgKind> &ArgKinds) const override {
ArgKinds.push_back(ArgKind::MakeNodeArg(ThisKind));
return;
}
bool isConvertibleTo(ASTNodeKind Kind, unsigned *Specificity = nullptr,
ASTNodeKind *LeastDerivedKind = nullptr) const override {

View File

@ -1820,8 +1820,6 @@ void CFGBuilder::addScopesEnd(LocalScope::const_iterator B,
for (VarDecl *VD : llvm::reverse(DeclsWithEndedScope))
appendScopeEnd(Block, VD, S);
return;
}
/// addAutomaticObjDtors - Add to current block automatic objects destructors

View File

@ -623,14 +623,11 @@ void PPCTargetInfo::addP10SpecificFeatures(
Features["pcrelative-memops"] = true;
Features["prefix-instrs"] = true;
Features["isa-v31-instructions"] = true;
return;
}
// Add features specific to the "Future" CPU.
void PPCTargetInfo::addFutureSpecificFeatures(
llvm::StringMap<bool> &Features) const {
return;
}
llvm::StringMap<bool> &Features) const {}
bool PPCTargetInfo::hasFeature(StringRef Feature) const {
return llvm::StringSwitch<bool>(Feature)

View File

@ -4301,10 +4301,10 @@ public:
PrivateDecls.push_back(VD);
}
}
void VisitOMPExecutableDirective(const OMPExecutableDirective *) { return; }
void VisitCapturedStmt(const CapturedStmt *) { return; }
void VisitLambdaExpr(const LambdaExpr *) { return; }
void VisitBlockExpr(const BlockExpr *) { return; }
void VisitOMPExecutableDirective(const OMPExecutableDirective *) {}
void VisitCapturedStmt(const CapturedStmt *) {}
void VisitLambdaExpr(const LambdaExpr *) {}
void VisitBlockExpr(const BlockExpr *) {}
void VisitStmt(const Stmt *S) {
if (!S)
return;

View File

@ -571,7 +571,6 @@ void BackendConsumer::SrcMgrDiagHandler(const llvm::DiagnosticInfoSrcMgr &DI) {
// If Loc is invalid, we still need to report the issue, it just gets no
// location info.
Diags.Report(Loc, DiagID).AddString(Message);
return;
}
bool

View File

@ -365,5 +365,4 @@ void HIPAMDToolChain::checkTargetID(
getDriver().Diag(clang::diag::err_drv_bad_target_id)
<< PTID.OptionalTargetID.getValue();
}
return;
}

View File

@ -1138,7 +1138,6 @@ void UnwrappedLineParser::parseModuleImport() {
}
addUnwrappedLine();
return;
}
// readTokenWithJavaScriptASI reads the next token and terminates the current

View File

@ -886,7 +886,6 @@ void Sema::CUDACheckLambdaCapture(CXXMethodDecl *Callee,
diag::warn_maybe_capture_bad_target_this_ptr, Callee,
*this);
}
return;
}
void Sema::CUDASetLambdaAttrs(CXXMethodDecl *Method) {

View File

@ -569,7 +569,6 @@ void PreferredTypeBuilder::enterMemAccess(Sema &S, SourceLocation Tok,
return;
// Keep the expected type, only update the location.
ExpectedLoc = Tok;
return;
}
void PreferredTypeBuilder::enterUnary(Sema &S, SourceLocation Tok,

View File

@ -6541,7 +6541,6 @@ static void HandleBTFTypeTagAttribute(QualType &Type, const ParsedAttr &Attr,
StringRef BTFTypeTag = StrLiteral->getString();
Type = State.getAttributedType(
::new (Ctx) BTFTypeTagAttr(Ctx, Attr, BTFTypeTag), Type, Type);
return;
}
/// HandleAddressSpaceTypeAttribute - Process an address_space attribute on the

View File

@ -227,6 +227,4 @@ void clang_fuzzer::HandleLLVM(const std::string &IR,
if (memcmp(OptArrays, UnoptArrays, kTotalSize))
ErrorAndExit("!!!BUG!!!");
return;
}

View File

@ -1000,7 +1000,7 @@ protected:
void SetPreferredDisplayLanguageIfNeeded(lldb::LanguageType);
protected:
virtual void DoUpdateChildrenAddressType(ValueObject &valobj) { return; };
virtual void DoUpdateChildrenAddressType(ValueObject &valobj){};
private:
virtual CompilerType MaybeCalculateCompleteType();

View File

@ -141,7 +141,7 @@ public:
return false;
}
virtual void SymbolsDidLoad(const ModuleList &module_list) { return; }
virtual void SymbolsDidLoad(const ModuleList &module_list) {}
virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
bool stop_others) = 0;

View File

@ -360,7 +360,6 @@ protected:
m_entries.erase(next);
}
}
return;
}
Collection m_entries;

View File

@ -1034,7 +1034,7 @@ public:
// navigates to the next or the previous field. This is particularly useful to
// do in-field validation and error setting. Fields with internal navigation
// should call this method on their fields.
virtual void FieldDelegateExitCallback() { return; }
virtual void FieldDelegateExitCallback() {}
// Fields may have internal navigation, for instance, a List Field have
// multiple internal elements, which needs to be navigated. To allow for this
@ -1055,10 +1055,10 @@ public:
virtual bool FieldDelegateOnLastOrOnlyElement() { return true; }
// Select the first element in the field if multiple elements exists.
virtual void FieldDelegateSelectFirstElement() { return; }
virtual void FieldDelegateSelectFirstElement() {}
// Select the last element in the field if multiple elements exists.
virtual void FieldDelegateSelectLastElement() { return; }
virtual void FieldDelegateSelectLastElement() {}
// Returns true if the field has an error, false otherwise.
virtual bool FieldDelegateHasError() { return false; }
@ -2000,7 +2000,6 @@ public:
void FieldDelegateSelectLastElement() override {
m_selection_type = SelectionType::NewButton;
return;
}
int GetNumberOfFields() { return m_fields.size(); }
@ -2292,7 +2291,7 @@ public:
virtual std::string GetName() = 0;
virtual void UpdateFieldsVisibility() { return; }
virtual void UpdateFieldsVisibility() {}
FieldDelegate *GetField(uint32_t field_index) {
if (field_index < m_fields.size())
@ -3765,13 +3764,11 @@ public:
void SelectNext() {
if (m_selected_match != m_delegate_sp->GetNumberOfMatches() - 1)
m_selected_match++;
return;
}
void SelectPrevious() {
if (m_selected_match != 0)
m_selected_match--;
return;
}
void ExecuteCallback(Window &window) {
@ -4608,9 +4605,7 @@ public:
virtual void TreeDelegateDrawTreeItem(TreeItem &item, Window &window) = 0;
virtual void TreeDelegateGenerateChildren(TreeItem &item) = 0;
virtual void TreeDelegateUpdateSelection(TreeItem &root, int &selection_index,
TreeItem *&selected_item) {
return;
}
TreeItem *&selected_item) {}
// This is invoked when a tree item is selected. If true is returned, the
// views are updated.
virtual bool TreeDelegateItemSelected(TreeItem &item) = 0;

View File

@ -483,8 +483,6 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
func_addr = m_function_load_addr;
func_end = m_function_end_load_addr;
return;
}
IRExecutionUnit::~IRExecutionUnit() {

View File

@ -609,7 +609,6 @@ void IRMemoryMap::WriteScalarToMemory(lldb::addr_t process_address,
error.SetErrorToGenericError();
error.SetErrorString("Couldn't write scalar: its size was zero");
}
return;
}
void IRMemoryMap::WritePointerToMemory(lldb::addr_t process_address,
@ -757,7 +756,6 @@ void IRMemoryMap::ReadScalarFromMemory(Scalar &scalar,
error.SetErrorToGenericError();
error.SetErrorString("Couldn't read scalar: its size was zero");
}
return;
}
void IRMemoryMap::ReadPointerFromMemory(lldb::addr_t *address,
@ -773,8 +771,6 @@ void IRMemoryMap::ReadPointerFromMemory(lldb::addr_t *address,
return;
*address = pointer_scalar.ULongLong();
return;
}
void IRMemoryMap::GetMemoryData(DataExtractor &extractor,

View File

@ -86,7 +86,6 @@ static void DupDescriptor(int error_fd, const FileSpec &file_spec, int fd,
ExitWithError(error_fd, "DupDescriptor-dup2");
::close(target_fd);
return;
}
[[noreturn]] static void ChildFunc(int error_fd,

View File

@ -2216,7 +2216,6 @@ void CommandInterpreter::BuildAliasCommandArgs(CommandObject *alias_cmd_obj,
}
result.SetStatus(eReturnStatusSuccessFinishNoResult);
return;
}
int CommandInterpreter::GetOptionArgumentPosition(const char *in_string) {
@ -2563,8 +2562,6 @@ void CommandInterpreter::HandleCommands(const StringList &commands,
result.SetStatus(eReturnStatusSuccessFinishResult);
m_debugger.SetAsyncExecution(old_async_execution);
return;
}
// Make flags that we can pass into the IOHandler so our delegates can do the

View File

@ -242,7 +242,6 @@ void DynamicLoaderMacOSXDYLD::DoInitialImageFetch() {
ReadDYLDInfoFromMemoryAndSetNotificationCallback(0x8fe00000);
}
}
return;
}
// Assume that dyld is in memory at ADDR and try to parse it's load commands

View File

@ -806,7 +806,7 @@ void ClangASTImporter::ForgetSource(clang::ASTContext *dst_ast,
md->removeOriginsWithContext(src_ast);
}
ClangASTImporter::MapCompleter::~MapCompleter() { return; }
ClangASTImporter::MapCompleter::~MapCompleter() {}
llvm::Expected<Decl *>
ClangASTImporter::ASTImporterDelegate::ImportImpl(Decl *From) {

View File

@ -513,8 +513,6 @@ void ClangASTSource::FindExternalLexicalDecls(
// is consulted again when a clang::DeclContext::lookup is called.
const_cast<DeclContext *>(decl_context)->setMustBuildLookupTable();
}
return;
}
void ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) {

View File

@ -59,7 +59,7 @@ public:
GetExternalCXXBaseSpecifiers(uint64_t Offset) override {
return nullptr;
}
void MaterializeVisibleDecls(const clang::DeclContext *DC) { return; }
void MaterializeVisibleDecls(const clang::DeclContext *DC) {}
void InstallASTContext(TypeSystemClang &ast_context);

View File

@ -1954,8 +1954,6 @@ void ClangExpressionDeclMap::AddContextClassType(NameSearchContext &context,
return;
context.AddNamedDecl(typedef_decl);
return;
}
void ClangExpressionDeclMap::AddOneType(NameSearchContext &context,

View File

@ -80,8 +80,6 @@ public:
LLDB_LOG(log, " AOEAS::CT Before:\n{1}", ClangUtil::DumpDecl(tag_decl));
LLDB_LOG(log, " AOEAS::CT After:{1}", ClangUtil::DumpDecl(tag_decl));
return;
}
void CompleteType(clang::ObjCInterfaceDecl *interface_decl) override {
@ -107,7 +105,6 @@ public:
LLDB_LOGF(log, " [CT] After:");
LLDB_LOG(log, " [CT] {0}", ClangUtil::DumpDecl(interface_decl));
}
return;
}
bool layoutRecordType(

View File

@ -900,7 +900,7 @@ lldb::LanguageType SymbolFileNativePDB::ParseLanguage(CompileUnit &comp_unit) {
return TranslateLanguage(item->m_compile_opts->getLanguage());
}
void SymbolFileNativePDB::AddSymbols(Symtab &symtab) { return; }
void SymbolFileNativePDB::AddSymbols(Symtab &symtab) {}
size_t SymbolFileNativePDB::ParseFunctions(CompileUnit &comp_unit) {
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());

View File

@ -239,7 +239,6 @@ void SymbolFilePDB::GetCompileUnitIndex(
}
}
index = UINT32_MAX;
return;
}
std::unique_ptr<llvm::pdb::PDBSymbolCompiland>

View File

@ -125,9 +125,7 @@ void SymbolFile::FindFunctions(const RegularExpression &regex,
void SymbolFile::GetMangledNamesForFunction(
const std::string &scope_qualified_name,
std::vector<ConstString> &mangled_names) {
return;
}
std::vector<ConstString> &mangled_names) {}
void SymbolFile::FindTypes(
ConstString name, const CompilerDeclContext &parent_decl_ctx,

View File

@ -210,7 +210,6 @@ void ThreadPlanStack::DiscardAllPlans() {
for (int i = stack_size - 1; i > 0; i--) {
DiscardPlan();
}
return;
}
void ThreadPlanStack::DiscardConsultingControllingPlans() {

View File

@ -312,7 +312,6 @@ void UnwindLLDB::UpdateUnwindPlanForFirstFrameIfInvalid(ABI *abi) {
// Restore status after calling AddOneMoreFrame
m_unwind_complete = old_m_unwind_complete;
m_candidate_frame = old_m_candidate_frame;
return;
}
bool UnwindLLDB::AddOneMoreFrame(ABI *abi) {

View File

@ -159,7 +159,6 @@ cleanup:
LLVMOrcIRTransformLayerRef IRLayer = LLVMOrcLLJITGetIRTransformLayer(J);
LLVMOrcIRTransformLayerEmit(IRLayer, MR, TSM);
}
return;
}
int main(int argc, char *argv[]) {

View File

@ -302,7 +302,6 @@ void LegalizerHelper::mergeMixedSubvectors(Register DstReg,
appendVectorElts(AllElts, Leftover);
MIRBuilder.buildMerge(DstReg, AllElts);
return;
}
/// Append the result registers of G_UNMERGE_VALUES \p MI to \p Regs.

View File

@ -89,7 +89,6 @@ static void dumpLocationList(raw_ostream &OS, const DWARFFormValue &FormValue,
U->getLocationTable().dumpLocationList(&Offset, OS, U->getBaseAddress(), MRI,
Ctx.getDWARFObj(), U, DumpOpts,
Indent);
return;
}
static void dumpLocationExpr(raw_ostream &OS, const DWARFFormValue &FormValue,
@ -105,7 +104,6 @@ static void dumpLocationExpr(raw_ostream &OS, const DWARFFormValue &FormValue,
Ctx.isLittleEndian(), 0);
DWARFExpression(Data, U->getAddressByteSize(), U->getFormParams().Format)
.print(OS, DumpOpts, MRI, U);
return;
}
static DWARFDie resolveReferencedType(DWARFDie D,

View File

@ -2324,7 +2324,6 @@ bool ShuffleVectorInst::isInsertSubvectorMask(ArrayRef<int> Mask,
}
Src1Elts.setBit(i);
Src1Identity &= (M == (i + NumSrcElts));
continue;
}
assert((Src0Elts | Src1Elts | UndefElts).isAllOnes() &&
"unknown shuffle elements");

View File

@ -378,5 +378,4 @@ void AMDGPUCombinerHelper::applyFoldableFneg(MachineInstr &MI,
}
MI.eraseFromParent();
return;
}

View File

@ -2395,8 +2395,6 @@ void SIInstrInfo::insertIndirectBranch(MachineBasicBlock &MBB,
OffsetLo->setVariableValue(MCBinaryExpr::createAnd(Offset, Mask, MCCtx));
auto *ShAmt = MCConstantExpr::create(32, MCCtx);
OffsetHi->setVariableValue(MCBinaryExpr::createAShr(Offset, ShAmt, MCCtx));
return;
}
unsigned SIInstrInfo::getBranchOpcode(SIInstrInfo::BranchPredicate Cond) {

View File

@ -571,8 +571,6 @@ void AVRInstrInfo::insertIndirectBranch(MachineBasicBlock &MBB,
// See lib/CodeGen/RegisterRelaxation.cpp for details.
// We end up here when a jump is too long for a RJMP instruction.
BuildMI(&MBB, DL, get(AVR::JMPk)).addMBB(&NewDestBB);
return;
}
} // end of namespace llvm

View File

@ -868,7 +868,6 @@ inline void isl_sioimath_tdiv_q(isl_sioimath_ptr dst, isl_sioimath_src lhs,
isl_sioimath_bigarg_src(rhs, &rhsscratch),
isl_sioimath_reinit_big(dst), NULL);
isl_sioimath_try_demote(dst);
return;
}
/* Divide lhs by an unsigned long rhs, rounding to zero (Truncate).

View File

@ -271,7 +271,6 @@ public:
}
// not a loop transformation; look for next property
continue;
}
}