Skip to content

Commit 7be534b

Browse files
committed
Flattener: Pull up children of children
1 parent c638062 commit 7be534b

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

oi/type_graph/Flattener.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,14 @@ void Flattener::visit(Class& c) {
205205
for (const auto& child : c.children) {
206206
accept(child);
207207
}
208+
209+
// Pull in children from flattened children
210+
//
211+
// This may result in duplicates, but that shouldn't be a big deal
212+
for (const Class& child : c.children) {
213+
c.children.insert(c.children.end(), child.children.begin(),
214+
child.children.end());
215+
}
208216
}
209217

210218
void Flattener::visit(Container& c) {

oi/type_graph/Types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class Class : public Type {
235235
std::vector<Parent> parents; // Sorted by offset
236236
std::vector<Member> members; // Sorted by offset
237237
std::vector<Function> functions;
238-
std::vector<std::reference_wrapper<Type>>
238+
std::vector<std::reference_wrapper<Class>>
239239
children; // Only for dynamic classes
240240

241241
private:

test/test_flattener.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,8 @@ TEST(FlattenerTest, ChildrenTwoDeep) {
681681
Primitive: int32_t
682682
Member: a (offset: 12)
683683
Primitive: int32_t
684+
Child
685+
[2]
684686
)");
685687
}
686688

0 commit comments

Comments
 (0)