Skip to content

Commit 7b68f5d

Browse files
committed
Revert "Remove nested $fork handling from union detection"
This reverts commit 10a4056.
1 parent e421fa8 commit 7b68f5d

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

kernel/fstdata.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,26 @@ void FstData::extractVarNames()
175175

176176
while ((h = fstReaderIterateHier(ctx))) {
177177
switch (h->htyp) {
178+
case FST_HT_SCOPE: {
179+
// Handle tracking for potential union structs with $fork.
180+
if (!detect_union && h->u.scope.typ == FST_ST_VCD_FORK) {
181+
detect_union = true;
182+
fork_parent_scope = fst_scope_name;
183+
fork_name = h->u.scope.name;
184+
fork_vars.clear();
185+
} else if (detect_union && h->u.scope.typ == FST_ST_VCD_STRUCT) {
186+
// Signal that a nested $fork can not be a candidate for union struct detection.
187+
log_warning("Nested $fork '%s' inside $fork '%s'; "
188+
"abandoning union detection for this scope...\n",
189+
h->u.scope.name, fork_name.c_str());
190+
for (auto &v : fork_vars) registerVar(v);
191+
detect_union = false;
192+
fork_vars.clear();
193+
}
194+
// Push the scope onto the stack to 'descend' into the hierarchy.
195+
fst_scope_name = fstReaderPushScope(ctx, h->u.scope.name, NULL);
196+
break;
197+
}
178198
case FST_HT_SCOPE: {
179199
// Handle tracking for potential union structs with $fork.
180200
if (!detect_union && h->u.scope.typ == FST_ST_VCD_FORK) {

0 commit comments

Comments
 (0)