llvm-project/clang/test
Volodymyr Sapsai 9d540f1539 [Lex] Fix crash on code completion in comment in included file.
This fixes PR32732 by updating CurLexerKind to reflect available lexers.
We were hitting null pointer in Preprocessor::Lex because CurLexerKind
was CLK_Lexer but CurLexer was null. And we set it to null in
Preprocessor::HandleEndOfFile when exiting a file with code completion
point.

To reproduce the crash it is important for a comment to be inside a
class specifier. In this case in Parser::ParseClassSpecifier we improve
error recovery by pushing a semicolon token back into the preprocessor
and later on try to lex a token because we haven't reached the end of
file.

Also clang crashes only on code completion in included file, i.e. when
IncludeMacroStack is not empty. Though we reset CurLexer even if include
stack is empty. The difference is that during pushing back a semicolon
token, preprocessor calls EnterCachingLexMode which decides it is
already in caching mode because various lexers are null and
IncludeMacroStack is not empty. As the result, CurLexerKind remains
CLK_Lexer instead of updating to CLK_CachingLexer.

rdar://problem/34787685

Reviewers: akyrtzi, doug.gregor, arphaman

Reviewed By: arphaman

Subscribers: cfe-commits, kfunk, arphaman, nemanjai, kbarton

Differential Revision: https://reviews.llvm.org/D41688

llvm-svn: 323008
2018-01-19 23:41:47 +00:00
..
ARCMT Avoid assumption that lit tests are writable. NFC 2018-01-08 15:05:01 +00:00
ASTMerge [ASTImporter] Fix missing SourceLoc import for ObjCMethodDecl selectors 2018-01-09 14:25:05 +00:00
Analysis [analyzer] operator new: Fix callback order for CXXNewExpr. 2018-01-18 00:53:50 +00:00
CXX DR126: partially implement the const-correct rules for exception handler matching. 2018-01-13 05:05:45 +00:00
CodeCompletion [Lex] Fix crash on code completion in comment in included file. 2018-01-19 23:41:47 +00:00
CodeGen [AArch64] Add ARMv8.2-A FP16 scalar intrinsics 2018-01-19 23:11:18 +00:00
CodeGenCUDA
CodeGenCXX Change memcpy/memove/memset to have dest and source alignment attributes (Step 1). 2018-01-19 17:12:54 +00:00
CodeGenCoroutines [coroutines] Promote cleanup.dest.slot allocas to registers to avoid storing it in the coroutine frame 2017-11-11 17:00:43 +00:00
CodeGenObjC Change memcpy/memove/memset to have dest and source alignment attributes (Step 1). 2018-01-19 17:12:54 +00:00
CodeGenObjCXX Change memcpy/memove/memset to have dest and source alignment attributes (Step 1). 2018-01-19 17:12:54 +00:00
CodeGenOpenCL Change memcpy/memove/memset to have dest and source alignment attributes (Step 1). 2018-01-19 17:12:54 +00:00
Coverage [Analyzer] Add support for displaying cross-file diagnostic paths in HTML output 2017-08-03 18:12:22 +00:00
CoverageMapping [Parse] Forward brace locations to TypeConstructExpr 2018-01-17 18:53:51 +00:00
Driver [X86] Add goldmont to test/Driver/x86-march.c 2018-01-19 19:43:36 +00:00
FixIt Add a "vexing parse" warning for ambiguity between a variable declaration and a 2017-09-29 23:57:25 +00:00
Format [clang] Get rid of "%T" expansions 2017-08-15 19:47:06 +00:00
Frontend [Driver] Suggest correctly spelled driver options 2018-01-06 00:25:40 +00:00
Headers In stdbool.h, define bool, false, true only in gnu++98 2017-12-08 08:28:08 +00:00
Import Add support for remembering origins to ExternalASTMerger 2017-09-27 19:57:58 +00:00
Index Ensure code complete with !LoadExternal sees all local decls. 2018-01-16 12:33:46 +00:00
Integration Fix the test fix from r312181 2017-08-30 23:26:38 +00:00
Layout
Lexer [Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral. 2018-01-12 18:54:35 +00:00
Misc Track in the AST whether the operand to a UnaryOperator can overflow and then use that logic when evaluating constant expressions and emitting codegen. 2018-01-09 13:07:03 +00:00
Modules Allow BlockDecl in CXXRecord scope to have no access specifier. 2018-01-19 20:46:19 +00:00
OpenMP Change memcpy/memove/memset to have dest and source alignment attributes (Step 1). 2018-01-19 17:12:54 +00:00
PCH Avoid assumption that lit tests are writable (in a couple more places). NFC 2018-01-09 09:32:53 +00:00
Parser Factor out comparison handling for arithmetic types. 2018-01-08 21:12:04 +00:00
Preprocessor [X86] Add missing check for RDSEED to ICL, CNL, SKX sections of test/Preprocessor/predefined-arch-macros.c 2018-01-19 00:28:42 +00:00
Profile [PGO] Detect more structural changes with the stable hash 2017-11-14 23:56:53 +00:00
Refactor [refactor][extract] avoid extracting expressions from types in functions 2017-11-14 18:59:01 +00:00
Rewriter [clang] Remove unit test which uses reverse-iterate flag 2017-08-24 22:40:32 +00:00
Sema Remove TautologicalInRangeCompare from Extra and TautologicalCompare. 2018-01-18 21:40:27 +00:00
SemaCUDA [CUDA] Report "unsupported VLA" errors only on device side. 2017-11-28 18:51:42 +00:00
SemaCXX [DeclPrinter] Fix two cases that crash clang -ast-print. 2018-01-17 19:29:39 +00:00
SemaObjC PR35815: Separate out the ns-consumed diagnostic into an error and 2018-01-03 23:52:42 +00:00
SemaObjCXX Re-commit r321223, which adds a printing policy to the ASTDumper. 2017-12-21 21:42:42 +00:00
SemaOpenCL [OpenCL] Add extensions cl_intel_subgroups and cl_intel_subgroups_short 2017-11-27 09:14:17 +00:00
SemaTemplate In C++17, when instantiating an out-of-line definition of an inline static data 2018-01-10 23:08:26 +00:00
TableGen
Tooling [tooling] Make compile_flags.txt negative test more hermetic 2017-11-14 15:22:34 +00:00
Unit [lit] Set shlibpath_var on Solaris 2017-11-27 13:33:19 +00:00
VFS Avoid assumption that lit tests are writable. NFC 2018-01-08 15:05:01 +00:00
clang-rename [clang-rename] Fix and enable the failing TemplatedClassFunction test. 2017-10-25 08:25:25 +00:00
.clang-format
CMakeLists.txt [cmake] Follow-up to rL320494. 2017-12-12 19:47:40 +00:00
TestRunner.sh
cxx-sections.data
lit.cfg.py [debuginfo] Remove temporary FIXME. 2017-12-14 22:12:46 +00:00
lit.site.cfg.py.in [lit] Add host_cxx to lit config 2017-10-10 17:53:45 +00:00
make_test_dirs.pl