diff options
author | Kirill Bobyrev <omtcyfz@gmail.com> | 2016-07-22 13:41:09 +0000 |
---|---|---|
committer | Kirill Bobyrev <omtcyfz@gmail.com> | 2016-07-22 13:41:09 +0000 |
commit | a3432fa91cd547fb4b23dc65198993c5161dfd32 (patch) | |
tree | c78c3b986ac9e5945646b34bcfc244ab5a698825 /clang-tools-extra/test/clang-rename/TemplateFunctionFindByDeclaration.cpp | |
parent | bd7aa358f0222841e46d3555725f6ab3ef46c0ce (diff) | |
download | bcm5719-llvm-a3432fa91cd547fb4b23dc65198993c5161dfd32.tar.gz bcm5719-llvm-a3432fa91cd547fb4b23dc65198993c5161dfd32.zip |
[clang-rename] introduce better symbol finding
This patch introduces:
* TypeLoc visiting, which helps a lot in renaming types
* NestedNameSpecifierLoc visiting (through getting them via ASTMatcher at the moment, though, because RecursiveASTVisitor<T>::VisitNestedNameSpecifierLoc isn't implemented), which helps to treat nested names correctly
* better code formatting and refactoring
* bunch of tests
Reviewers: alexfh
Differential revision: https://reviews.llvm.org/D22465
llvm-svn: 276414
Diffstat (limited to 'clang-tools-extra/test/clang-rename/TemplateFunctionFindByDeclaration.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-rename/TemplateFunctionFindByDeclaration.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-rename/TemplateFunctionFindByDeclaration.cpp b/clang-tools-extra/test/clang-rename/TemplateFunctionFindByDeclaration.cpp new file mode 100644 index 00000000000..b79dba4cffc --- /dev/null +++ b/clang-tools-extra/test/clang-rename/TemplateFunctionFindByDeclaration.cpp @@ -0,0 +1,20 @@ +// RUN: cat %s > %t.cpp +// RUN: clang-rename -offset=241 -new-name=bar %t.cpp -i -- +// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s + +// FIXME: clang-rename should be able to rename functions with templates. +// XFAIL: * + +template <typename T> +T foo(T value) { // CHECK: T boo(T value) { + return value; +} + +int main() { + foo<bool>(false); // CHECK: bar<bool>(false); + foo<int>(0); // CHECK: bar<int>(0); + return 0; +} + +// Use grep -FUbo 'foo' <file> to get the correct offset of foo when changing +// this file. |