Correctly set the SourceRange a TypoCorrection will replace.

Also clean up TypoCorrection::setCorrectionRange while we're at it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222460 91177308-0d34-0410-b5e6-96231b3b80d8
Add a few small helper methods to the TypoCorrectionConsumer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222461 91177308-0d34-0410-b5e6-96231b3b80d8
Factor out the default recovery handling.

The default handling is extended to properly create member expressions
and Objective-C ivar references.

Also detect and reject cases where multiple corrections have identical
correction distances and are valid, instead of suggesting the first one
that is found.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222462 91177308-0d34-0410-b5e6-96231b3b80d8
Add a flag to BuildDeclarationNameExpr to not reject invalid decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222463 91177308-0d34-0410-b5e6-96231b3b80d8
Wire up delayed typo correction to DiagnoseEmptyLookup and set up
Sema::ActOnIdExpression to use the new functionality.

Among other things, this allows recovery in several cases where it
wasn't possible before (e.g. correcting a mistyped static_cast<>).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222464 91177308-0d34-0410-b5e6-96231b3b80d8
Ensure all TypoExprs are diagnosed by the tree transform.

If there is more than one TypoExpr within the expr being transformed and
any but the last TypoExpr seen don't have any viable candidates, the
tree transform will be aborted early and the remaining TypoExprs are
never seen and hence never diagnosed. This adds a simple
RecursiveASTVisitor to find all of the TypoExprs to be diagnosed in the
case where typo correction of the entire expr fails (and the result of
the tree transform is an ExprError).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222465 91177308-0d34-0410-b5e6-96231b3b80d8