diff options
| author | Volodymyr Sapsai <vsapsai@apple.com> | 2018-06-26 17:56:48 +0000 |
|---|---|---|
| committer | Volodymyr Sapsai <vsapsai@apple.com> | 2018-06-26 17:56:48 +0000 |
| commit | 3bbf7890031193658aacb2eecaa4da0dd33b432e (patch) | |
| tree | 4721ba89aee90b873e517c6e83cb60c7b9784224 /clang/test/Sema | |
| parent | 7f55af37f40ed6e03b646ca57688dee492d39a59 (diff) | |
| download | bcm5719-llvm-3bbf7890031193658aacb2eecaa4da0dd33b432e.tar.gz bcm5719-llvm-3bbf7890031193658aacb2eecaa4da0dd33b432e.zip | |
[Sema] Fix infinite typo correction loop.
NumTypos guard value ~0U doesn't prevent from creating new delayed typos. When
you create new delayed typos during typo correction, value ~0U wraps around to
0. When NumTypos is 0 we can miss some typos and treat an expression as it can
be typo-corrected. But if the expression is still invalid after correction, we
can get stuck in infinite loop trying to correct it.
Fix by not using value ~0U so that NumTypos correctly reflects the number of
typos.
rdar://problem/38642201
Reviewers: arphaman, majnemer, rsmith
Reviewed By: rsmith
Subscribers: rsmith, nicholas, cfe-commits
Differential Revision: https://reviews.llvm.org/D47341
llvm-svn: 335638
Diffstat (limited to 'clang/test/Sema')
| -rw-r--r-- | clang/test/Sema/typo-correction.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/Sema/typo-correction.c b/clang/test/Sema/typo-correction.c index 78007015dca..e7992ac90bb 100644 --- a/clang/test/Sema/typo-correction.c +++ b/clang/test/Sema/typo-correction.c @@ -87,3 +87,16 @@ __attribute__((overloadable)) void func_overloadable(float); void overloadable_callexpr(int arg) { func_overloadable(ar); //expected-error{{use of undeclared identifier}} } + +// rdar://problem/38642201 +struct rdar38642201 { + int fieldName; +}; + +void rdar38642201_callee(int x, int y); +void rdar38642201_caller() { + struct rdar38642201 structVar; + rdar38642201_callee( + structVar1.fieldName1.member1, //expected-error{{use of undeclared identifier 'structVar1'}} + structVar2.fieldName2.member2); //expected-error{{use of undeclared identifier 'structVar2'}} +} |

