This is an archive of the discontinued LLVM Phabricator instance.

[change-namespace] Fixed a bug in getShortestQualifiedNameInNamespace.
ClosedPublic

Authored by ioeric on Sep 29 2016, 9:23 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

ioeric updated this revision to Diff 72972.Sep 29 2016, 9:23 PM
ioeric retitled this revision from to [change-namespace] Fixed a bug in getShortestQualifiedNameInNamespace..
ioeric updated this object.
ioeric added a reviewer: hokein.
ioeric added a subscriber: cfe-commits.
ioeric updated this revision to Diff 73116.Sep 30 2016, 12:31 PM
  • Remove redundant variable.
ioeric updated this object.Sep 30 2016, 12:31 PM
hokein added inline comments.Oct 4 2016, 4:53 AM
change-namespace/ChangeNamespace.cpp
176 ↗(On Diff #73116)

Mightbe add a small doc saying NsName is a global namespace if it is empty. (If I misunderstand the code).

187 ↗(On Diff #73116)

I think the statement doesn't compile here, since consume_front return a bool. It should be if (DeclName.consume_front((NsName + "::")))?

Looks like we can also put this judge into the above while statement?

ioeric updated this revision to Diff 73459.Oct 4 2016, 5:21 AM
ioeric marked 2 inline comments as done.
  • Address review comments.
change-namespace/ChangeNamespace.cpp
187 ↗(On Diff #73116)

Note that str() is called on (NsName + "::") instead of consume_front. But you are right, we can put the check into the while loop.

hokein accepted this revision.Oct 4 2016, 5:38 AM
hokein edited edge metadata.

LGTM.

change-namespace/ChangeNamespace.cpp
187 ↗(On Diff #73116)

Oh, I see. Sorry for misreading the code.

This revision is now accepted and ready to land.Oct 4 2016, 5:38 AM
This revision was automatically updated to reflect the committed changes.