llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tools-extra

Author: Baranov Victor (vbvictor)

<details>
<summary>Changes</summary>



---

Patch is 46.97 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/167124.diff


21 Files Affected:

- (modified) clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp 
(+3-3) 
- (modified) clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp 
(+12-10) 
- (modified) 
clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp (+1-1) 
- (modified) 
clang-tools-extra/clang-tidy/readability/OperatorsRepresentationCheck.cpp 
(+8-8) 
- (modified) clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp 
(+21-19) 
- (modified) 
clang-tools-extra/clang-tidy/readability/RedundantAccessSpecifiersCheck.cpp 
(+1-1) 
- (modified) clang-tools-extra/clang-tidy/readability/RedundantCastingCheck.cpp 
(+2-2) 
- (modified) 
clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp (+5-4) 
- (modified) 
clang-tools-extra/clang-tidy/readability/RedundantDeclarationCheck.cpp (+1-1) 
- (modified) 
clang-tools-extra/clang-tidy/readability/RedundantInlineSpecifierCheck.cpp 
(+2-2) 
- (modified) 
clang-tools-extra/clang-tidy/readability/RedundantPreprocessorCheck.cpp (+3-3) 
- (modified) 
clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp (+5-3) 
- (modified) 
clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp (+2-2) 
- (modified) 
clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp (+4-4) 
- (modified) 
clang-tools-extra/clang-tidy/readability/ReferenceToConstructedTemporaryCheck.cpp
 (+1-1) 
- (modified) 
clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp (+26-25) 
- (modified) 
clang-tools-extra/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp
 (+2-2) 
- (modified) 
clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp 
(+26-26) 
- (modified) 
clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp (+1-1) 
- (modified) clang-tools-extra/clang-tidy/readability/UseAnyOfAllOfCheck.cpp 
(+1-1) 
- (modified) clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp 
(+5-5) 


``````````diff
diff --git a/clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp
index 7251d63edfd89..1283632a91bb1 100644
--- a/clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp
@@ -79,7 +79,7 @@ void NamedParameterCheck::check(const 
MatchFinder::MatchResult &Result) {
     // void foo(int /*unused*/)
     const char *Begin = SM.getCharacterData(Parm->getBeginLoc());
     const char *End = SM.getCharacterData(Parm->getLocation());
-    StringRef Data(Begin, End - Begin);
+    const StringRef Data(Begin, End - Begin);
     if (Data.contains("/*"))
       continue;
 
@@ -104,7 +104,7 @@ void NamedParameterCheck::check(const 
MatchFinder::MatchResult &Result) {
       if (M && M->size_overridden_methods() > 0) {
         const ParmVarDecl *OtherParm =
             (*M->begin_overridden_methods())->getParamDecl(P.second);
-        StringRef Name = OtherParm->getName();
+        const StringRef Name = OtherParm->getName();
         if (!Name.empty())
           NewName = Name;
       }
@@ -112,7 +112,7 @@ void NamedParameterCheck::check(const 
MatchFinder::MatchResult &Result) {
       // If the definition has a named parameter use that name.
       if (Definition) {
         const ParmVarDecl *DefParm = Definition->getParamDecl(P.second);
-        StringRef Name = DefParm->getName();
+        const StringRef Name = DefParm->getName();
         if (!Name.empty())
           NewName = Name;
       }
diff --git a/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp
index 744d23a6fdbcd..dffd7fdcc1beb 100644
--- a/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp
@@ -70,7 +70,7 @@ getNamespaceNameAsWritten(SourceLocation &Loc, const 
SourceManager &Sources,
       --Nesting;
     } else if (Nesting == 0) {
       if (T->is(tok::raw_identifier)) {
-        StringRef ID = T->getRawIdentifier();
+        const StringRef ID = T->getRawIdentifier();
         if (ID != "namespace")
           Result.append(std::string(ID));
         if (ID == "inline")
@@ -96,13 +96,13 @@ void NamespaceCommentCheck::check(const 
MatchFinder::MatchResult &Result) {
 
   // Don't require closing comments for namespaces spanning less than certain
   // number of lines.
-  unsigned StartLine = Sources.getSpellingLineNumber(ND->getBeginLoc());
-  unsigned EndLine = Sources.getSpellingLineNumber(ND->getRBraceLoc());
+  const unsigned StartLine = Sources.getSpellingLineNumber(ND->getBeginLoc());
+  const unsigned EndLine = Sources.getSpellingLineNumber(ND->getRBraceLoc());
   if (EndLine - StartLine + 1 <= ShortNamespaceLines)
     return;
 
   // Find next token after the namespace closing brace.
-  SourceLocation AfterRBrace = Lexer::getLocForEndOfToken(
+  const SourceLocation AfterRBrace = Lexer::getLocForEndOfToken(
       ND->getRBraceLoc(), /*Offset=*/0, Sources, getLangOpts());
   SourceLocation Loc = AfterRBrace;
   SourceLocation LBraceLoc = ND->getBeginLoc();
@@ -137,7 +137,8 @@ void NamespaceCommentCheck::check(const 
MatchFinder::MatchResult &Result) {
   if (!locationsInSameFile(Sources, ND->getRBraceLoc(), Loc))
     return;
 
-  bool NextTokenIsOnSameLine = Sources.getSpellingLineNumber(Loc) == EndLine;
+  const bool NextTokenIsOnSameLine =
+      Sources.getSpellingLineNumber(Loc) == EndLine;
   // If we insert a line comment before the token in the same line, we need
   // to insert a line break.
   bool NeedLineBreak = NextTokenIsOnSameLine && Tok.isNot(tok::eof);
@@ -148,11 +149,12 @@ void NamespaceCommentCheck::check(const 
MatchFinder::MatchResult &Result) {
 
   // Try to find existing namespace closing comment on the same line.
   if (Tok.is(tok::comment) && NextTokenIsOnSameLine) {
-    StringRef Comment(Sources.getCharacterData(Loc), Tok.getLength());
+    const StringRef Comment(Sources.getCharacterData(Loc), Tok.getLength());
     SmallVector<StringRef, 7> Groups;
     if (NamespaceCommentPattern.match(Comment, &Groups)) {
-      StringRef NamespaceNameInComment = Groups.size() > 5 ? Groups[5] : "";
-      StringRef Anonymous = Groups.size() > 3 ? Groups[3] : "";
+      const StringRef NamespaceNameInComment =
+          Groups.size() > 5 ? Groups[5] : "";
+      const StringRef Anonymous = Groups.size() > 3 ? Groups[3] : "";
 
       if ((ND->isAnonymousNamespace() && NamespaceNameInComment.empty()) ||
           (*NamespaceNameAsWritten == NamespaceNameInComment &&
@@ -186,7 +188,7 @@ void NamespaceCommentCheck::check(const 
MatchFinder::MatchResult &Result) {
     // multi-line or there may be other tokens behind it.
   }
 
-  std::string NamespaceNameForDiag =
+  const std::string NamespaceNameForDiag =
       ND->isAnonymousNamespace()
           ? "anonymous namespace"
           : ("namespace '" + *NamespaceNameAsWritten + "'");
@@ -203,7 +205,7 @@ void NamespaceCommentCheck::check(const 
MatchFinder::MatchResult &Result) {
     Fix.append("\n");
 
   // Place diagnostic at an old comment, or closing brace if we did not have 
it.
-  SourceLocation DiagLoc =
+  const SourceLocation DiagLoc =
       OldCommentRange.getBegin() != OldCommentRange.getEnd()
           ? OldCommentRange.getBegin()
           : ND->getRBraceLoc();
diff --git 
a/clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp
index 29fff3971599e..9fbe3badc864b 100644
--- a/clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp
@@ -155,7 +155,7 @@ void NonConstParameterCheck::diagnoseNonConstParameters() {
         dyn_cast_or_null<const FunctionDecl>(Par->getParentFunctionOrMethod());
     if (!Function)
       continue;
-    unsigned Index = Par->getFunctionScopeIndex();
+    const unsigned Index = Par->getFunctionScopeIndex();
     for (FunctionDecl *FnDecl : Function->redecls()) {
       if (FnDecl->getNumParams() <= Index)
         continue;
diff --git 
a/clang-tools-extra/clang-tidy/readability/OperatorsRepresentationCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/OperatorsRepresentationCheck.cpp
index 196fb31bd4b7a..4260e0fc41754 100644
--- a/clang-tools-extra/clang-tidy/readability/OperatorsRepresentationCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/OperatorsRepresentationCheck.cpp
@@ -23,7 +23,7 @@ static StringRef getOperatorSpelling(SourceLocation Loc, 
ASTContext &Context) {
   if (Loc.isInvalid())
     return {};
 
-  SourceManager &SM = Context.getSourceManager();
+  const SourceManager &SM = Context.getSourceManager();
 
   Loc = SM.getSpellingLoc(Loc);
   if (Loc.isInvalid())
@@ -41,7 +41,7 @@ AST_MATCHER_P2(BinaryOperator, 
hasInvalidBinaryOperatorRepresentation,
   if (Node.getOpcode() != Kind || ExpectedRepresentation.empty())
     return false;
 
-  StringRef Spelling =
+  const StringRef Spelling =
       getOperatorSpelling(Node.getOperatorLoc(), Finder->getASTContext());
   return !Spelling.empty() && Spelling != ExpectedRepresentation;
 }
@@ -52,7 +52,7 @@ AST_MATCHER_P2(UnaryOperator, 
hasInvalidUnaryOperatorRepresentation,
   if (Node.getOpcode() != Kind || ExpectedRepresentation.empty())
     return false;
 
-  StringRef Spelling =
+  const StringRef Spelling =
       getOperatorSpelling(Node.getOperatorLoc(), Finder->getASTContext());
   return !Spelling.empty() && Spelling != ExpectedRepresentation;
 }
@@ -63,7 +63,7 @@ AST_MATCHER_P2(CXXOperatorCallExpr, 
hasInvalidOverloadedOperatorRepresentation,
   if (Node.getOperator() != Kind || ExpectedRepresentation.empty())
     return false;
 
-  StringRef Spelling =
+  const StringRef Spelling =
       getOperatorSpelling(Node.getOperatorLoc(), Finder->getASTContext());
   return !Spelling.empty() && Spelling != ExpectedRepresentation;
 }
@@ -297,9 +297,9 @@ void OperatorsRepresentationCheck::check(
   if (TokenRange.isInvalid())
     return;
 
-  StringRef Spelling = Lexer::getSourceText(TokenRange, *Result.SourceManager,
-                                            Result.Context->getLangOpts());
-  StringRef TranslatedSpelling = translate(Spelling);
+  const StringRef Spelling = Lexer::getSourceText(
+      TokenRange, *Result.SourceManager, Result.Context->getLangOpts());
+  const StringRef TranslatedSpelling = translate(Spelling);
 
   if (TranslatedSpelling.empty())
     return;
@@ -312,7 +312,7 @@ void OperatorsRepresentationCheck::check(
     SourceRepresentation = "a traditional";
     TargetRepresentation = "an alternative";
 
-    StringRef SpellingEx = Lexer::getSourceText(
+    const StringRef SpellingEx = Lexer::getSourceText(
         CharSourceRange::getCharRange(
             TokenRange.getBegin().getLocWithOffset(-1),
             TokenRange.getBegin().getLocWithOffset(Spelling.size() + 1U)),
diff --git a/clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp
index 942a0a8a4469f..5e582f31f8ff7 100644
--- a/clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp
@@ -44,18 +44,18 @@ findQualToken(const VarDecl *Decl, Qualifier Qual,
   SourceLocation BeginLoc = Decl->getQualifierLoc().getBeginLoc();
   if (BeginLoc.isInvalid())
     BeginLoc = Decl->getBeginLoc();
-  SourceLocation EndLoc = Decl->getLocation();
+  const SourceLocation EndLoc = Decl->getLocation();
 
-  CharSourceRange FileRange = Lexer::makeFileCharRange(
+  const CharSourceRange FileRange = Lexer::makeFileCharRange(
       CharSourceRange::getCharRange(BeginLoc, EndLoc), *Result.SourceManager,
       Result.Context->getLangOpts());
 
   if (FileRange.isInvalid())
     return std::nullopt;
 
-  tok::TokenKind Tok = Qual == Qualifier::Const      ? tok::kw_const
-                       : Qual == Qualifier::Volatile ? tok::kw_volatile
-                                                     : tok::kw_restrict;
+  const tok::TokenKind Tok = Qual == Qualifier::Const      ? tok::kw_const
+                             : Qual == Qualifier::Volatile ? tok::kw_volatile
+                                                           : tok::kw_restrict;
 
   return utils::lexer::getQualifyingToken(Tok, FileRange, *Result.Context,
                                           *Result.SourceManager);
@@ -90,13 +90,13 @@ mergeReplacementRange(SourceRange &TypeSpecifier, const 
Token &ConstToken) {
 }
 
 static bool isPointerConst(QualType QType) {
-  QualType Pointee = QType->getPointeeType();
+  const QualType Pointee = QType->getPointeeType();
   assert(!Pointee.isNull() && "can't have a null Pointee");
   return Pointee.isConstQualified();
 }
 
 static bool isAutoPointerConst(QualType QType) {
-  QualType Pointee =
+  const QualType Pointee =
       cast<AutoType>(QType->getPointeeType().getTypePtr())->desugar();
   assert(!Pointee.isNull() && "can't have a null Pointee");
   return Pointee.isConstQualified();
@@ -146,7 +146,6 @@ void QualifiedAutoCheck::registerMatchers(MatchFinder 
*Finder) {
     return qualType(anyOf(qualType(pointerType(pointee(InnerMatchers...))),
                           
qualType(substTemplateTypeParmType(hasReplacementType(
                               pointerType(pointee(InnerMatchers...)))))));
-   
   };
 
   auto IsAutoDeducedToPointer =
@@ -223,33 +222,36 @@ void QualifiedAutoCheck::check(const 
MatchFinder::MatchResult &Result) {
     if (Var->getLocation() == TypeSpecifier.getEnd().getLocWithOffset(1))
       TypeSpecifier.setEnd(TypeSpecifier.getEnd().getLocWithOffset(1));
 
-    CharSourceRange FixItRange = CharSourceRange::getCharRange(TypeSpecifier);
+    const CharSourceRange FixItRange =
+        CharSourceRange::getCharRange(TypeSpecifier);
     if (FixItRange.isInvalid())
       return;
 
     SourceLocation FixitLoc = FixItRange.getBegin();
-    for (SourceRange &Range : RemoveQualifiersRange) {
+    for (const SourceRange &Range : RemoveQualifiersRange) {
       if (Range.getBegin() < FixitLoc)
         FixitLoc = Range.getBegin();
     }
 
-    std::string ReplStr = [&] {
-      llvm::StringRef PtrConst = isPointerConst(Var->getType()) ? "const " : 
"";
-      llvm::StringRef LocalConst = IsLocalConst ? "const " : "";
-      llvm::StringRef LocalVol = IsLocalVolatile ? "volatile " : "";
-      llvm::StringRef LocalRestrict = IsLocalRestrict ? "__restrict " : "";
+    const std::string ReplStr = [&] {
+      const llvm::StringRef PtrConst =
+          isPointerConst(Var->getType()) ? "const " : "";
+      const llvm::StringRef LocalConst = IsLocalConst ? "const " : "";
+      const llvm::StringRef LocalVol = IsLocalVolatile ? "volatile " : "";
+      const llvm::StringRef LocalRestrict =
+          IsLocalRestrict ? "__restrict " : "";
       return (PtrConst + "auto *" + LocalConst + LocalVol + LocalRestrict)
           .str();
     }();
 
-    DiagnosticBuilder Diag =
+    const DiagnosticBuilder Diag =
         diag(FixitLoc,
              "'%select{|const }0%select{|volatile }1%select{|__restrict }2auto 
"
              "%3' can be declared as '%4%3'")
         << IsLocalConst << IsLocalVolatile << IsLocalRestrict << Var->getName()
         << ReplStr;
 
-    for (SourceRange &Range : RemoveQualifiersRange) {
+    for (const SourceRange &Range : RemoveQualifiersRange) {
       Diag << FixItHint::CreateRemoval(CharSourceRange::getCharRange(Range));
     }
 
@@ -286,7 +288,7 @@ void QualifiedAutoCheck::check(const 
MatchFinder::MatchResult &Result) {
       if (TypeSpec->isInvalid() || TypeSpec->getBegin().isMacroID() ||
           TypeSpec->getEnd().isMacroID())
         return;
-      SourceLocation InsertPos = TypeSpec->getBegin();
+      const SourceLocation InsertPos = TypeSpec->getBegin();
       diag(InsertPos,
            "'auto *%select{|const }0%select{|volatile }1%2' can be declared as 
"
            "'const auto *%select{|const }0%select{|volatile }1%2'")
@@ -308,7 +310,7 @@ void QualifiedAutoCheck::check(const 
MatchFinder::MatchResult &Result) {
       if (TypeSpec->isInvalid() || TypeSpec->getBegin().isMacroID() ||
           TypeSpec->getEnd().isMacroID())
         return;
-      SourceLocation InsertPos = TypeSpec->getBegin();
+      const SourceLocation InsertPos = TypeSpec->getBegin();
       diag(InsertPos, "'auto &%0' can be declared as 'const auto &%0'")
           << Var->getName() << FixItHint::CreateInsertion(InsertPos, "const ");
     }
diff --git 
a/clang-tools-extra/clang-tidy/readability/RedundantAccessSpecifiersCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/RedundantAccessSpecifiersCheck.cpp
index e93aa16ebdb13..14580a6a26809 100644
--- 
a/clang-tools-extra/clang-tidy/readability/RedundantAccessSpecifiersCheck.cpp
+++ 
b/clang-tools-extra/clang-tidy/readability/RedundantAccessSpecifiersCheck.cpp
@@ -43,7 +43,7 @@ void RedundantAccessSpecifiersCheck::check(
       LastASDecl = ASDecl;
 
       if (CheckFirstDeclaration) {
-        AccessSpecifier DefaultSpecifier =
+        const AccessSpecifier DefaultSpecifier =
             MatchedDecl->isClass() ? AS_private : AS_public;
         if (ASDecl->getAccess() == DefaultSpecifier) {
           diag(ASDecl->getLocation(),
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantCastingCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/RedundantCastingCheck.cpp
index 1ee75220b1c4e..d11c41c33d2be 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantCastingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantCastingCheck.cpp
@@ -25,8 +25,8 @@ static bool areTypesEqual(QualType S, QualType D) {
   if (TS != TD)
     return false;
 
-  QualType PtrS = S->getPointeeType();
-  QualType PtrD = D->getPointeeType();
+  const QualType PtrS = S->getPointeeType();
+  const QualType PtrD = D->getPointeeType();
 
   if (!PtrS.isNull() && !PtrD.isNull())
     return areTypesEqual(PtrS, PtrD);
diff --git 
a/clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp
index b3b84e2cc0ccd..132b7ddc4311b 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp
@@ -50,7 +50,7 @@ void RedundantControlFlowCheck::check(const 
MatchFinder::MatchResult &Result) {
 
 void RedundantControlFlowCheck::checkRedundantReturn(
     const MatchFinder::MatchResult &Result, const CompoundStmt *Block) {
-  CompoundStmt::const_reverse_body_iterator Last = Block->body_rbegin();
+  const CompoundStmt::const_reverse_body_iterator Last = Block->body_rbegin();
   if (const auto *Return = dyn_cast<ReturnStmt>(*Last))
     issueDiagnostic(Result, Block, Return->getSourceRange(),
                     RedundantReturnDiag);
@@ -58,7 +58,7 @@ void RedundantControlFlowCheck::checkRedundantReturn(
 
 void RedundantControlFlowCheck::checkRedundantContinue(
     const MatchFinder::MatchResult &Result, const CompoundStmt *Block) {
-  CompoundStmt::const_reverse_body_iterator Last = Block->body_rbegin();
+  const CompoundStmt::const_reverse_body_iterator Last = Block->body_rbegin();
   if (const auto *Continue = dyn_cast<ContinueStmt>(*Last))
     issueDiagnostic(Result, Block, Continue->getSourceRange(),
                     RedundantContinueDiag);
@@ -67,11 +67,12 @@ void RedundantControlFlowCheck::checkRedundantContinue(
 void RedundantControlFlowCheck::issueDiagnostic(
     const MatchFinder::MatchResult &Result, const CompoundStmt *const Block,
     const SourceRange &StmtRange, const char *const Diag) {
-  SourceManager &SM = *Result.SourceManager;
+  const SourceManager &SM = *Result.SourceManager;
   if (isLocationInMacroExpansion(SM, StmtRange.getBegin()))
     return;
 
-  CompoundStmt::const_reverse_body_iterator Previous = ++Block->body_rbegin();
+  const CompoundStmt::const_reverse_body_iterator Previous =
+      ++Block->body_rbegin();
   SourceLocation Start;
   if (Previous != Block->body_rend())
     Start = Lexer::findLocationAfterToken(
diff --git 
a/clang-tools-extra/clang-tidy/readability/RedundantDeclarationCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/RedundantDeclarationCheck.cpp
index cf6e92d84e92a..0f12b8bcea6fb 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantDeclarationCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantDeclarationCheck.cpp
@@ -79,7 +79,7 @@ void RedundantDeclarationCheck::check(const 
MatchFinder::MatchResult &Result) {
     }
   }
 
-  SourceLocation EndLoc = Lexer::getLocForEndOfToken(
+  const SourceLocation EndLoc = Lexer::getLocForEndOfToken(
       D->getSourceRange().getEnd(), 0, SM, Result.Context->getLangOpts());
   {
     auto Diag = diag(D->getLocation(), "redundant %0 declaration") << D;
diff --git 
a/clang-tools-extra/clang-tidy/readability/RedundantInlineSpecifierCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/RedundantInlineSpecifierCheck.cpp
index 2053b89ada7e2..76adaa80207da 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantInlineSpecifierCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantInlineSpecifierCheck.cpp
@@ -52,7 +52,7 @@ AST_POLYMORPHIC_MATCHER_P(isInternalLinkage,
 static SourceLocation getInlineTokenLocation(SourceRange RangeLocation,
                                              const SourceManager &Sources,
                                              const LangOptions &LangOpts) {
-  SourceLocation Loc = RangeLocation.getBegin();
+  const SourceLocation Loc = RangeLocation.getBegin();
   if (Loc.isMacroID())
     return {};
 
@@ -106,7 +106,7 @@ template <typename T>
 void RedundantInlineSpecifierCheck::handleMatchedDecl(
     const T *MatchedDecl, const SourceManager &Sources,
     const MatchFinder::MatchResult &Result, StringRef Message) {
-  SourceLocation Loc = getInlineTokenLocation(
+  const SourceLocation Loc = getInlineTokenLocation(
       MatchedDecl->getSourceRange(), Sources, Result.Context->getLangOpts());
   if (Loc.isValid())
     diag(Loc, Message) << MatchedDecl << FixItHint::CreateRemoval(Loc);
diff --git 
a/clang-tools-extra/clang-tidy/readability/RedundantPreprocessorCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/RedundantPreprocessorCheck.cpp
index 931126a154d1e..4c503714346f8 100644
--- a/clang-tools-extra/clang...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/167124
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to