yvvan updated this revision to Diff 110978. yvvan added a comment. I have minimized the crash case and added simple test for it.
https://reviews.llvm.org/D36458 Files: lib/Parse/Parser.cpp test/Index/std-begin-error.cpp Index: test/Index/std-begin-error.cpp =================================================================== --- test/Index/std-begin-error.cpp +++ test/Index/std-begin-error.cpp @@ -0,0 +1,9 @@ +#ifndef RC_INVOKED +#include <xmemory> +_STD_BEGIN +} +#endif /* RC_INVOKED */ + +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local -std=c++14 %S\std-begin-error.cpp 2> %t.err +// RUN: not FileCheck < %t.err %s +// CHECK: Failure: libclang crashed Index: lib/Parse/Parser.cpp =================================================================== --- lib/Parse/Parser.cpp +++ lib/Parse/Parser.cpp @@ -516,8 +516,8 @@ // Prime the lexer look-ahead. ConsumeToken(); - - PP.replayPreambleConditionalStack(); + if (!PP.isCurrentLexer(nullptr)) + PP.replayPreambleConditionalStack(); } void Parser::LateTemplateParserCleanupCallback(void *P) {
Index: test/Index/std-begin-error.cpp =================================================================== --- test/Index/std-begin-error.cpp +++ test/Index/std-begin-error.cpp @@ -0,0 +1,9 @@ +#ifndef RC_INVOKED +#include <xmemory> +_STD_BEGIN +} +#endif /* RC_INVOKED */ + +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local -std=c++14 %S\std-begin-error.cpp 2> %t.err +// RUN: not FileCheck < %t.err %s +// CHECK: Failure: libclang crashed Index: lib/Parse/Parser.cpp =================================================================== --- lib/Parse/Parser.cpp +++ lib/Parse/Parser.cpp @@ -516,8 +516,8 @@ // Prime the lexer look-ahead. ConsumeToken(); - - PP.replayPreambleConditionalStack(); + if (!PP.isCurrentLexer(nullptr)) + PP.replayPreambleConditionalStack(); } void Parser::LateTemplateParserCleanupCallback(void *P) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits