r364283 - [clangd] Narrow rename to local symbols.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 25 01:43:17 PDT 2019
Author: hokein
Date: Tue Jun 25 01:43:17 2019
New Revision: 364283
URL: http://llvm.org/viewvc/llvm-project?rev=364283&view=rev
Log:
[clangd] Narrow rename to local symbols.
Summary:
Previously, we performed rename for all kinds of symbols (local, global).
This patch narrows the scope by only renaming symbols not being used
outside of the main file (with index asisitance). Renaming global
symbols is not supported at the moment (return an error).
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63426
Modified:
cfe/trunk/include/clang/Tooling/Refactoring/Rename/RenamingAction.h
cfe/trunk/lib/Tooling/Refactoring/Rename/RenamingAction.cpp
Modified: cfe/trunk/include/clang/Tooling/Refactoring/Rename/RenamingAction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Refactoring/Rename/RenamingAction.h?rev=364283&r1=364282&r2=364283&view=diff
==============================================================================
--- cfe/trunk/include/clang/Tooling/Refactoring/Rename/RenamingAction.h (original)
+++ cfe/trunk/include/clang/Tooling/Refactoring/Rename/RenamingAction.h Tue Jun 25 01:43:17 2019
@@ -54,6 +54,8 @@ public:
static const RefactoringDescriptor &describe();
+ const NamedDecl *getRenameDecl() const;
+
private:
RenameOccurrences(const NamedDecl *ND, std::string NewName)
: ND(ND), NewName(std::move(NewName)) {}
Modified: cfe/trunk/lib/Tooling/Refactoring/Rename/RenamingAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Refactoring/Rename/RenamingAction.cpp?rev=364283&r1=364282&r2=364283&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/Refactoring/Rename/RenamingAction.cpp (original)
+++ cfe/trunk/lib/Tooling/Refactoring/Rename/RenamingAction.cpp Tue Jun 25 01:43:17 2019
@@ -74,6 +74,8 @@ RenameOccurrences::initiate(RefactoringR
std::move(NewName));
}
+const NamedDecl *RenameOccurrences::getRenameDecl() const { return ND; }
+
Expected<AtomicChanges>
RenameOccurrences::createSourceReplacements(RefactoringRuleContext &Context) {
Expected<SymbolOccurrences> Occurrences = findSymbolOccurrences(ND, Context);
More information about the cfe-commits
mailing list