clang-tools
15.0.0git
llvm-project
clang-tools-extra
clang-tidy
misc
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.
20
class
UnusedParametersCheck
:
public
ClangTidyCheck
{
21
public
:
22
UnusedParametersCheck
(StringRef
Name
,
ClangTidyContext
*Context);
23
~UnusedParametersCheck
();
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
clang::tidy::misc::UnusedParametersCheck::~UnusedParametersCheck
~UnusedParametersCheck()
clang::tidy::ClangTidyOptions::OptionMap
llvm::StringMap< ClangTidyValue > OptionMap
Definition:
ClangTidyOptions.h:115
clang::tidy::misc::UnusedParametersCheck::IndexerVisitor
Definition:
UnusedParametersCheck.cpp:76
clang::tidy::misc::UnusedParametersCheck::storeOptions
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
Definition:
UnusedParametersCheck.cpp:130
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition:
ClangTidyCheck.h:53
clang::tidy::misc::UnusedParametersCheck
Finds unused parameters and fixes them, so that -Wunused-parameter can be turned on.
Definition:
UnusedParametersCheck.h:20
clang::tidy::misc::UnusedParametersCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition:
UnusedParametersCheck.cpp:33
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition:
ClangTidyDiagnosticConsumer.h:66
Name
Token Name
Definition:
MacroToEnumCheck.cpp:89
clang::tidy::misc::UnusedParametersCheck::UnusedParametersCheck
UnusedParametersCheck(StringRef Name, ClangTidyContext *Context)
Definition:
UnusedParametersCheck.cpp:125
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition:
ApplyReplacements.h:27
clang::tidy::misc::UnusedParametersCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition:
UnusedParametersCheck.cpp:174
Generated on Thu May 19 2022 02:36:57 for clang-tools by
1.8.17