File indexing completed on 2026-05-10 08:36:22
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANT_CONTROL_FLOW_H
0010 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANT_CONTROL_FLOW_H
0011
0012 #include "../ClangTidyCheck.h"
0013
0014 namespace clang::tidy::readability {
0015
0016
0017
0018
0019
0020
0021
0022
0023 class RedundantControlFlowCheck : public ClangTidyCheck {
0024 public:
0025 RedundantControlFlowCheck(StringRef Name, ClangTidyContext *Context)
0026 : ClangTidyCheck(Name, Context) {}
0027 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
0028 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
0029
0030 std::optional<TraversalKind> getCheckTraversalKind() const override {
0031 return TK_IgnoreUnlessSpelledInSource;
0032 }
0033
0034 private:
0035 void
0036 checkRedundantReturn(const ast_matchers::MatchFinder::MatchResult &Result,
0037 const CompoundStmt *Block);
0038
0039 void
0040 checkRedundantContinue(const ast_matchers::MatchFinder::MatchResult &Result,
0041 const CompoundStmt *Block);
0042
0043 void issueDiagnostic(const ast_matchers::MatchFinder::MatchResult &Result,
0044 const CompoundStmt *Block, const SourceRange &StmtRange,
0045 const char *Diag);
0046 };
0047
0048 }
0049
0050 #endif