diff options
| author | Alexander Kornienko <alexfh@google.com> | 2016-03-30 11:31:33 +0000 |
|---|---|---|
| committer | Alexander Kornienko <alexfh@google.com> | 2016-03-30 11:31:33 +0000 |
| commit | e3ae0c6f19fd53db0b5e79e264585109b0d3768b (patch) | |
| tree | 95eae7edc1b075f30bd29ab017f1c23aa59792e1 /clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h | |
| parent | 1b654f2293f7859676edc6b06156de84c32f482a (diff) | |
| download | bcm5719-llvm-e3ae0c6f19fd53db0b5e79e264585109b0d3768b.tar.gz bcm5719-llvm-e3ae0c6f19fd53db0b5e79e264585109b0d3768b.zip | |
[clang-tidy] readability check for const params in declarations
Summary: Adds a clang-tidy warning for top-level consts in function declarations.
Reviewers: hokein, sbenza, alexfh
Subscribers: cfe-commits
Patch by Matt Kulukundis!
Differential Revision: http://reviews.llvm.org/D18408
llvm-svn: 264856
Diffstat (limited to 'clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h')
| -rw-r--r-- | clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h b/clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h new file mode 100644 index 00000000000..5d4e9a030c4 --- /dev/null +++ b/clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h @@ -0,0 +1,33 @@ +//===--- AvoidConstParamsInDecls.h - clang-tidy----------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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 + +#include "../ClangTidy.h" + +namespace clang { +namespace tidy { +namespace readability { + +// Detect function declarations that have const value parameters and discourage +// them. +class AvoidConstParamsInDecls : public ClangTidyCheck { +public: + using ClangTidyCheck::ClangTidyCheck; + + void registerMatchers(ast_matchers::MatchFinder *Finder) override; + void check(const ast_matchers::MatchFinder::MatchResult &Result) override; +}; + +} // namespace readability +} // namespace tidy +} // namespace clang + +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_AVOID_CONST_PARAMS_IN_DECLS_H |

