2016-03-30 11:31:33 +00:00
|
|
|
//===--- AvoidConstParamsInDecls.h - clang-tidy----------------------------===//
|
|
|
|
//
|
2019-01-19 08:50:56 +00: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
|
2016-03-30 11:31:33 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_AVOID_CONST_PARAMS_IN_DECLS_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_AVOID_CONST_PARAMS_IN_DECLS_H
|
|
|
|
|
2019-03-25 12:38:26 +00:00
|
|
|
#include "../ClangTidyCheck.h"
|
2016-03-30 11:31:33 +00:00
|
|
|
|
2023-01-22 16:30:10 +00:00
|
|
|
namespace clang::tidy::readability {
|
2016-03-30 11:31:33 +00:00
|
|
|
|
|
|
|
// Detect function declarations that have const value parameters and discourage
|
|
|
|
// them.
|
|
|
|
class AvoidConstParamsInDecls : public ClangTidyCheck {
|
|
|
|
public:
|
2016-03-30 12:35:05 +00:00
|
|
|
AvoidConstParamsInDecls(StringRef Name, ClangTidyContext *Context)
|
2022-09-30 14:14:11 +00:00
|
|
|
: ClangTidyCheck(Name, Context),
|
|
|
|
IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
|
2016-03-30 11:31:33 +00:00
|
|
|
|
2022-09-30 14:14:11 +00:00
|
|
|
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
2016-03-30 11:31:33 +00:00
|
|
|
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
|
|
|
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
2022-12-14 06:42:34 +00:00
|
|
|
std::optional<TraversalKind> getCheckTraversalKind() const override {
|
2020-12-29 13:44:05 +00:00
|
|
|
return TK_IgnoreUnlessSpelledInSource;
|
|
|
|
}
|
2022-09-30 14:14:11 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const bool IgnoreMacros;
|
2016-03-30 11:31:33 +00:00
|
|
|
};
|
|
|
|
|
2023-01-22 16:30:10 +00:00
|
|
|
} // namespace clang::tidy::readability
|
2016-03-30 11:31:33 +00:00
|
|
|
|
|
|
|
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_AVOID_CONST_PARAMS_IN_DECLS_H
|