rsmith added inline comments. ================ Comment at: lib/Sema/SemaInit.cpp:1732 @@ +1731,3 @@ + unsigned FieldIdx = 0; + std::vector<unsigned> SeenFields; + RecordDecl::field_iterator FieldStart = Field; ---------------- Please use an `llvm::BitVector` here instead.
================ Comment at: lib/Sema/SemaInit.cpp:1756-1769 @@ -1752,2 +1755,16 @@ + if (CheckForMissingFields) + for (unsigned i = 0; i < FieldIdx; ++i) + SeenFields.push_back(i); + unsigned idx = 0; + for (RecordDecl::field_iterator f = FieldStart; + f != FieldEnd; ++idx, ++f) { + auto Next = f; + if (++Next == Field) { + FieldIdx = idx; + break; + } + } + SeenFields.push_back(FieldIdx); + ++FieldIdx; InitializedSomething = true; ---------------- You can get the field index with `Field->getFieldIndex() - 1` rather than computing it here (though watch out for the case where `Field == FieldEnd`). ================ Comment at: lib/Sema/SemaInit.cpp:1793-1795 @@ -1775,2 +1792,5 @@ // Don't initialize unnamed bitfields, e.g. "int : 20;" + if (!CheckForMissingFields) + SeenFields.push_back(FieldIdx); + ++FieldIdx; ++Field; ---------------- We don't need to track whether unnamed bit-fields have been "seen". This isn't meaningful. ================ Comment at: lib/Sema/SemaInit.cpp:1808-1809 @@ -1787,1 +1807,4 @@ if (InvalidUse) { + if (!CheckForMissingFields) + SeenFields.push_back(FieldIdx); + ++FieldIdx; ---------------- Once we're in the `hadError` state, we don't need to track `SeenFields` any more. I don't think we need this change. http://reviews.llvm.org/D17407 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits