This patch is a rough draft of my attempt to replace the Sema::CorrectTypoContext enum with a callback object for performing finer grained validation of potential typo corrections. This version just includes a wrapper for Sema::CorrectTypo to translate a CorrectTypoContext value into a corresponding callback object. The idea is to give CorrectTypo a way to filter potential corrections with more accuracy by being able to take into account e.g. what kinds of decls are allowed/expected, instead of giving a very rough guide on what corrections are acceptable (CorrectTypoContext values mainly affect which keywords should be added to the set of possible corrections; the exceptions are that CTC_ObjCMessageReceiver would give precedence to the "super" keyword over other corrections with the same edit distance, and CTC_ObjCIvarLookup would trigger ObjC ivar lookup before other forms of lookup when looking up potential typo correction identifiers).<div>
<br></div><div>I'll be surprised if the interface of the callback class doesn't expand or improve as I fix up callers of CorrectTypo to use callback objects directly. I also hope to entirely remove or at least come up with a cleaner solution than the flags in the callback class that control which keywords are added to the candidate pool. I'm sending this initial patch to start gathering feedback on the approach while fixing up the CorrectTypo callers, as those changes will most likely dwarf the changes that add the callback infrastructure to CorrectTypo. As such, I'm fine with either submitting this patch or holding off until the conversion is further along.</div>
<div><br></div><div>Cheers,</div><div>Kaelyn</div>