[PATCH] D72071: [clangd] Add correctness checks for index-based rename
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 2 03:39:09 PST 2020
kadircet added inline comments.
================
Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:378
+ buildRenameEdit(FilePath, *AffectedFileCode, *RenameRanges, NewName,
+ RenameDecl.getNameAsString());
if (!RenameEdit) {
----------------
nit: move both this and invocation above(line 363) out of the loop into a `std::string OldName`
================
Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:565
+ // cases where the might be incorrectly captured tokens.
+ if (*EndOffset > *StartOffset &&
+ InitialCode.slice(*StartOffset, *EndOffset) == OldName)
----------------
maybe I am missing it but, it is unclear whether start to end is half-open/closed intervals.
could you add a test case with a single character identifier(you might want to accept equality, if this is a closed interval) and add some comments to the `OccurrencesOffsets`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72071/new/
https://reviews.llvm.org/D72071
More information about the cfe-commits
mailing list