[PATCH] D118471: [clang][Lexer] Make raw and normal lexer behave the same for line comments

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 7 04:15:01 PST 2022


kadircet added inline comments.


================
Comment at: clang/unittests/Lex/LexerTest.cpp:654
+  while (!L.LexFromRawLexer(T)) {
+    ASSERT_TRUE(!ToksView.empty());
+    EXPECT_EQ(T.getKind(), ToksView.front().getKind());
----------------
probinson wrote:
> @kadircet  @sammccall  It turns out this while loop is zero-trip; the test assertions in the body are never executed.  Replace it with `assert(false);` and the test doesn't crash.
> 
> That means `ToksView` is empty from the start.  This is probably not what you wanted?
> 
> In other words, the test does not exercise the patch.  This is pretty serious.  It needs to be fixed or reverted.
thanks! the discrepancy was actually having tokens in one but not the other, hence tests were failing initially but after the fix the tests passed (by making both lexing modes return none) so it skipped my attention. sending out a fix now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118471



More information about the cfe-commits mailing list