From a3432fa91cd547fb4b23dc65198993c5161dfd32 Mon Sep 17 00:00:00 2001 From: Kirill Bobyrev Date: Fri, 22 Jul 2016 13:41:09 +0000 Subject: [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::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 --- .../TemplateFunctionFindByDeclaration.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 clang-tools-extra/test/clang-rename/TemplateFunctionFindByDeclaration.cpp (limited to 'clang-tools-extra/test/clang-rename/TemplateFunctionFindByDeclaration.cpp') 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 +T foo(T value) { // CHECK: T boo(T value) { + return value; +} + +int main() { + foo(false); // CHECK: bar(false); + foo(0); // CHECK: bar(0); + return 0; +} + +// Use grep -FUbo 'foo' to get the correct offset of foo when changing +// this file. -- cgit v1.2.3