2015-01-15 03:37:54 +08:00
|
|
|
//===--- ElseAfterReturnCheck.h - clang-tidy---------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-01-15 03:37:54 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-03-10 00:52:33 +08:00
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_ELSEAFTERRETURNCHECK_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_ELSEAFTERRETURNCHECK_H
|
2015-01-15 03:37:54 +08:00
|
|
|
|
2019-03-25 20:38:26 +08:00
|
|
|
#include "../ClangTidyCheck.h"
|
2015-01-15 03:37:54 +08:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
2015-03-02 19:43:00 +08:00
|
|
|
namespace readability {
|
2015-01-15 03:37:54 +08:00
|
|
|
|
2015-08-28 02:01:58 +08:00
|
|
|
/// Flags the usages of `else` after `return`.
|
|
|
|
///
|
|
|
|
/// http://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return
|
2015-01-15 03:37:54 +08:00
|
|
|
class ElseAfterReturnCheck : public ClangTidyCheck {
|
|
|
|
public:
|
2020-01-03 02:37:41 +08:00
|
|
|
ElseAfterReturnCheck(StringRef Name, ClangTidyContext *Context);
|
|
|
|
|
|
|
|
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
2015-01-15 03:37:54 +08:00
|
|
|
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
|
|
|
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
2020-01-03 02:37:41 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
const bool WarnOnUnfixable;
|
2020-07-01 02:34:44 +08:00
|
|
|
const bool WarnOnConditionVariables;
|
2015-01-15 03:37:54 +08:00
|
|
|
};
|
|
|
|
|
2015-03-02 19:43:00 +08:00
|
|
|
} // namespace readability
|
2015-01-15 03:37:54 +08:00
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|
|
|
|
|
2015-03-10 00:52:33 +08:00
|
|
|
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_ELSEAFTERRETURNCHECK_H
|