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

2016-05-11 Thread Cameron via cfe-commits
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_Cachin

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

2016-05-11 Thread Cameron via cfe-commits
cameron314 updated this revision to Diff 56961. cameron314 added a comment. Ah, perfect, thanks. Behold, a test that fails without the patch and passes with it :-) http://reviews.llvm.org/D20131 Files: lib/Lex/PPLexerChange.cpp test/CodeCompletion/include-within-declaration.c Index: test/C

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

2016-05-11 Thread Richard Smith via cfe-commits
rsmith added a comment. In http://reviews.llvm.org/D20131#427717, @cameron314 wrote: > I have no way to distinguish between a crash and the normal errors (with > hidden completions). Is there any other way to test this? If you use `// RUN: not %clang_cc1 -code-completion-at=[...]`, the test sh

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

2016-05-11 Thread Cameron via cfe-commits
cameron314 added a comment. I fixed this last July so the details are a little hazy, but fortunately it turns out I documented what I had found: > It seems when clang parses an enum declaration, it first parses the > declaration specifiers, then stops if a semicolon is present. > The trouble

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

2016-05-10 Thread Richard Smith via cfe-commits
rsmith added a comment. Please add a test to test/CodeCompletion. Comment at: lib/Lex/PPLexerChange.cpp:380-382 @@ -379,3 +379,5 @@ CurLexer->FormTokenWithChars(Result, CurLexer->BufferEnd, tok::eof); CurLexer.reset(); +if (CurLexerKind == CLK_Lexer) +

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

2016-05-10 Thread Cameron via cfe-commits
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-worl