36 functionDecl(returns(voidType()),
37 hasBody(compoundStmt(hasFinalStmt(
38 returnStmt(unless(has(expr()))).bind(
"stmt"))))),
40 Finder->addMatcher(mapAnyOf(forStmt, cxxForRangeStmt, whileStmt, doStmt)
41 .with(hasBody(compoundStmt(
42 hasFinalStmt(continueStmt().bind(
"stmt"))))),
47 const auto &RedundantStmt = *Result.Nodes.getNodeAs<Stmt>(
"stmt");
48 const SourceRange StmtRange = RedundantStmt.getSourceRange();
50 if (StmtRange.getBegin().isMacroID())
53 const auto RemovedRange = CharSourceRange::getCharRange(
55 Lexer::findLocationAfterToken(StmtRange.getEnd(), tok::semi,
56 *Result.SourceManager, getLangOpts(),
59 diag(StmtRange.getBegin(), isa<ReturnStmt>(RedundantStmt)
62 << FixItHint::CreateRemoval(RemovedRange);