[Sema] Emit diagnostics for uncorrected delayed typos at the end of TU
authorIlya Biryukov <ibiryukov@google.com>
Wed, 9 Oct 2019 10:00:05 +0000 (10:00 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Wed, 9 Oct 2019 10:00:05 +0000 (10:00 +0000)
commitaeae71cd96c3477ce09ed543bcb385583172a9be
tree15d32ef53aa415f685935991abae0f7aa50d1c94
parentdf7ea71c3adf23f056eb0e0b926cef002812fb59
[Sema] Emit diagnostics for uncorrected delayed typos at the end of TU

Summary:
Instead of asserting all typos are corrected in the sema destructor.

The sema destructor is not run in the common case of running the compiler
with the -disable-free cc1 flag (which is the default in the driver).

Having this assertion led to crashes in libclang and clangd, which are not
reproducible when running the compiler.

Asserting at the end of the TU could be an option, but finding all
missing typo correction cases is hard and having worse diagnostics instead
of a failing assertion is a better trade-off.

For more discussion on this, see:
https://lists.llvm.org/pipermail/cfe-dev/2019-July/062872.html

Reviewers: sammccall, rsmith

Reviewed By: rsmith

Subscribers: usaxena95, dgoldman, jkorous, vsapsai, rnk, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 374152
clang/lib/Sema/Sema.cpp
clang/test/SemaObjC/typo-correction-subscript.m