[PATCH] D73450: [clangd] Add a symbol-name-based blacklist for rename.
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 27 07:25:43 PST 2020
kadircet added inline comments.
================
Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:466
auto DeclsUnderCursor = locateDeclAt(AST, IdentifierToken->location());
if (DeclsUnderCursor.empty())
----------------
hokein wrote:
> kadircet wrote:
> > `locateDeclAt` is already working on `NamedDecl`s but returning a set of `Decl`s could you rather update that helper to return a set of `NamedDecl`s instead?
> I think the main problem is that `NamedDecl->getCanonicalDecl()` returns a `Decl*`, which we need to do a `dyn_cast`.
ah right, but still it should be safe to perform just an `llvm:cast` here, as a `NamedDecl` shouldn't have an `unnamed` decl as its canonical declaration.
================
Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:148
+ RenameDecl, RenameDecl.getASTContext(), SymbolCollector::Options(),
+ IsMainFileOnly)) // If the symbol is not indexable, we disallow rename.
return ReasonToReject::NonIndexable;
----------------
maybe move comment to be above if statement, and clang-format
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73450/new/
https://reviews.llvm.org/D73450
More information about the cfe-commits
mailing list