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

Kaelyn Takata rikka at google.com
Fri Aug 22 16:01:16 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 and probably will at some point be folded into one of the
patches from the first patch set that implements Sema::CorrectTypoDelayed.

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              |  28 ++++++--
 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             | 123 +++++++++++++++++++++++++++-------
 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, 334 insertions(+), 72 deletions(-)

-- 
2.1.0.rc2.206.gedb03e5


More information about the cfe-commits mailing list