diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp index cb14951..8b7019b 100644 --- a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp +++ b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp @@ -73,7 +73,7 @@ makeMatcherPair(StringRef State, const UseRangesCheck::Indexes &Indexes, const std::optional<UseRangesCheck::ReverseIteratorDescriptor> &ReverseDescriptor) { std::string ArgBound = (ArgName + llvm::Twine(Indexes.BeginArg)).str(); - SmallString<64> ID = {BoundCall, State}; + const SmallString<64> ID = {BoundCall, State}; ast_matchers::internal::Matcher<CallExpr> ArgumentMatcher = allOf( hasArgument(Indexes.BeginArg, makeExprMatcher(expr(unless(hasSideEffects())).bind(ArgBound), @@ -84,9 +84,9 @@ makeMatcherPair(StringRef State, const UseRangesCheck::Indexes &Indexes, {"end", "cend"}, EndFreeNames))); if (ReverseDescriptor) { ArgBound.push_back('R'); - SmallVector<StringRef> RBegin{ + const SmallVector<StringRef> RBegin{ llvm::make_first_range(ReverseDescriptor->FreeReverseNames)}; - SmallVector<StringRef> REnd{ + const SmallVector<StringRef> REnd{ llvm::make_second_range(ReverseDescriptor->FreeReverseNames)}; ArgumentMatcher = anyOf( ArgumentMatcher, @@ -110,9 +110,9 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) { auto Replaces = getReplacerMap(); ReverseDescriptor = getReverseDescriptor(); auto BeginEndNames = getFreeBeginEndMethods(); - llvm::SmallVector<StringRef, 4> BeginNames{ + const llvm::SmallVector<StringRef, 4> BeginNames{ llvm::make_first_range(BeginEndNames)}; - llvm::SmallVector<StringRef, 4> EndNames{ + const llvm::SmallVector<StringRef, 4> EndNames{ llvm::make_second_range(BeginEndNames)}; Replacers.clear(); llvm::DenseSet<Replacer *> SeenRepl; @@ -169,7 +169,7 @@ static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, llvm::SmallBitVector Commas(Call.getNumArgs()); // The first comma is actually the '(' which we can't remove Commas[0] = true; - for (unsigned Index : Sorted) { + for (const unsigned Index : Sorted) { const Expr *Arg = Call.getArg(Index); if (Commas[Index]) { if (Index >= Commas.size()) { @@ -192,7 +192,7 @@ static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, } void UseRangesCheck::check(const MatchFinder::MatchResult &Result) { - Replacer *Replacer = nullptr; + const Replacer *Replacer = nullptr; const FunctionDecl *Function = nullptr; for (const auto &[Node, Value] : Result.Nodes.getMap()) { StringRef NodeStr(Node); @@ -254,7 +254,7 @@ void UseRangesCheck::check(const MatchFinder::MatchResult &Result) { Diag << Inserter.createIncludeInsertion( Result.SourceManager->getFileID(Call->getBeginLoc()), *ReverseDescriptor->ReverseHeader); - StringRef ArgText = Lexer::getSourceText( + const StringRef ArgText = Lexer::getSourceText( CharSourceRange::getTokenRange(ArgExpr->getSourceRange()), Result.Context->getSourceManager(), Result.Context->getLangOpts()); SmallString<128> ReplaceText; |
