================ @@ -1104,12 +1104,22 @@ RecordStorageLocation *getBaseObjectLocation(const MemberExpr &ME, return Env.get<RecordStorageLocation>(*Base); } -std::vector<FieldDecl *> getFieldsForInitListExpr(const RecordDecl *RD) { +std::vector<const FieldDecl *> +getFieldsForInitListExpr(const InitListExpr *InitList) { + const RecordDecl *RD = InitList->getType()->getAsRecordDecl(); + assert(RD != nullptr); + + std::vector<const FieldDecl *> Fields; ---------------- martinboehme wrote:
Makes sense. Unfortunately, `RecordDecl` doesn't have a way (that I know of) to query the number of fields. There's no `getNumFields()` or similar, and `field_end()-field_begin()` also doesn't work (because the iterator doesn't support `operator-`. So we'd have to do a complete iteration through the fields to determine the number, and at that point, I think we're getting into diminishing returns. https://github.com/llvm/llvm-project/pull/82348 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits