Skip to content

Commit 89751b1

Browse files
committed
lambda
1 parent 7d0445e commit 89751b1

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/ir/struct-utils.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -456,14 +456,7 @@ template<typename T> class TypeHierarchyPropagator {
456456
// Propagate shared fields to the subtypes, which may just be the exact
457457
// version of the same type.
458458
auto numFields = type.getStruct().fields.size();
459-
std::vector<std::pair<HeapType, Exactness>> subs;
460-
if (includeExact) {
461-
subs.emplace_back(type, Exact);
462-
}
463-
for (auto subType : subTypes.getImmediateSubTypes(type)) {
464-
subs.emplace_back(subType, Inexact);
465-
}
466-
for (auto sub : subs) {
459+
auto handleSubtype = [&](std::pair<HeapType, Exactness> sub) {
467460
auto& subInfos = combinedInfos[sub];
468461
for (Index i = 0; i < numFields; i++) {
469462
if (subInfos[i].combine(infos[i])) {
@@ -474,6 +467,12 @@ template<typename T> class TypeHierarchyPropagator {
474467
if (subInfos.desc.combine(infos.desc)) {
475468
work.push(sub);
476469
}
470+
};
471+
if (includeExact) {
472+
handleSubtype({type, Exact});
473+
}
474+
for (auto subType : subTypes.getImmediateSubTypes(type)) {
475+
handleSubtype({subType, Inexact});
477476
}
478477
}
479478
}

0 commit comments

Comments
 (0)