diff options
author | Haojian Wu <hokein@google.com> | 2017-10-23 08:58:50 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2017-10-23 08:58:50 +0000 |
commit | 54e84b39669dbdae65cc2f4e33d032784bc41353 (patch) | |
tree | 65750b3516ec86ef8bf4fe36c952972a62484152 /clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp | |
parent | 487ab869422b1eb7be932eb70445d9d0541fdce1 (diff) | |
download | bcm5719-llvm-54e84b39669dbdae65cc2f4e33d032784bc41353.tar.gz bcm5719-llvm-54e84b39669dbdae65cc2f4e33d032784bc41353.zip |
[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
llvm-svn: 316314
Diffstat (limited to 'clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp')
-rw-r--r-- | clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp b/clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp index 265e3c2072c..38b2a624eae 100644 --- a/clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp +++ b/clang/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 |