[cfe-commits] r140466 - /cfe/trunk/lib/Sema/SemaInit.cpp

Benjamin Kramer benny.kra at googlemail.com
Sat Sep 24 19:41:26 PDT 2011


Author: d0k
Date: Sat Sep 24 21:41:26 2011
New Revision: 140466

URL: http://llvm.org/viewvc/llvm-project?rev=140466&view=rev
Log:
Add a missing increment to avoid infinite looping in the regression test.

Also make sure we set the error flag when correcting a typo.

Modified:
    cfe/trunk/lib/Sema/SemaInit.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=140466&r1=140465&r2=140466&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Sat Sep 24 21:41:26 2011
@@ -1615,8 +1615,10 @@
     }
 
     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 @@
             << 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;





More information about the cfe-commits mailing list