[CUS-538] - $fork scope union struct support#167
Conversation
Greptile SummaryThis PR refactors
Confidence Score: 3/5The change works correctly for flat fork scopes with direct variables, but will silently misregister variables for any union whose members are themselves structs with nested scopes. The kernel/fstdata.cc — specifically the Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[fstReaderIterateHier loop] --> B{h->htyp}
B -->|FST_HT_SCOPE| C{in_fork == false AND typ == FST_ST_VCD_FORK?}
C -->|Yes| D[Set in_fork=true / Save fork_parent_scope and fork_name / Clear fork_vars]
C -->|No| E[fstReaderPushScope]
D --> E
B -->|FST_HT_UPSCOPE| F{in_fork?}
F -->|Yes| G{fork_vars.size >= 2 AND all ids equal?}
G -->|Yes = union| H[Create single FstVar with fork_name and fork_parent_scope / registerVar]
G -->|No = not union| I[Loop: registerVar for each fork_var]
H --> J[in_fork=false / fork_vars.clear]
I --> J
J --> K[fstReaderPopScope]
F -->|No| K
B -->|FST_HT_VAR| L{in_fork?}
L -->|Yes| M[fork_vars.push_back var]
L -->|No| N[registerVar var]
Reviews (1): Last reviewed commit: "union" | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Removed unnecessary closing brace in switch case.
Removed logic for nested $fork handling in union struct detection.
Support for union struct declared as $fork scopes.