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

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 12 01:15:41 PDT 2016


hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: change-namespace/ChangeNamespace.cpp:387
+  Token Tok;
+  while (!Lex->LexFromRawLexer(Tok) && Tok.isNot(tok::TokenKind::l_brace)) {
+  }
----------------
ioeric wrote:
> hokein wrote:
> > Maybe we can use `findLocationAfterToken` here? 
> 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(...);
> 
I see. Thanks for the clarification.


https://reviews.llvm.org/D25397





More information about the cfe-commits mailing list