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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 13:16:40 PDT 2019


NoQ marked an inline comment as done.
NoQ added inline comments.


================
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(':');
----------------
alexfh wrote:
> 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?
I wonder why did people have to do this in the first place. Like, isn't such information supposed to be available in the AST?


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

https://reviews.llvm.org/D59977





More information about the cfe-commits mailing list