[PATCH] D59977: [Lexer] Fix an off-by-one bug in Lexer::getAsCharRange() - NFC.

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 03:31:00 PDT 2019


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

LG with a comment.



================
Comment at: clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp:110-111
+      Lexer::getSourceText(TextRange, Sources, getLangOpts())
+          .rtrim('{') // Drop the { itself.
+          .rtrim();   // Drop any whitespace before it.
   bool IsNested = NestedNamespaceName.contains(':');
----------------
This all seems rather hacky. I believe, this will fail miserably when there are comments before the `{`. Can you leave a FIXME to rewrite this logic in terms of tokens instead?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59977/new/

https://reviews.llvm.org/D59977





More information about the cfe-commits mailing list