[clang-tools-extra] [clang-tidy][NFC] Enable 'readability-named-parameter' check (PR #158774)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 15 21:55:55 PDT 2025
https://github.com/capitan-davide updated https://github.com/llvm/llvm-project/pull/158774
>From b481e9d6f59ffe03a2581c60188e656824c9ac72 Mon Sep 17 00:00:00 2001
From: Davide Cunial <dcunial at proton.me>
Date: Tue, 16 Sep 2025 06:53:45 +0200
Subject: [PATCH] [clang-tidy][NFC] Enable 'readability-named-parameter' check
---
clang-tools-extra/clang-tidy/.clang-tidy | 1 -
.../clang-tidy/ClangTidyOptions.cpp | 11 ++-
.../ExpandModularHeadersPPCallbacks.cpp | 95 ++++++++++---------
.../altera/KernelNameRestrictionCheck.cpp | 14 +--
.../bugprone/AssignmentInIfConditionCheck.cpp | 7 +-
.../clang-tidy/bugprone/BranchCloneCheck.cpp | 14 ++-
.../bugprone/NotNullTerminatedResultCheck.cpp | 2 +-
.../bugprone/ReservedIdentifierCheck.cpp | 8 +-
.../google/UpgradeGoogletestCaseCheck.cpp | 8 +-
.../clang-tidy/llvm/UseRangesCheck.cpp | 2 +-
.../misc/HeaderIncludeCycleCheck.cpp | 11 ++-
.../clang-tidy/modernize/MacroToEnumCheck.cpp | 4 +-
.../clang-tidy/plugin/ClangTidyPlugin.cpp | 2 +-
.../MakeMemberFunctionConstCheck.cpp | 4 +-
.../UseConcisePreprocessorDirectivesCheck.cpp | 10 +-
.../utils/RenamerClangTidyCheck.cpp | 2 +-
.../clang-tidy/utils/UseRangesCheck.cpp | 9 +-
17 files changed, 111 insertions(+), 93 deletions(-)
diff --git a/clang-tools-extra/clang-tidy/.clang-tidy b/clang-tools-extra/clang-tidy/.clang-tidy
index d290901730405..c0401a7da8578 100644
--- a/clang-tools-extra/clang-tidy/.clang-tidy
+++ b/clang-tools-extra/clang-tidy/.clang-tidy
@@ -27,7 +27,6 @@ Checks: >
-readability-implicit-bool-conversion,
-readability-isolate-declaration,
-readability-magic-numbers,
- -readability-named-parameter,
-readability-qualified-auto,
-readability-simplify-boolean-expr,
-readability-static-definition-in-anonymous-namespace,
diff --git a/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp b/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
index e59f157b468bc..ec24eb3e688fb 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
@@ -66,14 +66,14 @@ template <> struct MappingTraits<ClangTidyOptions::StringPair> {
};
struct NOptionMap {
- NOptionMap(IO &) {}
- NOptionMap(IO &, const ClangTidyOptions::OptionMap &OptionMap) {
+ NOptionMap(IO & /*unused*/) {}
+ NOptionMap(IO & /*unused*/, const ClangTidyOptions::OptionMap &OptionMap) {
Options.reserve(OptionMap.size());
for (const auto &KeyValue : OptionMap)
Options.emplace_back(std::string(KeyValue.getKey()),
KeyValue.getValue().Value);
}
- ClangTidyOptions::OptionMap denormalize(IO &) {
+ ClangTidyOptions::OptionMap denormalize(IO & /*unused*/) {
ClangTidyOptions::OptionMap Map;
for (const auto &KeyValue : Options)
Map[KeyValue.first] = ClangTidyOptions::ClangTidyValue(KeyValue.second);
@@ -83,7 +83,7 @@ struct NOptionMap {
};
template <>
-void yamlize(IO &IO, ClangTidyOptions::OptionMap &Val, bool,
+void yamlize(IO &IO, ClangTidyOptions::OptionMap &Val, bool /*unused*/,
EmptyContext &Ctx) {
if (IO.outputting()) {
// Ensure check options are sorted
@@ -130,7 +130,8 @@ struct ChecksVariant {
std::optional<std::vector<std::string>> AsVector;
};
-template <> void yamlize(IO &IO, ChecksVariant &Val, bool, EmptyContext &Ctx) {
+template <>
+void yamlize(IO &IO, ChecksVariant &Val, bool /*unused*/, EmptyContext &Ctx) {
if (!IO.outputting()) {
// Special case for reading from YAML
// Must support reading from both a string or a list
diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
index 487e5e299d132..f43dde7154fc7 100644
--- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
+++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
@@ -181,65 +181,63 @@ void ExpandModularHeadersPPCallbacks::EndOfMainFile() {
// Handle all other callbacks.
// Just parse to the corresponding location to generate the same callback for
// the PPCallbacks registered in our custom preprocessor.
-void ExpandModularHeadersPPCallbacks::Ident(SourceLocation Loc, StringRef) {
+void ExpandModularHeadersPPCallbacks::Ident(SourceLocation Loc,
+ StringRef /*str*/) {
parseToLocation(Loc);
}
-void ExpandModularHeadersPPCallbacks::PragmaDirective(SourceLocation Loc,
- PragmaIntroducerKind) {
+void ExpandModularHeadersPPCallbacks::PragmaDirective(
+ SourceLocation Loc, PragmaIntroducerKind /*Introducer*/) {
parseToLocation(Loc);
}
-void ExpandModularHeadersPPCallbacks::PragmaComment(SourceLocation Loc,
- const IdentifierInfo *,
- StringRef) {
+void ExpandModularHeadersPPCallbacks::PragmaComment(
+ SourceLocation Loc, const IdentifierInfo * /*Kind*/, StringRef /*Str*/) {
parseToLocation(Loc);
}
-void ExpandModularHeadersPPCallbacks::PragmaDetectMismatch(SourceLocation Loc,
- StringRef,
- StringRef) {
+void ExpandModularHeadersPPCallbacks::PragmaDetectMismatch(
+ SourceLocation Loc, StringRef /*Name*/, StringRef /*Value*/) {
parseToLocation(Loc);
}
void ExpandModularHeadersPPCallbacks::PragmaDebug(SourceLocation Loc,
- StringRef) {
+ StringRef /*DebugType*/) {
parseToLocation(Loc);
}
void ExpandModularHeadersPPCallbacks::PragmaMessage(SourceLocation Loc,
- StringRef,
- PragmaMessageKind,
- StringRef) {
+ StringRef /*Namespace*/,
+ PragmaMessageKind /*Kind*/,
+ StringRef /*Str*/) {
parseToLocation(Loc);
}
-void ExpandModularHeadersPPCallbacks::PragmaDiagnosticPush(SourceLocation Loc,
- StringRef) {
+void ExpandModularHeadersPPCallbacks::PragmaDiagnosticPush(
+ SourceLocation Loc, StringRef /*Namespace*/) {
parseToLocation(Loc);
}
-void ExpandModularHeadersPPCallbacks::PragmaDiagnosticPop(SourceLocation Loc,
- StringRef) {
+void ExpandModularHeadersPPCallbacks::PragmaDiagnosticPop(
+ SourceLocation Loc, StringRef /*Namespace*/) {
parseToLocation(Loc);
}
-void ExpandModularHeadersPPCallbacks::PragmaDiagnostic(SourceLocation Loc,
- StringRef,
- diag::Severity,
- StringRef) {
+void ExpandModularHeadersPPCallbacks::PragmaDiagnostic(
+ SourceLocation Loc, StringRef /*Namespace*/, diag::Severity /*mapping*/,
+ StringRef /*Str*/) {
parseToLocation(Loc);
}
-void ExpandModularHeadersPPCallbacks::HasInclude(SourceLocation Loc, StringRef,
- bool, OptionalFileEntryRef,
- SrcMgr::CharacteristicKind) {
+void ExpandModularHeadersPPCallbacks::HasInclude(
+ SourceLocation Loc, StringRef /*FileName*/, bool /*IsAngled*/,
+ OptionalFileEntryRef /*File*/, SrcMgr::CharacteristicKind /*FileType*/) {
parseToLocation(Loc);
}
void ExpandModularHeadersPPCallbacks::PragmaOpenCLExtension(
- SourceLocation NameLoc, const IdentifierInfo *, SourceLocation StateLoc,
- unsigned) {
+ SourceLocation NameLoc, const IdentifierInfo * /*Name*/,
+ SourceLocation StateLoc, unsigned /*State*/) {
// FIXME: Figure out whether it's the right location to parse to.
parseToLocation(NameLoc);
}
-void ExpandModularHeadersPPCallbacks::PragmaWarning(SourceLocation Loc,
- PragmaWarningSpecifier,
- ArrayRef<int>) {
+void ExpandModularHeadersPPCallbacks::PragmaWarning(
+ SourceLocation Loc, PragmaWarningSpecifier /*WarningSpec*/,
+ ArrayRef<int> /*Ids*/) {
parseToLocation(Loc);
}
void ExpandModularHeadersPPCallbacks::PragmaWarningPush(SourceLocation Loc,
- int) {
+ int /*Level*/) {
parseToLocation(Loc);
}
void ExpandModularHeadersPPCallbacks::PragmaWarningPop(SourceLocation Loc) {
@@ -253,10 +251,9 @@ void ExpandModularHeadersPPCallbacks::PragmaAssumeNonNullEnd(
SourceLocation Loc) {
parseToLocation(Loc);
}
-void ExpandModularHeadersPPCallbacks::MacroExpands(const Token &MacroNameTok,
- const MacroDefinition &,
- SourceRange Range,
- const MacroArgs *) {
+void ExpandModularHeadersPPCallbacks::MacroExpands(
+ const Token &MacroNameTok, const MacroDefinition & /*MD*/,
+ SourceRange Range, const MacroArgs * /*Args*/) {
// FIXME: Figure out whether it's the right location to parse to.
parseToLocation(Range.getBegin());
}
@@ -265,12 +262,13 @@ void ExpandModularHeadersPPCallbacks::MacroDefined(const Token &MacroNameTok,
parseToLocation(MD->getLocation());
}
void ExpandModularHeadersPPCallbacks::MacroUndefined(
- const Token &, const MacroDefinition &, const MacroDirective *Undef) {
+ const Token & /*MacroNameTok*/, const MacroDefinition & /*MD*/,
+ const MacroDirective *Undef) {
if (Undef)
parseToLocation(Undef->getLocation());
}
void ExpandModularHeadersPPCallbacks::Defined(const Token &MacroNameTok,
- const MacroDefinition &,
+ const MacroDefinition & /*MD*/,
SourceRange Range) {
// FIXME: Figure out whether it's the right location to parse to.
parseToLocation(Range.getBegin());
@@ -280,27 +278,32 @@ void ExpandModularHeadersPPCallbacks::SourceRangeSkipped(
// FIXME: Figure out whether it's the right location to parse to.
parseToLocation(EndifLoc);
}
-void ExpandModularHeadersPPCallbacks::If(SourceLocation Loc, SourceRange,
- ConditionValueKind) {
+void ExpandModularHeadersPPCallbacks::If(
+ SourceLocation Loc, SourceRange /*ConditionRange*/,
+ ConditionValueKind /*ConditionValue*/) {
parseToLocation(Loc);
}
-void ExpandModularHeadersPPCallbacks::Elif(SourceLocation Loc, SourceRange,
- ConditionValueKind, SourceLocation) {
+void ExpandModularHeadersPPCallbacks::Elif(
+ SourceLocation Loc, SourceRange /*ConditionRange*/,
+ ConditionValueKind /*ConditionValue*/, SourceLocation /*IfLoc*/) {
parseToLocation(Loc);
}
-void ExpandModularHeadersPPCallbacks::Ifdef(SourceLocation Loc, const Token &,
- const MacroDefinition &) {
+void ExpandModularHeadersPPCallbacks::Ifdef(SourceLocation Loc,
+ const Token & /*MacroNameTok*/,
+ const MacroDefinition & /*MD*/) {
parseToLocation(Loc);
}
-void ExpandModularHeadersPPCallbacks::Ifndef(SourceLocation Loc, const Token &,
- const MacroDefinition &) {
+void ExpandModularHeadersPPCallbacks::Ifndef(SourceLocation Loc,
+ const Token & /*MacroNameTok*/,
+ const MacroDefinition & /*MD*/) {
parseToLocation(Loc);
}
-void ExpandModularHeadersPPCallbacks::Else(SourceLocation Loc, SourceLocation) {
+void ExpandModularHeadersPPCallbacks::Else(SourceLocation Loc,
+ SourceLocation /*IfLoc*/) {
parseToLocation(Loc);
}
void ExpandModularHeadersPPCallbacks::Endif(SourceLocation Loc,
- SourceLocation) {
+ SourceLocation /*IfLoc*/) {
parseToLocation(Loc);
}
diff --git a/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp b/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp
index a94d6c8d7c4e6..4125b6d27d723 100644
--- a/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp
@@ -51,17 +51,19 @@ class KernelNameRestrictionPPCallbacks : public PPCallbacks {
} // namespace
-void KernelNameRestrictionCheck::registerPPCallbacks(const SourceManager &SM,
- Preprocessor *PP,
- Preprocessor *) {
+void KernelNameRestrictionCheck::registerPPCallbacks(
+ const SourceManager &SM, Preprocessor *PP,
+ Preprocessor * /*ModuleExpanderPP*/) {
PP->addPPCallbacks(
std::make_unique<KernelNameRestrictionPPCallbacks>(*this, SM));
}
void KernelNameRestrictionPPCallbacks::InclusionDirective(
- SourceLocation HashLoc, const Token &, StringRef FileName, bool,
- CharSourceRange, OptionalFileEntryRef, StringRef, StringRef, const Module *,
- bool, SrcMgr::CharacteristicKind) {
+ SourceLocation HashLoc, const Token & /*IncludeTok*/, StringRef FileName,
+ bool /*IsAngled*/, CharSourceRange /*FilenameRange*/,
+ OptionalFileEntryRef /*File*/, StringRef /*SearchPath*/,
+ StringRef /*RelativePath*/, const Module * /*SuggestedModule*/,
+ bool /*ModuleImported*/, SrcMgr::CharacteristicKind /*FileType*/) {
IncludeDirective ID = {HashLoc, FileName};
IncludeDirectives.push_back(std::move(ID));
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/AssignmentInIfConditionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/AssignmentInIfConditionCheck.cpp
index e03cac6c5fd83..c02eb1bed7cc2 100644
--- a/clang-tools-extra/clang-tidy/bugprone/AssignmentInIfConditionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/AssignmentInIfConditionCheck.cpp
@@ -35,13 +35,14 @@ void AssignmentInIfConditionCheck::check(
: Check(Check) {}
// Dont traverse into any lambda expressions.
- bool TraverseLambdaExpr(LambdaExpr *, DataRecursionQueue * = nullptr) {
+ bool TraverseLambdaExpr(LambdaExpr * /*unused*/,
+ DataRecursionQueue * /*unused*/ = nullptr) {
return true;
}
// Dont traverse into any requires expressions.
- bool TraverseRequiresExpr(RequiresExpr *,
- DataRecursionQueue * = nullptr) {
+ bool TraverseRequiresExpr(RequiresExpr * /*unused*/,
+ DataRecursionQueue * /*unused*/ = nullptr) {
return true;
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
index a6cd68edda55e..54d3bf612b3f8 100644
--- a/clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
@@ -50,24 +50,28 @@ static bool isFallthroughSwitchBranch(const SwitchBranch &Branch) {
struct SwitchCaseVisitor : RecursiveASTVisitor<SwitchCaseVisitor> {
using RecursiveASTVisitor<SwitchCaseVisitor>::DataRecursionQueue;
- bool TraverseLambdaExpr(LambdaExpr *, DataRecursionQueue * = nullptr) {
+ bool TraverseLambdaExpr(LambdaExpr * /*unused*/,
+ DataRecursionQueue * /*unused*/ = nullptr) {
return true; // Ignore lambdas
}
- bool TraverseDecl(Decl *) {
+ bool TraverseDecl(Decl * /*unused*/) {
return true; // No need to check declarations
}
- bool TraverseSwitchStmt(SwitchStmt *, DataRecursionQueue * = nullptr) {
+ bool TraverseSwitchStmt(SwitchStmt * /*unused*/,
+ DataRecursionQueue * /*unused*/ = nullptr) {
return true; // Ignore sub-switches
}
// NOLINTNEXTLINE(readability-identifier-naming) - FIXME
- bool TraverseSwitchCase(SwitchCase *, DataRecursionQueue * = nullptr) {
+ bool TraverseSwitchCase(SwitchCase * /*unused*/,
+ DataRecursionQueue * /*unused*/ = nullptr) {
return true; // Ignore cases
}
- bool TraverseDefaultStmt(DefaultStmt *, DataRecursionQueue * = nullptr) {
+ bool TraverseDefaultStmt(DefaultStmt * /*unused*/,
+ DataRecursionQueue * /*unused*/ = nullptr) {
return true; // Ignore defaults
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
index 203170d55f694..da4eea3242008 100644
--- a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
@@ -677,7 +677,7 @@ void NotNullTerminatedResultCheck::registerMatchers(MatchFinder *Finder) {
std::optional<unsigned> SourcePos, unsigned LengthPos,
bool WithIncrease)
: Name(Name), DestinationPos(DestinationPos), SourcePos(SourcePos),
- LengthPos(LengthPos), WithIncrease(WithIncrease) {};
+ LengthPos(LengthPos), WithIncrease(WithIncrease){};
StringRef Name;
std::optional<unsigned> DestinationPos;
diff --git a/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp
index 5812c18a2ccca..88530f86fb54e 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp
@@ -173,8 +173,8 @@ getFailureInfoImpl(StringRef Name, bool IsInGlobalNamespace, bool IsMacro,
}
std::optional<RenamerClangTidyCheck::FailureInfo>
-ReservedIdentifierCheck::getDeclFailureInfo(const NamedDecl *Decl,
- const SourceManager &) const {
+ReservedIdentifierCheck::getDeclFailureInfo(
+ const NamedDecl *Decl, const SourceManager & /*SM*/) const {
assert(Decl && Decl->getIdentifier() && !Decl->getName().empty() &&
"Decl must be an explicit identifier with a name.");
// Implicit identifiers cannot fail.
@@ -187,8 +187,8 @@ ReservedIdentifierCheck::getDeclFailureInfo(const NamedDecl *Decl,
}
std::optional<RenamerClangTidyCheck::FailureInfo>
-ReservedIdentifierCheck::getMacroFailureInfo(const Token &MacroNameTok,
- const SourceManager &) const {
+ReservedIdentifierCheck::getMacroFailureInfo(
+ const Token &MacroNameTok, const SourceManager & /*SM*/) const {
return getFailureInfoImpl(MacroNameTok.getIdentifierInfo()->getName(), true,
/*IsMacro = */ true, getLangOpts(), Invert,
AllowedIdentifiers);
diff --git a/clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp b/clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp
index c9b48e922ea57..34b98db3a14a3 100644
--- a/clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp
+++ b/clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp
@@ -48,7 +48,7 @@ class UpgradeGoogletestCasePPCallback : public PPCallbacks {
: Check(Check), PP(PP) {}
void MacroExpands(const Token &MacroNameTok, const MacroDefinition &MD,
- SourceRange Range, const MacroArgs *) override {
+ SourceRange Range, const MacroArgs * /*Args*/) override {
macroUsed(MacroNameTok, MD, Range.getBegin(), CheckAction::Rename);
}
@@ -119,9 +119,9 @@ class UpgradeGoogletestCasePPCallback : public PPCallbacks {
} // namespace
-void UpgradeGoogletestCaseCheck::registerPPCallbacks(const SourceManager &,
- Preprocessor *PP,
- Preprocessor *) {
+void UpgradeGoogletestCaseCheck::registerPPCallbacks(
+ const SourceManager & /*SM*/, Preprocessor *PP,
+ Preprocessor * /*ModuleExpanderPP*/) {
PP->addPPCallbacks(
std::make_unique<UpgradeGoogletestCasePPCallback>(this, PP));
}
diff --git a/clang-tools-extra/clang-tidy/llvm/UseRangesCheck.cpp b/clang-tools-extra/clang-tidy/llvm/UseRangesCheck.cpp
index 4afab488b7dcc..70a082af526a1 100644
--- a/clang-tools-extra/clang-tidy/llvm/UseRangesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/llvm/UseRangesCheck.cpp
@@ -29,7 +29,7 @@ class StdToLLVMReplacer : public utils::UseRangesCheck::Replacer {
}
std::optional<std::string>
- getHeaderInclusion(const NamedDecl &) const override {
+ getHeaderInclusion(const NamedDecl & /*OriginalName*/) const override {
return "llvm/ADT/STLExtras.h";
}
diff --git a/clang-tools-extra/clang-tidy/misc/HeaderIncludeCycleCheck.cpp b/clang-tools-extra/clang-tidy/misc/HeaderIncludeCycleCheck.cpp
index 1f6ceda9f5b9e..ca2dd8cd314d4 100644
--- a/clang-tools-extra/clang-tidy/misc/HeaderIncludeCycleCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/HeaderIncludeCycleCheck.cpp
@@ -73,10 +73,13 @@ class CyclicDependencyCallbacks : public PPCallbacks {
Files.push_back({NewFile, FileName, std::exchange(NextToEnter, {})});
}
- void InclusionDirective(SourceLocation, const Token &, StringRef FilePath,
- bool, CharSourceRange Range,
- OptionalFileEntryRef File, StringRef, StringRef,
- const Module *, bool,
+ void InclusionDirective(SourceLocation /*HashLoc*/,
+ const Token & /*IncludeTok*/, StringRef FilePath,
+ bool /*IsAngled*/, CharSourceRange Range,
+ OptionalFileEntryRef File, StringRef /*SearchPath*/,
+ StringRef /*RelativePath*/,
+ const Module * /*SuggestedModule*/,
+ bool /*ModuleImported*/,
SrcMgr::CharacteristicKind FileType) override {
if (FileType != clang::SrcMgr::C_User)
return;
diff --git a/clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp b/clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp
index 118e96a6f34ae..62606d49745d4 100644
--- a/clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp
@@ -400,7 +400,9 @@ static bool textEquals(const char (&Needle)[N], const char *HayStack) {
return StringRef{HayStack, N - 1} == Needle;
}
-template <size_t N> static size_t len(const char (&)[N]) { return N - 1; }
+template <size_t N> static size_t len(const char (&/*unused*/)[N]) {
+ return N - 1;
+}
void MacroToEnumCallbacks::PragmaDirective(SourceLocation Loc,
PragmaIntroducerKind Introducer) {
diff --git a/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp b/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
index 195418d2e2ca2..4a3a0ef688ab6 100644
--- a/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
+++ b/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
@@ -53,7 +53,7 @@ class ClangTidyPluginAction : public PluginASTAction {
std::move(Context), std::move(DiagEngine), std::move(Vec));
}
- bool ParseArgs(const CompilerInstance &,
+ bool ParseArgs(const CompilerInstance & /*CI*/,
const std::vector<std::string> &Args) override {
ClangTidyGlobalOptions GlobalOptions;
ClangTidyOptions DefaultOptions;
diff --git a/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp b/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
index aace96f54c61c..237673e6c7d0b 100644
--- a/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
@@ -73,14 +73,14 @@ class FindUsageOfThis : public RecursiveASTVisitor<FindUsageOfThis> {
return Parent;
}
- bool VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *) {
+ bool VisitUnresolvedMemberExpr(const UnresolvedMemberExpr * /*unused*/) {
// An UnresolvedMemberExpr might resolve to a non-const non-static
// member function.
Usage = NonConst;
return false; // Stop traversal.
}
- bool VisitCXXConstCastExpr(const CXXConstCastExpr *) {
+ bool VisitCXXConstCastExpr(const CXXConstCastExpr * /*unused*/) {
// Workaround to support the pattern
// class C {
// const S *get() const;
diff --git a/clang-tools-extra/clang-tidy/readability/UseConcisePreprocessorDirectivesCheck.cpp b/clang-tools-extra/clang-tidy/readability/UseConcisePreprocessorDirectivesCheck.cpp
index 05c0088e6b41b..f05a549b08e53 100644
--- a/clang-tools-extra/clang-tidy/readability/UseConcisePreprocessorDirectivesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/UseConcisePreprocessorDirectivesCheck.cpp
@@ -24,12 +24,13 @@ class IfPreprocessorCallbacks final : public PPCallbacks {
: Check(Check), PP(PP) {}
void If(SourceLocation Loc, SourceRange ConditionRange,
- ConditionValueKind) override {
+ ConditionValueKind /*ConditionValue*/) override {
impl(Loc, ConditionRange, {"ifdef", "ifndef"});
}
- void Elif(SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind,
- SourceLocation) override {
+ void Elif(SourceLocation Loc, SourceRange ConditionRange,
+ ConditionValueKind /*ConditionValue*/,
+ SourceLocation /*IfLoc*/) override {
if (PP.getLangOpts().C23 || PP.getLangOpts().CPlusPlus23)
impl(Loc, ConditionRange, {"elifdef", "elifndef"});
}
@@ -103,7 +104,8 @@ class IfPreprocessorCallbacks final : public PPCallbacks {
} // namespace
void UseConcisePreprocessorDirectivesCheck::registerPPCallbacks(
- const SourceManager &, Preprocessor *PP, Preprocessor *) {
+ const SourceManager & /*SM*/, Preprocessor *PP,
+ Preprocessor * /*ModuleExpanderPP*/) {
PP->addPPCallbacks(std::make_unique<IfPreprocessorCallbacks>(*this, *PP));
}
diff --git a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
index 24d346bdfaa53..e073520508622 100644
--- a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
@@ -67,7 +67,7 @@ class NameLookup {
public:
explicit NameLookup(const NamedDecl *ND) : Data(ND, false) {}
- explicit NameLookup(std::nullopt_t) : Data(nullptr, true) {}
+ explicit NameLookup(std::nullopt_t /*unused*/) : Data(nullptr, true) {}
explicit NameLookup(std::nullptr_t) : Data(nullptr, false) {}
NameLookup() : NameLookup(nullptr) {}
diff --git a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
index 25601f9a01a48..55aa7babc29f9 100644
--- a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
@@ -288,8 +288,9 @@ UseRangesCheck::UseRangesCheck(StringRef Name, ClangTidyContext *Context)
utils::IncludeSorter::IS_LLVM),
areDiagsSelfContained()) {}
-void UseRangesCheck::registerPPCallbacks(const SourceManager &,
- Preprocessor *PP, Preprocessor *) {
+void UseRangesCheck::registerPPCallbacks(const SourceManager & /*SM*/,
+ Preprocessor *PP,
+ Preprocessor * /*ModuleExpanderPP*/) {
Inserter.registerPreprocessor(PP);
}
@@ -297,8 +298,8 @@ void UseRangesCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "IncludeStyle", Inserter.getStyle());
}
-std::optional<std::string>
-UseRangesCheck::Replacer::getHeaderInclusion(const NamedDecl &) const {
+std::optional<std::string> UseRangesCheck::Replacer::getHeaderInclusion(
+ const NamedDecl & /*unused*/) const {
return std::nullopt;
}
More information about the cfe-commits
mailing list