[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".
This commit is contained in:
Haojian Wu 2020-03-11 16:07:44 +01:00
parent a2202f6a3f
commit d83ade4506
1 changed files with 3 additions and 3 deletions

View File

@ -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();