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

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 11 11:18:19 PDT 2016


ioeric added inline comments.


================
Comment at: change-namespace/ChangeNamespace.cpp:387
+  Token Tok;
+  while (!Lex->LexFromRawLexer(Tok) && Tok.isNot(tok::TokenKind::l_brace)) {
+  }
----------------
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(...);



https://reviews.llvm.org/D25397





More information about the cfe-commits mailing list