This is an archive of the discontinued LLVM Phabricator instance.

[rename] Don't overwrite the template argument when renaming a template function.
ClosedPublic

Authored by hokein on Oct 20 2017, 5:28 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein created this revision.Oct 20 2017, 5:28 AM
ioeric added inline comments.Oct 20 2017, 5:31 AM
lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
227 ↗(On Diff #119645)

I wonder what would happen if we have foo <int>()?

hokein added inline comments.Oct 20 2017, 6:02 AM
lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
227 ↗(On Diff #119645)

There will be a blank left like bar <int>(); if we don't format the apply replacement, but I don't think this case really matters because we often format the placements before applying them.

ioeric added inline comments.Oct 20 2017, 6:21 AM
lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
227 ↗(On Diff #119645)

Could you add a test for this? Thanks!

hokein updated this revision to Diff 119654.Oct 20 2017, 6:42 AM
hokein marked an inline comment as done.

Test for foo <int>().

lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
227 ↗(On Diff #119645)

Done, but note that our unittest will format the expected/actual code before doing verification.

ioeric accepted this revision.Oct 20 2017, 6:49 AM

lgtm

This revision is now accepted and ready to land.Oct 20 2017, 6:49 AM
cierpuchaw added inline comments.
unittests/Rename/RenameFunctionTest.cpp
232 ↗(On Diff #119654)

Shouldn't this be namespace nb {?

This revision was automatically updated to reflect the committed changes.
hokein added inline comments.Oct 23 2017, 2:03 AM
unittests/Rename/RenameFunctionTest.cpp
232 ↗(On Diff #119654)

It is intended. We don't change the namespace here, only the name of the definition will be changed.