clang-tools  10.0.0svn
UnusedParametersCheck.h
Go to the documentation of this file.
1 //===--- UnusedParametersCheck.h - clang-tidy--------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_PARAMETERS_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_PARAMETERS_H
11 
12 #include "../ClangTidyCheck.h"
13 
14 namespace clang {
15 namespace tidy {
16 namespace misc {
17 
18 /// Finds unused parameters and fixes them, so that `-Wunused-parameter` can be
19 /// turned on.
21 public:
22  UnusedParametersCheck(StringRef Name, ClangTidyContext *Context);
24  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
25  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
26  void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
27 
28 private:
29  const bool StrictMode;
30  class IndexerVisitor;
31  std::unique_ptr<IndexerVisitor> Indexer;
32 
33  void
34  warnOnUnusedParameter(const ast_matchers::MatchFinder::MatchResult &Result,
35  const FunctionDecl *Function, unsigned ParamIndex);
36 };
37 
38 } // namespace misc
39 } // namespace tidy
40 } // namespace clang
41 
42 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_PARAMETERS_H
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
Base class for all clang-tidy checks.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
UnusedParametersCheck(StringRef Name, ClangTidyContext *Context)
static constexpr llvm::StringLiteral Name
std::map< std::string, std::string > OptionMap
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Finds unused parameters and fixes them, so that -Wunused-parameter can be turned on.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.