[clang-tools-extra] d83ade4 - [clangd] Improve the "max limit" error message in rename, NFC.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 11 08:13:57 PDT 2020
Author: Haojian Wu
Date: 2020-03-11T16:13:46+01:00
New Revision: d83ade4506089329217918439042b68093e8d6e4
URL: https://github.com/llvm/llvm-project/commit/d83ade4506089329217918439042b68093e8d6e4
DIFF: https://github.com/llvm/llvm-project/commit/d83ade4506089329217918439042b68093e8d6e4.diff
LOG: [clangd] Improve the "max limit" error message in rename, NFC.
previously, we emited "exceeds the max limit 49" which was weird, now we
emit "exceeds the max limit 50".
Added:
Modified:
clang-tools-extra/clangd/refactor/Rename.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp
index 54112e09f0f9..91620920c6ac 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -308,7 +308,7 @@ findOccurrencesOutsideFile(const NamedDecl &RenameDecl,
// Absolute file path => rename occurrences in that file.
llvm::StringMap<std::vector<Range>> AffectedFiles;
bool HasMore = Index.refs(RQuest, [&](const Ref &R) {
- if (AffectedFiles.size() > MaxLimitFiles)
+ if (AffectedFiles.size() >= MaxLimitFiles)
return;
if ((R.Kind & RefKind::Spelled) == RefKind::Unknown)
return;
@@ -318,7 +318,7 @@ findOccurrencesOutsideFile(const NamedDecl &RenameDecl,
}
});
- if (AffectedFiles.size() > MaxLimitFiles)
+ if (AffectedFiles.size() >= MaxLimitFiles)
return llvm::make_error<llvm::StringError>(
llvm::formatv("The number of affected files exceeds the max limit {0}",
MaxLimitFiles),
@@ -521,7 +521,7 @@ llvm::Expected<FileEdits> rename(const RenameInputs &RInputs) {
auto OtherFilesEdits = renameOutsideFile(
RenameDecl, RInputs.MainFilePath, RInputs.NewName, *RInputs.Index,
Opts.LimitFiles == 0 ? std::numeric_limits<size_t>::max()
- : Opts.LimitFiles - 1,
+ : Opts.LimitFiles,
GetFileContent);
if (!OtherFilesEdits)
return OtherFilesEdits.takeError();
More information about the cfe-commits
mailing list