blob: 414ef1127dde03bc5245351efc53d8eb7b22f299 [file] [log] [blame]
Daniel Jasper9c6df882015-07-20 01:06:44 +00001//===--- UnusedParametersCheck.h - clang-tidy--------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_PARAMETERS_H
11#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_PARAMETERS_H
12
13#include "../ClangTidy.h"
14
15namespace clang {
16namespace tidy {
Kirill Bobyrev11cea452016-08-01 12:06:18 +000017namespace misc {
Daniel Jasper9c6df882015-07-20 01:06:44 +000018
Alexander Kornienkof8ed0a82015-08-27 18:01:58 +000019/// Finds unused parameters and fixes them, so that `-Wunused-parameter` can be
20/// turned on.
Daniel Jasper9c6df882015-07-20 01:06:44 +000021class UnusedParametersCheck : public ClangTidyCheck {
22public:
Alexander Kornienko4d5dd3b2017-05-17 02:25:11 +000023 UnusedParametersCheck(StringRef Name, ClangTidyContext *Context);
24 ~UnusedParametersCheck();
Daniel Jasper9c6df882015-07-20 01:06:44 +000025 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
26 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Daniel Jasper9fe55a322015-07-27 13:46:37 +000027
28private:
Alexander Kornienko4d5dd3b2017-05-17 02:25:11 +000029 class IndexerVisitor;
30 std::unique_ptr<IndexerVisitor> Indexer;
31
Daniel Jasper9fe55a322015-07-27 13:46:37 +000032 void
33 warnOnUnusedParameter(const ast_matchers::MatchFinder::MatchResult &Result,
34 const FunctionDecl *Function, unsigned ParamIndex);
Daniel Jasper9c6df882015-07-20 01:06:44 +000035};
36
Etienne Bergeron456177b2016-05-02 18:00:29 +000037} // namespace misc
Daniel Jasper9c6df882015-07-20 01:06:44 +000038} // namespace tidy
39} // namespace clang
40
41#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_PARAMETERS_H