-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang-tidy][NFC] Fix misc-const-correctness warnings (5/N) #167047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+65
−62
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
|
@llvm/pr-subscribers-clang-tidy @llvm/pr-subscribers-clang-tools-extra Author: Baranov Victor (vbvictor) ChangesPatch is 27.78 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/167047.diff 21 Files Affected:
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp
index 2545548df4f45..93b5b96926865 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp
@@ -37,7 +37,7 @@ void InitVariablesCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
}
void InitVariablesCheck::registerMatchers(MatchFinder *Finder) {
- std::string BadDecl = "badDecl";
+ const std::string BadDecl = "badDecl";
Finder->addMatcher(
varDecl(unless(hasInitializer(anything())), unless(isInstantiated()),
isLocalVarDecl(), unless(isStaticLocal()), isDefinition(),
@@ -82,7 +82,7 @@ void InitVariablesCheck::check(const MatchFinder::MatchResult &Result) {
if (MatchedDecl->getEndLoc().isMacroID())
return;
- QualType TypePtr = MatchedDecl->getType();
+ const QualType TypePtr = MatchedDecl->getType();
std::optional<const char *> InitializationString;
bool AddMathInclude = false;
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp
index 0836a5c386dd8..b301a2bd848ac 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp
@@ -47,7 +47,7 @@ class MacroUsageCallbacks : public PPCallbacks {
SM.isWrittenInCommandLineFile(MD->getLocation()))
return;
- StringRef MacroName = MacroNameTok.getIdentifierInfo()->getName();
+ const StringRef MacroName = MacroNameTok.getIdentifierInfo()->getName();
if (MacroName == "__GCC_HAVE_DWARF2_CFI_ASM")
return;
if (!CheckCapsOnly && !RegExp.match(MacroName))
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/MisleadingCaptureDefaultByValueCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/MisleadingCaptureDefaultByValueCheck.cpp
index 57d98ee1fd8b4..366bd1296bf9d 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/MisleadingCaptureDefaultByValueCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/MisleadingCaptureDefaultByValueCheck.cpp
@@ -81,7 +81,7 @@ void MisleadingCaptureDefaultByValueCheck::check(
return;
if (Lambda->getCaptureDefault() == LCD_ByCopy) {
- bool IsThisImplicitlyCaptured = std::any_of(
+ const bool IsThisImplicitlyCaptured = std::any_of(
Lambda->implicit_capture_begin(), Lambda->implicit_capture_end(),
[](const LambdaCapture &Capture) { return Capture.capturesThis(); });
auto Diag = diag(Lambda->getCaptureDefaultLoc(),
@@ -89,8 +89,8 @@ void MisleadingCaptureDefaultByValueCheck::check(
"should not specify a by-value capture default")
<< IsThisImplicitlyCaptured;
- std::string ReplacementText = createReplacementText(Lambda);
- SourceLocation DefaultCaptureEnd =
+ const std::string ReplacementText = createReplacementText(Lambda);
+ const SourceLocation DefaultCaptureEnd =
findDefaultCaptureEnd(Lambda, *Result.Context);
Diag << FixItHint::CreateReplacement(
CharSourceRange::getCharRange(Lambda->getCaptureDefaultLoc(),
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/MissingStdForwardCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/MissingStdForwardCheck.cpp
index 090ab2f0474c4..d1d81d510c8fb 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/MissingStdForwardCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/MissingStdForwardCheck.cpp
@@ -26,11 +26,12 @@ AST_MATCHER_P(QualType, possiblyPackExpansionOf,
}
AST_MATCHER(ParmVarDecl, isTemplateTypeParameter) {
- ast_matchers::internal::Matcher<QualType> Inner = possiblyPackExpansionOf(
- qualType(rValueReferenceType(),
- references(templateTypeParmType(
- hasDeclaration(templateTypeParmDecl()))),
- unless(references(qualType(isConstQualified())))));
+ const ast_matchers::internal::Matcher<QualType> Inner =
+ possiblyPackExpansionOf(
+ qualType(rValueReferenceType(),
+ references(templateTypeParmType(
+ hasDeclaration(templateTypeParmDecl()))),
+ unless(references(qualType(isConstQualified())))));
if (!Inner.matches(Node.getType(), Finder, Builder))
return false;
@@ -43,7 +44,7 @@ AST_MATCHER(ParmVarDecl, isTemplateTypeParameter) {
if (!FuncTemplate)
return false;
- QualType ParamType =
+ const QualType ParamType =
Node.getType().getNonPackExpansionType()->getPointeeType();
const auto *TemplateType = ParamType->getAsCanonical<TemplateTypeParmType>();
if (!TemplateType)
@@ -54,10 +55,10 @@ AST_MATCHER(ParmVarDecl, isTemplateTypeParameter) {
}
AST_MATCHER_P(NamedDecl, hasSameNameAsBoundNode, std::string, BindingID) {
- IdentifierInfo *II = Node.getIdentifier();
+ const IdentifierInfo *II = Node.getIdentifier();
if (nullptr == II)
return false;
- StringRef Name = II->getName();
+ const StringRef Name = II->getName();
return Builder->removeBindings(
[this, Name](const ast_matchers::internal::BoundNodesMap &Nodes) {
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/NoSuspendWithLockCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/NoSuspendWithLockCheck.cpp
index 43df277927d8b..8ecbccda3c5f2 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/NoSuspendWithLockCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/NoSuspendWithLockCheck.cpp
@@ -27,7 +27,7 @@ void NoSuspendWithLockCheck::registerMatchers(MatchFinder *Finder) {
hasDeclaration(namedDecl(matchers::matchesAnyListedName(
utils::options::parseStringList(LockGuards)))));
- StatementMatcher Lock =
+ const StatementMatcher Lock =
declStmt(has(varDecl(hasType(LockType)).bind("lock-decl")))
.bind("lock-decl-stmt");
Finder->addMatcher(
@@ -55,12 +55,12 @@ void NoSuspendWithLockCheck::check(const MatchFinder::MatchResult &Result) {
Options.AddImplicitDtors = true;
Options.AddTemporaryDtors = true;
- std::unique_ptr<CFG> TheCFG = CFG::buildCFG(
+ const std::unique_ptr<CFG> TheCFG = CFG::buildCFG(
nullptr, const_cast<clang::CompoundStmt *>(Block), &Context, Options);
if (!TheCFG)
return;
- utils::ExprSequence Sequence(TheCFG.get(), Block, &Context);
+ const utils::ExprSequence Sequence(TheCFG.get(), Block, &Context);
const Stmt *LastBlockStmt = Block->body_back();
if (Sequence.inSequence(LockStmt, Suspend) &&
(Suspend == LastBlockStmt ||
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp
index 9913671c6f74e..51a1468f49813 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp
@@ -164,12 +164,12 @@ void PreferMemberInitializerCheck::check(
llvm::DenseMap<const FieldDecl *, AssignedLevel> AssignedFields{};
for (const CXXCtorInitializer *Init : Ctor->inits())
- if (FieldDecl *Field = Init->getMember())
+ if (const FieldDecl *Field = Init->getMember())
updateAssignmentLevel(Field, Init->getInit(), Ctor, AssignedFields);
for (const Stmt *S : Body->body()) {
if (S->getBeginLoc().isMacroID()) {
- StringRef MacroName = Lexer::getImmediateMacroName(
+ const StringRef MacroName = Lexer::getImmediateMacroName(
S->getBeginLoc(), *Result.SourceManager, getLangOpts());
if (MacroName.contains_insensitive("assert"))
return;
@@ -206,7 +206,7 @@ void PreferMemberInitializerCheck::check(
bool AddComma = false;
bool AddBrace = false;
bool InvalidFix = false;
- unsigned Index = Field->getFieldIndex();
+ const unsigned Index = Field->getFieldIndex();
const CXXCtorInitializer *LastInListInit = nullptr;
for (const CXXCtorInitializer *Init : Ctor->inits()) {
if (!Init->isWritten() || Init->isInClassMemberInitializer())
@@ -276,7 +276,7 @@ void PreferMemberInitializerCheck::check(
<< Field;
if (InvalidFix)
continue;
- StringRef NewInit = Lexer::getSourceText(
+ const StringRef NewInit = Lexer::getSourceText(
Result.SourceManager->getExpansionRange(InitValue->getSourceRange()),
*Result.SourceManager, getLangOpts());
if (HasInitAlready) {
@@ -288,8 +288,8 @@ void PreferMemberInitializerCheck::check(
else
Diag << FixItHint::CreateReplacement(ReplaceRange, NewInit);
} else {
- SmallString<128> Insertion({InsertPrefix, Field->getName(), "(", NewInit,
- AddComma ? "), " : ")"});
+ const SmallString<128> Insertion({InsertPrefix, Field->getName(), "(",
+ NewInit, AddComma ? "), " : ")"});
Diag << FixItHint::CreateInsertion(InsertPos, Insertion,
FirstToCtorInits);
FirstToCtorInits = areDiagsSelfContained();
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
index f3237f4d7dae0..d0f86526d1a29 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
@@ -35,7 +35,7 @@ AST_MATCHER_P(Expr, hasParentIgnoringImpCasts,
ast_matchers::internal::Matcher<Expr>, InnerMatcher) {
const Expr *E = &Node;
do {
- DynTypedNodeList Parents = Finder->getASTContext().getParents(*E);
+ const DynTypedNodeList Parents = Finder->getASTContext().getParents(*E);
if (Parents.size() != 1)
return false;
E = Parents[0].get<Expr>();
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
index 634ec186616d5..82fc9f253ac1c 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
@@ -78,7 +78,7 @@ void ProBoundsConstantArrayIndexCheck::check(
else
BaseRange =
cast<CXXOperatorCallExpr>(Matched)->getArg(0)->getSourceRange();
- SourceRange IndexRange = IndexExpr->getSourceRange();
+ const SourceRange IndexRange = IndexExpr->getSourceRange();
auto Diag = diag(Matched->getExprLoc(),
"do not use array subscript when the index is "
@@ -115,7 +115,7 @@ void ProBoundsConstantArrayIndexCheck::check(
const auto &SizeArg = TemplateArgs[1];
if (SizeArg.getKind() != TemplateArgument::Integral)
return;
- llvm::APInt ArraySize = SizeArg.getAsIntegral();
+ const llvm::APInt ArraySize = SizeArg.getAsIntegral();
// Get uint64_t values, because different bitwidths would lead to an assertion
// in APInt::uge.
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp
index b9867c2393f0b..fcd9c6d37d99f 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp
@@ -45,7 +45,7 @@ void ProTypeCstyleCastCheck::check(const MatchFinder::MatchResult &Result) {
return;
}
- QualType SourceType = MatchedCast->getSubExpr()->getType();
+ const QualType SourceType = MatchedCast->getSubExpr()->getType();
if (MatchedCast->getCastKind() == CK_BaseToDerived) {
const auto *SourceDecl = SourceType->getPointeeCXXRecordDecl();
@@ -58,7 +58,7 @@ void ProTypeCstyleCastCheck::check(const MatchFinder::MatchResult &Result) {
// Leave type spelling exactly as it was (unlike
// getTypeAsWritten().getAsString() which would spell enum types 'enum
// X').
- StringRef DestTypeString = Lexer::getSourceText(
+ const StringRef DestTypeString = Lexer::getSourceText(
CharSourceRange::getTokenRange(
MatchedCast->getLParenLoc().getLocWithOffset(1),
MatchedCast->getRParenLoc().getLocWithOffset(-1)),
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
index 1ac9b8bbdfedb..111c62153fe79 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -173,7 +173,7 @@ struct InitializerInsertion {
assert(!Initializers.empty() && "No initializers to insert");
std::string Code;
llvm::raw_string_ostream Stream(Code);
- std::string Joined =
+ const std::string Joined =
llvm::join(Initializers.begin(), Initializers.end(), "(), ");
switch (Placement) {
case InitializerPlacement::New:
@@ -434,7 +434,7 @@ static llvm::StringLiteral getInitializer(QualType QT, bool UseAssignment) {
void ProTypeMemberInitCheck::checkMissingMemberInitializer(
ASTContext &Context, const CXXRecordDecl &ClassDecl,
const CXXConstructorDecl *Ctor) {
- bool IsUnion = ClassDecl.isUnion();
+ const bool IsUnion = ClassDecl.isUnion();
if (IsUnion && ClassDecl.hasInClassInitializer())
return;
@@ -583,7 +583,7 @@ void ProTypeMemberInitCheck::checkMissingBaseClassInitializer(
void ProTypeMemberInitCheck::checkUninitializedTrivialType(
const ASTContext &Context, const VarDecl *Var) {
- DiagnosticBuilder Diag =
+ const DiagnosticBuilder Diag =
diag(Var->getBeginLoc(), "uninitialized record type: %0") << Var;
Diag << FixItHint::CreateInsertion(
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp
index c200a79cb8c49..e7b92fcf801c1 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp
@@ -33,7 +33,7 @@ void ProTypeStaticCastDowncastCheck::check(
const MatchFinder::MatchResult &Result) {
const auto *MatchedCast = Result.Nodes.getNodeAs<CXXStaticCastExpr>("cast");
- QualType SourceType = MatchedCast->getSubExpr()->getType();
+ const QualType SourceType = MatchedCast->getSubExpr()->getType();
const auto *SourceDecl = SourceType->getPointeeCXXRecordDecl();
if (!SourceDecl) // The cast is from object to reference
SourceDecl = SourceType->getAsCXXRecordDecl();
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp
index 431b2a76feeea..c223ed1565d90 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp
@@ -65,9 +65,9 @@ static constexpr StringRef VaArgWarningMessage =
namespace {
AST_MATCHER(QualType, isVAList) {
- ASTContext &Context = Finder->getASTContext();
- QualType Desugar = Node.getDesugaredType(Context);
- QualType NodeTy = Node.getUnqualifiedType();
+ const ASTContext &Context = Finder->getASTContext();
+ const QualType Desugar = Node.getDesugaredType(Context);
+ const QualType NodeTy = Node.getUnqualifiedType();
auto CheckVaList = [](QualType NodeTy, QualType Expected,
const ASTContext &Context) {
@@ -88,7 +88,8 @@ AST_MATCHER(QualType, isVAList) {
// type. Some targets implements va_list as 'char *' or 'void *'.
// In these cases we need to remove all typedefs one by one to check this.
using BuiltinVaListKind = TargetInfo::BuiltinVaListKind;
- BuiltinVaListKind VaListKind = Context.getTargetInfo().getBuiltinVaListKind();
+ const BuiltinVaListKind VaListKind =
+ Context.getTargetInfo().getBuiltinVaListKind();
if (VaListKind == BuiltinVaListKind::CharPtrBuiltinVaList ||
VaListKind == BuiltinVaListKind::VoidPtrBuiltinVaList) {
if (CheckVaList(NodeTy, Context.getBuiltinVaListType(), Context))
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/RvalueReferenceParamNotMovedCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/RvalueReferenceParamNotMovedCheck.cpp
index c40ac7ab5102b..28bfe57622398 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/RvalueReferenceParamNotMovedCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/RvalueReferenceParamNotMovedCheck.cpp
@@ -39,7 +39,7 @@ AST_MATCHER_P2(Stmt, argumentOf, bool, AllowPartialMove, StatementMatcher,
void RvalueReferenceParamNotMovedCheck::registerMatchers(MatchFinder *Finder) {
auto ToParam = hasAnyParameter(parmVarDecl(equalsBoundNode("param")));
- StatementMatcher MoveCallMatcher =
+ const StatementMatcher MoveCallMatcher =
callExpr(
argumentCountIs(1),
anyOf(callee(functionDecl(hasName(MoveFunction))),
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
index b38a0c66eb582..77a7b2b25aecb 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
@@ -109,7 +109,7 @@ join(ArrayRef<SpecialMemberFunctionsCheck::SpecialMemberFunctionKind> SMFS,
llvm::raw_string_ostream Stream(Buffer);
Stream << toString(SMFS[0]);
- size_t LastIndex = SMFS.size() - 1;
+ const size_t LastIndex = SMFS.size() - 1;
for (size_t I = 1; I < LastIndex; ++I) {
Stream << ", " << toString(SMFS[I]);
}
@@ -146,7 +146,7 @@ void SpecialMemberFunctionsCheck::check(
StoreMember({DestructorType, Dtor->isDeleted()});
}
- std::initializer_list<std::pair<std::string, SpecialMemberFunctionKind>>
+ const std::initializer_list<std::pair<std::string, SpecialMemberFunctionKind>>
Matchers = {{"copy-ctor", SpecialMemberFunctionKind::CopyConstructor},
{"copy-assign", SpecialMemberFunctionKind::CopyAssignment},
{"move-ctor", SpecialMemberFunctionKind::MoveConstructor},
@@ -202,7 +202,7 @@ void SpecialMemberFunctionsCheck::checkForMissingMembers(
MissingMembers.push_back(Kind2);
};
- bool RequireThree =
+ const bool RequireThree =
HasMember(SpecialMemberFunctionKind::NonDefaultDestructor) ||
(!AllowSoleDefaultDtor &&
(HasMember(SpecialMemberFunctionKind::Destructor) ||
@@ -212,10 +212,11 @@ void SpecialMemberFunctionsCheck::checkForMissingMembers(
HasMember(SpecialMemberFunctionKind::MoveConstructor) ||
HasMember(SpecialMemberFunctionKind::MoveAssignment);
- bool RequireFive = (!AllowMissingMoveFunctions && RequireThree &&
- getLangOpts().CPlusPlus11) ||
- HasMember(SpecialMemberFunctionKind::MoveConstructor) ||
- HasMember(SpecialMemberFunctionKind::MoveAssignment);
+ const bool RequireFive =
+ (!AllowMissingMoveFunctions && RequireThree &&
+ getLangOpts().CPlusPlus11) ||
+ HasMember(SpecialMemberFunctionKind::MoveConstructor) ||
+ HasMember(SpecialMemberFunctionKind::MoveAssignment);
if (RequireThree) {
if (!HasMember(SpecialMemberFunctionKind::Destructor) &&
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
index 3e83f0b19c51e..1d41b578c77ae 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
@@ -97,7 +97,7 @@ struct DenseMapInfo<
assert(Val != getEmptyKey() && "Cannot hash the empty key!");
assert(Val != getTombstoneKey() && "Cannot hash the tombstone key!");
- std::hash<ClassDefId::second_type> SecondHash;
+ const std::hash<ClassDefId::second_type> SecondHash;
return Val.first.get...
[truncated]
|
EugeneZelenko
approved these changes
Nov 7, 2025
vinay-deshmukh
pushed a commit
to vinay-deshmukh/llvm-project
that referenced
this pull request
Nov 8, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.