diff options
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig index e93fe2549c..a464ac83de 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -783,6 +783,16 @@ pub const Decl = struct { return decl.ty.abiAlignment(target); } } + + pub fn markAlive(decl: *Decl) void { + if (decl.alive) return; + decl.alive = true; + + // This is the first time we are marking this Decl alive. We must + // therefore recurse into its value and mark any Decl it references + // as also alive, so that any Decl referenced does not get garbage collected. + decl.val.markReferencedDeclsAlive(); + } }; /// This state is attached to every Decl when Module emit_h is non-null. |
