Skip to content

Commit f32f0e6

Browse files
[clang-tidy][NFC] Enable 'readability-named-parameter' check
1 parent 48babe1 commit f32f0e6

16 files changed

+110
-92
lines changed

clang-tools-extra/clang-tidy/.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Checks: >
2727
-readability-implicit-bool-conversion,
2828
-readability-isolate-declaration,
2929
-readability-magic-numbers,
30-
-readability-named-parameter,
3130
-readability-qualified-auto,
3231
-readability-simplify-boolean-expr,
3332
-readability-static-definition-in-anonymous-namespace,

clang-tools-extra/clang-tidy/ClangTidyOptions.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ template <> struct MappingTraits<ClangTidyOptions::StringPair> {
6666
};
6767

6868
struct NOptionMap {
69-
NOptionMap(IO &) {}
70-
NOptionMap(IO &, const ClangTidyOptions::OptionMap &OptionMap) {
69+
NOptionMap(IO & /*unused*/) {}
70+
NOptionMap(IO & /*unused*/, const ClangTidyOptions::OptionMap &OptionMap) {
7171
Options.reserve(OptionMap.size());
7272
for (const auto &KeyValue : OptionMap)
7373
Options.emplace_back(std::string(KeyValue.getKey()),
7474
KeyValue.getValue().Value);
7575
}
76-
ClangTidyOptions::OptionMap denormalize(IO &) {
76+
ClangTidyOptions::OptionMap denormalize(IO & /*unused*/) {
7777
ClangTidyOptions::OptionMap Map;
7878
for (const auto &KeyValue : Options)
7979
Map[KeyValue.first] = ClangTidyOptions::ClangTidyValue(KeyValue.second);
@@ -83,7 +83,7 @@ struct NOptionMap {
8383
};
8484

8585
template <>
86-
void yamlize(IO &IO, ClangTidyOptions::OptionMap &Val, bool,
86+
void yamlize(IO &IO, ClangTidyOptions::OptionMap &Val, bool /*unused*/,
8787
EmptyContext &Ctx) {
8888
if (IO.outputting()) {
8989
// Ensure check options are sorted
@@ -130,7 +130,8 @@ struct ChecksVariant {
130130
std::optional<std::vector<std::string>> AsVector;
131131
};
132132

133-
template <> void yamlize(IO &IO, ChecksVariant &Val, bool, EmptyContext &Ctx) {
133+
template <>
134+
void yamlize(IO &IO, ChecksVariant &Val, bool /*unused*/, EmptyContext &Ctx) {
134135
if (!IO.outputting()) {
135136
// Special case for reading from YAML
136137
// Must support reading from both a string or a list

clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -181,65 +181,63 @@ void ExpandModularHeadersPPCallbacks::EndOfMainFile() {
181181
// Handle all other callbacks.
182182
// Just parse to the corresponding location to generate the same callback for
183183
// the PPCallbacks registered in our custom preprocessor.
184-
void ExpandModularHeadersPPCallbacks::Ident(SourceLocation Loc, StringRef) {
184+
void ExpandModularHeadersPPCallbacks::Ident(SourceLocation Loc,
185+
StringRef /*str*/) {
185186
parseToLocation(Loc);
186187
}
187-
void ExpandModularHeadersPPCallbacks::PragmaDirective(SourceLocation Loc,
188-
PragmaIntroducerKind) {
188+
void ExpandModularHeadersPPCallbacks::PragmaDirective(
189+
SourceLocation Loc, PragmaIntroducerKind /*Introducer*/) {
189190
parseToLocation(Loc);
190191
}
191-
void ExpandModularHeadersPPCallbacks::PragmaComment(SourceLocation Loc,
192-
const IdentifierInfo *,
193-
StringRef) {
192+
void ExpandModularHeadersPPCallbacks::PragmaComment(
193+
SourceLocation Loc, const IdentifierInfo * /*Kind*/, StringRef /*Str*/) {
194194
parseToLocation(Loc);
195195
}
196-
void ExpandModularHeadersPPCallbacks::PragmaDetectMismatch(SourceLocation Loc,
197-
StringRef,
198-
StringRef) {
196+
void ExpandModularHeadersPPCallbacks::PragmaDetectMismatch(
197+
SourceLocation Loc, StringRef /*Name*/, StringRef /*Value*/) {
199198
parseToLocation(Loc);
200199
}
201200
void ExpandModularHeadersPPCallbacks::PragmaDebug(SourceLocation Loc,
202-
StringRef) {
201+
StringRef /*DebugType*/) {
203202
parseToLocation(Loc);
204203
}
205204
void ExpandModularHeadersPPCallbacks::PragmaMessage(SourceLocation Loc,
206-
StringRef,
207-
PragmaMessageKind,
208-
StringRef) {
205+
StringRef /*Namespace*/,
206+
PragmaMessageKind /*Kind*/,
207+
StringRef /*Str*/) {
209208
parseToLocation(Loc);
210209
}
211-
void ExpandModularHeadersPPCallbacks::PragmaDiagnosticPush(SourceLocation Loc,
212-
StringRef) {
210+
void ExpandModularHeadersPPCallbacks::PragmaDiagnosticPush(
211+
SourceLocation Loc, StringRef /*Namespace*/) {
213212
parseToLocation(Loc);
214213
}
215-
void ExpandModularHeadersPPCallbacks::PragmaDiagnosticPop(SourceLocation Loc,
216-
StringRef) {
214+
void ExpandModularHeadersPPCallbacks::PragmaDiagnosticPop(
215+
SourceLocation Loc, StringRef /*Namespace*/) {
217216
parseToLocation(Loc);
218217
}
219-
void ExpandModularHeadersPPCallbacks::PragmaDiagnostic(SourceLocation Loc,
220-
StringRef,
221-
diag::Severity,
222-
StringRef) {
218+
void ExpandModularHeadersPPCallbacks::PragmaDiagnostic(
219+
SourceLocation Loc, StringRef /*Namespace*/, diag::Severity /*mapping*/,
220+
StringRef /*Str*/) {
223221
parseToLocation(Loc);
224222
}
225-
void ExpandModularHeadersPPCallbacks::HasInclude(SourceLocation Loc, StringRef,
226-
bool, OptionalFileEntryRef,
227-
SrcMgr::CharacteristicKind) {
223+
void ExpandModularHeadersPPCallbacks::HasInclude(
224+
SourceLocation Loc, StringRef /*FileName*/, bool /*IsAngled*/,
225+
OptionalFileEntryRef /*File*/, SrcMgr::CharacteristicKind /*FileType*/) {
228226
parseToLocation(Loc);
229227
}
230228
void ExpandModularHeadersPPCallbacks::PragmaOpenCLExtension(
231-
SourceLocation NameLoc, const IdentifierInfo *, SourceLocation StateLoc,
232-
unsigned) {
229+
SourceLocation NameLoc, const IdentifierInfo * /*Name*/,
230+
SourceLocation StateLoc, unsigned /*State*/) {
233231
// FIXME: Figure out whether it's the right location to parse to.
234232
parseToLocation(NameLoc);
235233
}
236-
void ExpandModularHeadersPPCallbacks::PragmaWarning(SourceLocation Loc,
237-
PragmaWarningSpecifier,
238-
ArrayRef<int>) {
234+
void ExpandModularHeadersPPCallbacks::PragmaWarning(
235+
SourceLocation Loc, PragmaWarningSpecifier /*WarningSpec*/,
236+
ArrayRef<int> /*Ids*/) {
239237
parseToLocation(Loc);
240238
}
241239
void ExpandModularHeadersPPCallbacks::PragmaWarningPush(SourceLocation Loc,
242-
int) {
240+
int /*Level*/) {
243241
parseToLocation(Loc);
244242
}
245243
void ExpandModularHeadersPPCallbacks::PragmaWarningPop(SourceLocation Loc) {
@@ -253,10 +251,9 @@ void ExpandModularHeadersPPCallbacks::PragmaAssumeNonNullEnd(
253251
SourceLocation Loc) {
254252
parseToLocation(Loc);
255253
}
256-
void ExpandModularHeadersPPCallbacks::MacroExpands(const Token &MacroNameTok,
257-
const MacroDefinition &,
258-
SourceRange Range,
259-
const MacroArgs *) {
254+
void ExpandModularHeadersPPCallbacks::MacroExpands(
255+
const Token &MacroNameTok, const MacroDefinition & /*MD*/,
256+
SourceRange Range, const MacroArgs * /*Args*/) {
260257
// FIXME: Figure out whether it's the right location to parse to.
261258
parseToLocation(Range.getBegin());
262259
}
@@ -265,12 +262,13 @@ void ExpandModularHeadersPPCallbacks::MacroDefined(const Token &MacroNameTok,
265262
parseToLocation(MD->getLocation());
266263
}
267264
void ExpandModularHeadersPPCallbacks::MacroUndefined(
268-
const Token &, const MacroDefinition &, const MacroDirective *Undef) {
265+
const Token & /*MacroNameTok*/, const MacroDefinition & /*MD*/,
266+
const MacroDirective *Undef) {
269267
if (Undef)
270268
parseToLocation(Undef->getLocation());
271269
}
272270
void ExpandModularHeadersPPCallbacks::Defined(const Token &MacroNameTok,
273-
const MacroDefinition &,
271+
const MacroDefinition & /*MD*/,
274272
SourceRange Range) {
275273
// FIXME: Figure out whether it's the right location to parse to.
276274
parseToLocation(Range.getBegin());
@@ -280,27 +278,32 @@ void ExpandModularHeadersPPCallbacks::SourceRangeSkipped(
280278
// FIXME: Figure out whether it's the right location to parse to.
281279
parseToLocation(EndifLoc);
282280
}
283-
void ExpandModularHeadersPPCallbacks::If(SourceLocation Loc, SourceRange,
284-
ConditionValueKind) {
281+
void ExpandModularHeadersPPCallbacks::If(
282+
SourceLocation Loc, SourceRange /*ConditionRange*/,
283+
ConditionValueKind /*ConditionValue*/) {
285284
parseToLocation(Loc);
286285
}
287-
void ExpandModularHeadersPPCallbacks::Elif(SourceLocation Loc, SourceRange,
288-
ConditionValueKind, SourceLocation) {
286+
void ExpandModularHeadersPPCallbacks::Elif(
287+
SourceLocation Loc, SourceRange /*ConditionRange*/,
288+
ConditionValueKind /*ConditionValue*/, SourceLocation /*IfLoc*/) {
289289
parseToLocation(Loc);
290290
}
291-
void ExpandModularHeadersPPCallbacks::Ifdef(SourceLocation Loc, const Token &,
292-
const MacroDefinition &) {
291+
void ExpandModularHeadersPPCallbacks::Ifdef(SourceLocation Loc,
292+
const Token & /*MacroNameTok*/,
293+
const MacroDefinition & /*MD*/) {
293294
parseToLocation(Loc);
294295
}
295-
void ExpandModularHeadersPPCallbacks::Ifndef(SourceLocation Loc, const Token &,
296-
const MacroDefinition &) {
296+
void ExpandModularHeadersPPCallbacks::Ifndef(SourceLocation Loc,
297+
const Token & /*MacroNameTok*/,
298+
const MacroDefinition & /*MD*/) {
297299
parseToLocation(Loc);
298300
}
299-
void ExpandModularHeadersPPCallbacks::Else(SourceLocation Loc, SourceLocation) {
301+
void ExpandModularHeadersPPCallbacks::Else(SourceLocation Loc,
302+
SourceLocation /*IfLoc*/) {
300303
parseToLocation(Loc);
301304
}
302305
void ExpandModularHeadersPPCallbacks::Endif(SourceLocation Loc,
303-
SourceLocation) {
306+
SourceLocation /*IfLoc*/) {
304307
parseToLocation(Loc);
305308
}
306309

clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,19 @@ class KernelNameRestrictionPPCallbacks : public PPCallbacks {
5151

5252
} // namespace
5353

54-
void KernelNameRestrictionCheck::registerPPCallbacks(const SourceManager &SM,
55-
Preprocessor *PP,
56-
Preprocessor *) {
54+
void KernelNameRestrictionCheck::registerPPCallbacks(
55+
const SourceManager &SM, Preprocessor *PP,
56+
Preprocessor * /*ModuleExpanderPP*/) {
5757
PP->addPPCallbacks(
5858
std::make_unique<KernelNameRestrictionPPCallbacks>(*this, SM));
5959
}
6060

6161
void KernelNameRestrictionPPCallbacks::InclusionDirective(
62-
SourceLocation HashLoc, const Token &, StringRef FileName, bool,
63-
CharSourceRange, OptionalFileEntryRef, StringRef, StringRef, const Module *,
64-
bool, SrcMgr::CharacteristicKind) {
62+
SourceLocation HashLoc, const Token & /*IncludeTok*/, StringRef FileName,
63+
bool /*IsAngled*/, CharSourceRange /*FilenameRange*/,
64+
OptionalFileEntryRef /*File*/, StringRef /*SearchPath*/,
65+
StringRef /*RelativePath*/, const Module * /*SuggestedModule*/,
66+
bool /*ModuleImported*/, SrcMgr::CharacteristicKind /*FileType*/) {
6567
IncludeDirective ID = {HashLoc, FileName};
6668
IncludeDirectives.push_back(std::move(ID));
6769
}

clang-tools-extra/clang-tidy/bugprone/AssignmentInIfConditionCheck.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ void AssignmentInIfConditionCheck::check(
3535
: Check(Check) {}
3636

3737
// Dont traverse into any lambda expressions.
38-
bool TraverseLambdaExpr(LambdaExpr *, DataRecursionQueue * = nullptr) {
38+
bool TraverseLambdaExpr(LambdaExpr * /*unused*/,
39+
DataRecursionQueue * /*unused*/ = nullptr) {
3940
return true;
4041
}
4142

4243
// Dont traverse into any requires expressions.
43-
bool TraverseRequiresExpr(RequiresExpr *,
44-
DataRecursionQueue * = nullptr) {
44+
bool TraverseRequiresExpr(RequiresExpr * /*unused*/,
45+
DataRecursionQueue * /*unused*/ = nullptr) {
4546
return true;
4647
}
4748

clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,28 @@ static bool isFallthroughSwitchBranch(const SwitchBranch &Branch) {
5050
struct SwitchCaseVisitor : RecursiveASTVisitor<SwitchCaseVisitor> {
5151
using RecursiveASTVisitor<SwitchCaseVisitor>::DataRecursionQueue;
5252

53-
bool TraverseLambdaExpr(LambdaExpr *, DataRecursionQueue * = nullptr) {
53+
bool TraverseLambdaExpr(LambdaExpr * /*unused*/,
54+
DataRecursionQueue * /*unused*/ = nullptr) {
5455
return true; // Ignore lambdas
5556
}
5657

57-
bool TraverseDecl(Decl *) {
58+
bool TraverseDecl(Decl * /*unused*/) {
5859
return true; // No need to check declarations
5960
}
6061

61-
bool TraverseSwitchStmt(SwitchStmt *, DataRecursionQueue * = nullptr) {
62+
bool TraverseSwitchStmt(SwitchStmt * /*unused*/,
63+
DataRecursionQueue * /*unused*/ = nullptr) {
6264
return true; // Ignore sub-switches
6365
}
6466

6567
// NOLINTNEXTLINE(readability-identifier-naming) - FIXME
66-
bool TraverseSwitchCase(SwitchCase *, DataRecursionQueue * = nullptr) {
68+
bool TraverseSwitchCase(SwitchCase * /*unused*/,
69+
DataRecursionQueue * /*unused*/ = nullptr) {
6770
return true; // Ignore cases
6871
}
6972

70-
bool TraverseDefaultStmt(DefaultStmt *, DataRecursionQueue * = nullptr) {
73+
bool TraverseDefaultStmt(DefaultStmt * /*unused*/,
74+
DataRecursionQueue * /*unused*/ = nullptr) {
7175
return true; // Ignore defaults
7276
}
7377

clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ getFailureInfoImpl(StringRef Name, bool IsInGlobalNamespace, bool IsMacro,
173173
}
174174

175175
std::optional<RenamerClangTidyCheck::FailureInfo>
176-
ReservedIdentifierCheck::getDeclFailureInfo(const NamedDecl *Decl,
177-
const SourceManager &) const {
176+
ReservedIdentifierCheck::getDeclFailureInfo(
177+
const NamedDecl *Decl, const SourceManager & /*SM*/) const {
178178
assert(Decl && Decl->getIdentifier() && !Decl->getName().empty() &&
179179
"Decl must be an explicit identifier with a name.");
180180
// Implicit identifiers cannot fail.
@@ -187,8 +187,8 @@ ReservedIdentifierCheck::getDeclFailureInfo(const NamedDecl *Decl,
187187
}
188188

189189
std::optional<RenamerClangTidyCheck::FailureInfo>
190-
ReservedIdentifierCheck::getMacroFailureInfo(const Token &MacroNameTok,
191-
const SourceManager &) const {
190+
ReservedIdentifierCheck::getMacroFailureInfo(
191+
const Token &MacroNameTok, const SourceManager & /*SM*/) const {
192192
return getFailureInfoImpl(MacroNameTok.getIdentifierInfo()->getName(), true,
193193
/*IsMacro = */ true, getLangOpts(), Invert,
194194
AllowedIdentifiers);

clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class UpgradeGoogletestCasePPCallback : public PPCallbacks {
4848
: Check(Check), PP(PP) {}
4949

5050
void MacroExpands(const Token &MacroNameTok, const MacroDefinition &MD,
51-
SourceRange Range, const MacroArgs *) override {
51+
SourceRange Range, const MacroArgs * /*Args*/) override {
5252
macroUsed(MacroNameTok, MD, Range.getBegin(), CheckAction::Rename);
5353
}
5454

@@ -119,9 +119,9 @@ class UpgradeGoogletestCasePPCallback : public PPCallbacks {
119119

120120
} // namespace
121121

122-
void UpgradeGoogletestCaseCheck::registerPPCallbacks(const SourceManager &,
123-
Preprocessor *PP,
124-
Preprocessor *) {
122+
void UpgradeGoogletestCaseCheck::registerPPCallbacks(
123+
const SourceManager & /*SM*/, Preprocessor *PP,
124+
Preprocessor * /*ModuleExpanderPP*/) {
125125
PP->addPPCallbacks(
126126
std::make_unique<UpgradeGoogletestCasePPCallback>(this, PP));
127127
}

clang-tools-extra/clang-tidy/llvm/UseRangesCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class StdToLLVMReplacer : public utils::UseRangesCheck::Replacer {
2929
}
3030

3131
std::optional<std::string>
32-
getHeaderInclusion(const NamedDecl &) const override {
32+
getHeaderInclusion(const NamedDecl & /*OriginalName*/) const override {
3333
return "llvm/ADT/STLExtras.h";
3434
}
3535

clang-tools-extra/clang-tidy/misc/HeaderIncludeCycleCheck.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,13 @@ class CyclicDependencyCallbacks : public PPCallbacks {
7373
Files.push_back({NewFile, FileName, std::exchange(NextToEnter, {})});
7474
}
7575

76-
void InclusionDirective(SourceLocation, const Token &, StringRef FilePath,
77-
bool, CharSourceRange Range,
78-
OptionalFileEntryRef File, StringRef, StringRef,
79-
const Module *, bool,
76+
void InclusionDirective(SourceLocation /*HashLoc*/,
77+
const Token & /*IncludeTok*/, StringRef FilePath,
78+
bool /*IsAngled*/, CharSourceRange Range,
79+
OptionalFileEntryRef File, StringRef /*SearchPath*/,
80+
StringRef /*RelativePath*/,
81+
const Module * /*SuggestedModule*/,
82+
bool /*ModuleImported*/,
8083
SrcMgr::CharacteristicKind FileType) override {
8184
if (FileType != clang::SrcMgr::C_User)
8285
return;

0 commit comments

Comments
 (0)