This is an archive of the discontinued LLVM Phabricator instance.

[Sema][Typo Correction] Fix potential infite loop on ambiguity checks
ClosedPublic

Authored by dgoldman on Sep 12 2019, 12:39 PM.

Details

Summary

This fixes a bug introduced in D62648, where Clang could infinite loop
if it became stuck on a single TypoCorrection when it was supposed to
be testing ambiguous corrections. Although not a common case, it could
happen if there are multiple possible corrections with the same edit
distance.

The fix is simply to wipe the TypoExpr from the TransformCache so that
the call to TransformTypoExpr doesn't use the CachedEntry.

Diff Detail

Event Timeline

dgoldman created this revision.Sep 12 2019, 12:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2019, 12:39 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
dgoldman updated this revision to Diff 219978.Sep 12 2019, 12:44 PM
  • Fix method name in test
rsmith accepted this revision.Sep 12 2019, 6:55 PM
rsmith added inline comments.
test/Sema/typo-correction-ambiguity.cpp
8

Is the typo in "Ambiguous" here intentional? :)

This revision is now accepted and ready to land.Sep 12 2019, 6:55 PM
dgoldman updated this revision to Diff 220097.Sep 13 2019, 7:23 AM
  • Fix typo in test
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 13 2019, 7:44 AM