summaryrefslogtreecommitdiffstats
path: root/lib/Tooling/Refactoring
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2017-10-23 08:58:50 +0000
committerHaojian Wu <hokein@google.com>2017-10-23 08:58:50 +0000
commit4e7c0628623316fe522d2b2688d8c7d4a8047105 (patch)
tree18a3e635edf72365b837fd34736b2607189dfe14 /lib/Tooling/Refactoring
parentef34bcb258ffbf7a500bb715edced98fe6348676 (diff)
[rename] Don't overwrite the template argument when renaming a template function.
Reviewers: ioeric Reviewed By: ioeric Subscribers: cierpuchaw, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D39120 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Tooling/Refactoring')
-rw-r--r--lib/Tooling/Refactoring/Rename/USRLocFinder.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp b/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
index 265e3c2072..38b2a624ea 100644
--- a/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
+++ b/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
@@ -221,7 +221,12 @@ public:
}
auto StartLoc = Expr->getLocStart();
- auto EndLoc = Expr->getLocEnd();
+ // For template function call expressions like `foo<int>()`, we want to
+ // restrict the end of location to just before the `<` character.
+ SourceLocation EndLoc = Expr->hasExplicitTemplateArgs()
+ ? Expr->getLAngleLoc().getLocWithOffset(-1)
+ : Expr->getLocEnd();
+
// In case of renaming an enum declaration, we have to explicitly handle
// unscoped enum constants referenced in expressions (e.g.
// "auto r = ns1::ns2::Green" where Green is an enum constant of an unscoped