Skip to content

Commit

Permalink
[clangd] Improve the "max limit" error message in rename, NFC.
Browse files Browse the repository at this point in the history
previously, we emited "exceeds the max limit 49" which was weird, now we
emit "exceeds the max limit 50".
  • Loading branch information
hokein committed Mar 11, 2020
1 parent a2202f6 commit d83ade4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clang-tools-extra/clangd/refactor/Rename.cpp
Expand Up @@ -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;
Expand All @@ -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),
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit d83ade4

Please sign in to comment.