clang-tools 17.0.0git
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
14namespace clang::tidy::misc {
15
16/// Finds unused parameters and fixes them, so that `-Wunused-parameter` can be
17/// turned on.
19public:
20 UnusedParametersCheck(StringRef Name, ClangTidyContext *Context);
22 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
23 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
24 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
25
26private:
27 const bool StrictMode;
28 class IndexerVisitor;
29 std::unique_ptr<IndexerVisitor> Indexer;
30
31 void
32 warnOnUnusedParameter(const ast_matchers::MatchFinder::MatchResult &Result,
33 const FunctionDecl *Function, unsigned ParamIndex);
34};
35
36} // namespace clang::tidy::misc
37
38#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_PARAMETERS_H
Token Name
Base class for all clang-tidy checks.
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
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.
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
llvm::StringMap< ClangTidyValue > OptionMap