[PATCH] D20131: Fixed crash during code completion in file included within declaration

Cameron via cfe-commits cfe-commits at lists.llvm.org
Wed May 11 14:23:13 PDT 2016


cameron314 added inline comments.

================
Comment at: lib/Lex/PPLexerChange.cpp:380-383
@@ -379,4 +379,6 @@
         CurLexer->FormTokenWithChars(Result, CurLexer->BufferEnd, tok::eof);
         CurLexer.reset();
+        if (CurLexerKind == CLK_Lexer)
+          CurLexerKind = CLK_CachingLexer;
       } else {
         assert(CurPTHLexer && "Got EOF but no current lexer set!");
----------------
Ah, wait, yes this also prevents the crash if I remove the `CurLexer.reset()` and use `CurLexer->cutOffLexing()`, but it not only produces an error about a missing '}', but an error about an extra '}' just after, which doesn't really make sense. That means it's inspecting tokens past the EOF that was injected.


http://reviews.llvm.org/D20131





More information about the cfe-commits mailing list