diff options
| author | Miklos Vajna <vmiklos@vmiklos.hu> | 2016-06-21 19:48:57 +0000 |
|---|---|---|
| committer | Miklos Vajna <vmiklos@vmiklos.hu> | 2016-06-21 19:48:57 +0000 |
| commit | 47bd46395ad8496bd067d4e50f2ac5b196c09977 (patch) | |
| tree | 746587a1977e83130827afd8167d86ae41ed3131 /clang-tools-extra/clang-rename/tool/ClangRename.cpp | |
| parent | 48975881abde87dd8afc399678c00067044e09ce (diff) | |
| download | bcm5719-llvm-47bd46395ad8496bd067d4e50f2ac5b196c09977.tar.gz bcm5719-llvm-47bd46395ad8496bd067d4e50f2ac5b196c09977.zip | |
clang-rename: add a -old-name option
This is similar to -offset with the following differences:
1) -offset can refer to local variables as well.
2) -old-name makes it easier to refer to e.g. ClassName::MemberName by
spelling out the fully qualified name, instead of having to use e.g.
grep to look up the exact offset.
In other words, -offset is great when clang-rename is invoked by e.g. an
IDE, but not really user-friendly when the tool is invoked by the user
from commandline. That's the use case where -old-name is supposed to
improve the situation.
Reviewers: klimek
Differential Revision: http://reviews.llvm.org/D21517
llvm-svn: 273304
Diffstat (limited to 'clang-tools-extra/clang-rename/tool/ClangRename.cpp')
| -rw-r--r-- | clang-tools-extra/clang-rename/tool/ClangRename.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-rename/tool/ClangRename.cpp b/clang-tools-extra/clang-rename/tool/ClangRename.cpp index 92cc9063475..88c25da2f13 100644 --- a/clang-tools-extra/clang-rename/tool/ClangRename.cpp +++ b/clang-tools-extra/clang-rename/tool/ClangRename.cpp @@ -52,6 +52,11 @@ SymbolOffset( "offset", cl::desc("Locates the symbol by offset as opposed to <line>:<column>."), cl::cat(ClangRenameCategory)); +static cl::opt<std::string> +OldName( + "old-name", + cl::desc("The fully qualified name of the symbol, if -offset is not used."), + cl::cat(ClangRenameCategory)); static cl::opt<bool> Inplace( "i", @@ -96,7 +101,7 @@ int main(int argc, const char **argv) { // Get the USRs. auto Files = OP.getSourcePathList(); tooling::RefactoringTool Tool(OP.getCompilations(), Files); - rename::USRFindingAction USRAction(SymbolOffset); + rename::USRFindingAction USRAction(SymbolOffset, OldName); // Find the USRs. Tool.run(tooling::newFrontendActionFactory(&USRAction).get()); |

