[PATCH] D47341: [Sema] Disable creating new delayed typos while correcting existing.
Volodymyr Sapsai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 28 18:48:36 PDT 2018
vsapsai added a comment.
Some debugging details that can be useful but too specific for the commit message. When we have infinite loop, the steps are:
1. Detect typos `structVar1`, `structVar2`
2. Correct typos `structVar1`, `structVar2`
1. Replace `structVar1` with `structVar`. Add corresponding object to `TransformTypos::TypoExprs`.
2. Detect typo `fieldName1`. `NumTypos` becomes 0.
3. Try to `CorrectDelayedTyposInExpr` for `fieldName1` TypoExpr. As there are no typos, no expression transformation.
4. Replace `structVar2` with `structVar`. Add corresponding object to `TransformTypos::TypoExprs`.
5. Detect typo `fieldName2`. `NumTypos` becomes 1.
1. Replace `fieldName2` with `fieldName`
6. Figure out that `structVar.fieldName.member2` is invalid, CheckAndAdvanceTypoExprCorrectionStreams
3. Try different TypoCorrection for `structVar1`. As it is empty, the correction fails.
4. CheckAndAdvanceTypoExprCorrectionStreams. Reset correction stream for `structVar1` and keep going with typo correction because `structVar2` typo correction stream isn't finished.
5. Try different TypoCorrection for `structVar1`.
1. Replace `structVar1` with `structVar`
2. Detect typo `fieldName1`
1. Replace `fieldName1` with `fieldName`
3. Figure out that `structVar.fieldName.member1` is invalid, CheckAndAdvanceTypoExprCorrectionStreams
6. Try different TypoCorrection for `structVar1`. As it is empty, the correction fails.
7. CheckAndAdvanceTypoExprCorrectionStreams over and over again.
After my fix the steps are:
1. Detect typos `structVar1`, `structVar2`
2. Correct typos `structVar1`, `structVar2`
1. Replace `structVar1` with `structVar`. Add corresponding object to `TransformTypos::TypoExprs`.
2. Detect typo `fieldName1`. `NumTypos` becomes 3.
1. Replace `fieldName1` with `fieldName`
3. Figure out that `structVar.fieldName.member1` is invalid, CheckAndAdvanceTypoExprCorrectionStreams
3. Try different TypoCorrection for `structVar1`. As it is empty, the correction fails.
4. All available typo corrections were tried because `TransformTypos::TypoExprs` contains only `structVar1`. Complete the typo correction.
https://reviews.llvm.org/D47341
More information about the cfe-commits
mailing list