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 | afe718f37348b7de29d980cb4bbe5458ce069cca (patch) | |
tree | 0e59e2456a7e7554e837e20ce00afd3c503f1d42 /clang/lib/Sema/SemaInit.cpp | |
parent | f550fa91731af580d40893932c1c2ad135ae1fbf (diff) | |
download | bcm5719-llvm-afe718f37348b7de29d980cb4bbe5458ce069cca.tar.gz bcm5719-llvm-afe718f37348b7de29d980cb4bbe5458ce069cca.zip |
Add a missing increment to avoid infinite looping in the regression test.
Also make sure we set the error flag when correcting a typo.
llvm-svn: 140466
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 2e4b2362b1f..12df59fb76a 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/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; |