]> granicus.if.org Git - clang/commit
[Sema][Typo] Fix assertion failure for expressions with multiple typos
authorDavid Goldman <dallasftball@gmail.com>
Tue, 20 Aug 2019 19:03:15 +0000 (19:03 +0000)
committerDavid Goldman <dallasftball@gmail.com>
Tue, 20 Aug 2019 19:03:15 +0000 (19:03 +0000)
commit17542ec9635e5c652b03ad865a12eac34cb3e8c1
tree805abb0a6db783963ecea7efcbdfe7335ffc5efa
parent773b53ffcf14d767adb1d1c7e8cd268272f1d7bc
[Sema][Typo] Fix assertion failure for expressions with multiple typos

Summary:
As Typo Resolution can create new TypoExprs while resolving typos,
it is necessary to recurse through the expression to search for more
typos.

This should fix the assertion failure in `clang::Sema::~Sema()`:
  `DelayedTypos.empty() && "Uncorrected typos!"`

Notes:
- In case some TypoExprs are created but thrown away, Sema
  now has a Vector that is used to keep track of newly created
  typos.
- For expressions with multiple typos, we only give suggestions
  if we are able to resolve all typos in the expression
- This patch is similar to D37521 except that it does not eagerly
  commit to a correction for the first typo in the expression.
  Instead, it will search for corrections which fix all of the
  typos in the expression.

Subscribers: cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369427 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Sema/Sema.h
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaLookup.cpp
test/Sema/typo-correction-recursive.cpp [new file with mode: 0644]