diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-09-25 02:41:26 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-09-25 02:41:26 +0000 |
commit | a41ee4921f0b42861cbb795752919ee3eddaf143 (patch) | |
tree | d2f74f8f3abe2ef402780a40ac80dd258d16c737 | |
parent | e003cfc080b9aa53f85da6cccb3fe6fac4815047 (diff) |
Add a missing increment to avoid infinite looping in the regression test.
Also make sure we set the error flag when correcting a typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140466 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaInit.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 2e4b2362b1..12df59fb76 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -1615,8 +1615,10 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity, } if (Field == FieldEnd) { - if (VerifyOnly) + if (VerifyOnly) { + ++Index; return true; // No typo correction when just trying this out. + } // There was no normal field in the struct with the designated // name. Perform another lookup for this name, which may find @@ -1647,6 +1649,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity, << FixItHint::CreateReplacement(D->getFieldLoc(), CorrectedStr); SemaRef.Diag(ReplacementField->getLocation(), diag::note_previous_decl) << CorrectedQuotedStr; + hadError = true; } else { SemaRef.Diag(D->getFieldLoc(), diag::err_field_designator_unknown) << FieldName << CurrentObjectType; |