This is an archive of the discontinued LLVM Phabricator instance.

[change-namespace] don't miss comments in the beginning of a namespace block.
ClosedPublic

Authored by ioeric on Oct 8 2016, 9:42 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ioeric updated this revision to Diff 74038.Oct 8 2016, 9:42 AM
ioeric retitled this revision from to [change-namespace] don't miss comments in the beginning of a namespace block..
ioeric updated this object.
ioeric added a reviewer: hokein.
ioeric added a subscriber: cfe-commits.
hokein added inline comments.Oct 11 2016, 3:53 AM
change-namespace/ChangeNamespace.cpp
387 ↗(On Diff #74038)

Maybe we can use findLocationAfterToken here?

ioeric added inline comments.Oct 11 2016, 11:18 AM
change-namespace/ChangeNamespace.cpp
387 ↗(On Diff #74038)

This doesn't seem to work in this case. Note that we are lexing from the beginning of NsDecl, which is namespace or inline, and the next token is not necessarily {.

/// \brief Checks that the given token is the first token that occurs after the
/// given location (this excludes comments and whitespace). Returns the location
/// immediately after the specified token. If the token is not found or the
/// location is inside a macro, the returned source location will be invalid.
SourceLocation Lexer::findLocationAfterToken(...);
hokein accepted this revision.Oct 12 2016, 1:15 AM
hokein edited edge metadata.

LGTM.

change-namespace/ChangeNamespace.cpp
387 ↗(On Diff #74038)

I see. Thanks for the clarification.

This revision is now accepted and ready to land.Oct 12 2016, 1:15 AM
This revision was automatically updated to reflect the committed changes.