cameron314 created this revision. cameron314 added a reviewer: rsmith. cameron314 added a subscriber: cfe-commits.
When triggering code completion within a file that is included in the middle of a declaration in another file, clang would crash while parsing the code. This occurred with real-world code; there was an enum declaration that included a header in the middle of its declaration to specify the enum members. http://reviews.llvm.org/D20131 Files: lib/Lex/PPLexerChange.cpp Index: lib/Lex/PPLexerChange.cpp =================================================================== --- lib/Lex/PPLexerChange.cpp +++ lib/Lex/PPLexerChange.cpp @@ -378,6 +378,8 @@ Result.startToken(); 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!"); CurPTHLexer->getEOF(Result);
Index: lib/Lex/PPLexerChange.cpp =================================================================== --- lib/Lex/PPLexerChange.cpp +++ lib/Lex/PPLexerChange.cpp @@ -378,6 +378,8 @@ Result.startToken(); 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!"); CurPTHLexer->getEOF(Result);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits