This is an archive of the discontinued LLVM Phabricator instance.

[change-namespace] get newlines around moved namespace right.
ClosedPublic

Authored by ioeric on Jan 4 2017, 2:11 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ioeric updated this revision to Diff 83023.Jan 4 2017, 2:11 AM
ioeric retitled this revision from to [change-namespace] get whitespaces right when moving old namespaces..
ioeric updated this object.
ioeric added a reviewer: hokein.
ioeric added a subscriber: cfe-commits.
alexander-shaposhnikov added inline comments.
change-namespace/ChangeNamespace.cpp
563 ↗(On Diff #83023)

maybe i am missing smth, to be honest i somehow think this code is "hacky" / looks like a "workaround", so don't like the idea of creating a replacement only for extracting the offset / filepath.
I would prefer to refactor this (+ SourceManager ?) to get rid of these hacks (they create extra "tech debt" plus decrease the readability)

ioeric updated this revision to Diff 83024.Jan 4 2017, 3:16 AM
ioeric marked an inline comment as done.
  • Get rid of hacky replacement.
change-namespace/ChangeNamespace.cpp
563 ↗(On Diff #83023)

You are right; I was being lazy... remove the hack ;-)

ioeric removed a reviewer: djasper.Jan 4 2017, 3:17 AM
hokein accepted this revision.Jan 4 2017, 6:53 AM
hokein edited edge metadata.

LGTM with some nits.

Would be clearer to elaborate more descriptions in the commit message. Looks like the patch actually resolves newline character "\n" rather than whitespace...

change-namespace/ChangeNamespace.cpp
568 ↗(On Diff #83024)

Maybe use MoveNs.Offset instead of recalling SM.getFileOffset(Start);

This revision is now accepted and ready to land.Jan 4 2017, 6:53 AM
ioeric updated this revision to Diff 83051.Jan 4 2017, 6:57 AM
ioeric marked an inline comment as done.
ioeric edited edge metadata.
  • fix a nit.
ioeric retitled this revision from [change-namespace] get whitespaces right when moving old namespaces. to [change-namespace] get newlines around moved namespace right..Jan 4 2017, 6:58 AM
ioeric updated this object.
This revision was automatically updated to reflect the committed changes.