Move TypoCorrectionConsumer into a header.

This makes it available outside of SemaLookup.cpp, as
needed for the forthcoming TypoExpr AST node which will
keep a TypoCorrectionConsumer that provides the possible
typo corrections for that TypoExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220691 91177308-0d34-0410-b5e6-96231b3b80d8
Add the initial TypoExpr AST node for delayed typo correction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220692 91177308-0d34-0410-b5e6-96231b3b80d8
Pass around CorrectionCandidateCallbacks as unique_ptrs so
TypoCorrectionConsumer can keep the callback around as long as needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220693 91177308-0d34-0410-b5e6-96231b3b80d8
Have TypoCorrectionConsumer remember the TypoCorrections it returned.

Two additional methods are provided: one to return the current
correction (the last correction returned by getNextCorrection), and one
to "reset" the state so that getNextCorrection will return the previous
corrections before returning any new corrections.

Also ensure that all TypoCorrections have valid source ranges.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220694 91177308-0d34-0410-b5e6-96231b3b80d8
Start adding the infrastructure for handling TypoExprs.

Part of the infrastructure is a map from a TypoExpr to the Sema-specific
state needed to correct it, along with helpers to ease dealing with the
state.

The the typo count is propagated up the stack of
ExpressionEvaluationContextRecords when one is popped off of to
avoid accidentally dropping TypoExprs on the floor. For example,
the attempted correction of g() in test/CXX/class/class.mem/p5-0x.cpp
happens with an ExpressionEvaluationContextRecord that is popped off
the stack prior to ActOnFinishFullExpr being called and the tree
transform for TypoExprs being run.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220695 91177308-0d34-0410-b5e6-96231b3b80d8
Add simple way for a CorrectionCandidateCallback to reject exact
matches of the typo.

Also be more proactive about checking a correction's visibility so that
a correction requiring a module import can be distinguished from the
original typo even if it looks identical. Otherwise the correction will
be excluded and the diagnostic about needing the module import won't be
emitted.

Note that no change was made to checkCorrectionVisibility other than
moving where it is at in SemaLookup.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220696 91177308-0d34-0410-b5e6-96231b3b80d8
Add a callback for recovering using a typo correction.

Also keep track of the stack of Exprs visited during the tree transform
so the callback can be passed the parent of the TypoExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220697 91177308-0d34-0410-b5e6-96231b3b80d8
Wire up LookupMemberExpr to use the new TypoExpr.

This includes adding the new TypoExpr-based lazy typo correction to
LookupMemberExprInRecord as an alternative to the existing eager typo
correction.

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