[PATCH v2 0/6] Extend delayed typo correction to DiagnoseEmptyLookup

Kaelyn Takata rikka at google.com
Wed Oct 29 12:49:27 PDT 2014


Here is the next installment of the new delayed typo correction functionality.
This patch set builds upon my previous one by adding optional use of
Sema::CorrectTypoDelayed to Sema::DiagnoseEmptyLookup, and makes the changes
necessary for the new feature to be used by Sema::ActOnIdExpression. The delayed
typo correction is only enabled for (Obj)C++ because the non-C++ code paths
cannot handle dependent expressions. Two of the three test changes are cases
where recovery is now possible (in one, recovery caused an error to be avoided;
in the other, recovery exposed an underlying error in the code that was obscured
by the intentional typo). In the third test, SemaTemplate/crash-10438657.cpp,
the same error is no longer being emitted for both uses of the same unknown
identifier (m_refData).

As a side note, the first patch ("Correctly set the SourceRange a TypoCorrection
will replace.") could be submitted separately as it is a simple fix mostly
unrelated to the rest of the patch set. However, I've yet to figure out a test
case for this change, though the fix is needed to keep the rest of the patchset
(once DiagnoseEmptyLookup can use delayed typo correction) from breaking
tests in FixIt/fixit-unrecoverable.cpp, FixIt/typo.cpp and
SemaCXX/typo-correction.cpp.

v2:
  * Rebase against head and the committed version of the first TypoExpr
    patchset.
  * Adapt to the functor approach the first patchset ultimately used for the
    diagnostic and recovery callbacks.

Kaelyn Takata (6):
  Correctly set the SourceRange a TypoCorrection will replace.
  Create two helpers for running the typo-correction tree transform.
  Add a few small helper methods to the TypoCorrectionConsumer.
  Factor out the default recovery handling.
  Add a flag to BuildDeclarationNameExpr to not reject invalid decls.
  Wire up delayed typo correction to DiagnoseEmptyLookup and set up
    Sema::ActOnIdExpression to use the new functionality.

 include/clang/Parse/Parser.h         |   9 +++
 include/clang/Sema/Sema.h            |  23 ++++--
 include/clang/Sema/SemaInternal.h    |  15 ++++
 include/clang/Sema/TypoCorrection.h  |   7 +-
 lib/Parse/ParseCXXInlineMethods.cpp  |   1 +
 lib/Parse/ParseDecl.cpp              |   4 +-
 lib/Parse/ParseDeclCXX.cpp           |   2 +-
 lib/Parse/ParseExpr.cpp              |  30 +++++---
 lib/Parse/ParseExprCXX.cpp           |  13 +++-
 lib/Parse/ParseObjc.cpp              |   5 +-
 lib/Parse/ParseOpenMP.cpp            |   3 +-
 lib/Parse/ParseStmt.cpp              |   8 ++-
 lib/Sema/SemaExpr.cpp                | 125 ++++++++++++++++++++++++++++----
 lib/Sema/SemaExprCXX.cpp             | 135 +++++++++++++++++++++++++++--------
 lib/Sema/SemaLookup.cpp              |   8 ++-
 lib/Sema/SemaStmt.cpp                |  19 +++++
 test/FixIt/fixit-unrecoverable.cpp   |   4 +-
 test/SemaCXX/typo-correction.cpp     |   7 +-
 test/SemaTemplate/crash-10438657.cpp |   2 +-
 19 files changed, 342 insertions(+), 78 deletions(-)

-- 
2.1.0.rc2.206.gedb03e5


More information about the cfe-commits mailing list