Go to file
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
clang [Lex] Fix crash on code completion in comment in included file. 2018-01-19 23:41:47 +00:00
clang-tools-extra [clangd] Change index scope convention from "outer::inner" to "outer::inner::" 2018-01-19 22:18:21 +00:00
compiler-rt [sanitizer] Allow Fuchsia to use getauxval 2018-01-19 22:33:30 +00:00
debuginfo-tests [debuginfo-tests] Support moving debuginfo-tests to llvm/projects 2017-12-12 16:54:20 +00:00
libclc tanpi: Port from amd_builtins 2018-01-19 18:57:22 +00:00
libcxx More P0202 constexpr-ifying in <algorithm>. This commit handles replace/replace_if/replace_copy/replace_copy_if. 2018-01-19 18:07:29 +00:00
libcxxabi [cmake] [libcxxabi] Don't print warning when tests are disabled. 2018-01-18 18:29:36 +00:00
libunwind [PPC64] Added vector registers. 2018-01-16 20:54:10 +00:00
lld [WebAssembly] Include SYMBOL_INFO for imports as well as exports 2018-01-19 21:49:41 +00:00
lldb Wrap all references to build artifacts in the LLDB testsuite (NFC) 2018-01-19 23:24:35 +00:00
llgo irgen: Create functions instead of global variables for builtin hash and equal algorithms. 2017-06-04 22:11:28 +00:00
llvm [AArch64] Add ARMv8.2-A FP16 scalar intrinsics 2018-01-19 23:10:56 +00:00
openmp Sprinkle a few <cstdlib> includes, for libomptarget sources using 2018-01-18 18:24:22 +00:00
parallel-libs [Axccel] Remove -Wno-missing-braces in build 2016-12-19 21:34:07 +00:00
polly Change memcpy/memove/memset to have dest and source alignment attributes (Step 1). 2018-01-19 17:12:48 +00:00
README.md Add an svn project to contain the files that appear at the root of the 2017-10-19 21:09:49 +00:00

README.md

Low Level Virtual Machine (LLVM)

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.