diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-12-26 18:34:20 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-01-15 15:11:36 -0800 |
| commit | eb943890d975a50618db8ca7593563fcf8b107da (patch) | |
| tree | 54b7dc26c3f354e4a5059670aaba6e5450ec1d58 /src/InternPool.zig | |
| parent | aebccb06e774107d18c4259eafbf5eb3c642237a (diff) | |
| download | zig-eb943890d975a50618db8ca7593563fcf8b107da.tar.gz zig-eb943890d975a50618db8ca7593563fcf8b107da.zip | |
resolve merge conflicts
with 497592c9b45a94fb7b6028bf45b80f183e395a9b
Diffstat (limited to 'src/InternPool.zig')
| -rw-r--r-- | src/InternPool.zig | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig index a43c5a7d3a..9c91dfae6a 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -552,6 +552,15 @@ pub const Nav = struct { }; } + /// This function is intended to be used by code generation, since semantic + /// analysis will ensure that any `Nav` which is potentially `extern` is + /// fully resolved. + /// Asserts that `status == .fully_resolved`. + pub fn getResolvedExtern(nav: Nav, ip: *const InternPool) ?Key.Extern { + assert(nav.status == .fully_resolved); + return nav.getExtern(ip); + } + /// Always returns `null` for `status == .type_resolved`. This function is inteded /// to be used by code generation, since semantic analysis will ensure that any `Nav` /// which is potentially `extern` is fully resolved. @@ -586,6 +595,15 @@ pub const Nav = struct { } /// Asserts that `status != .unresolved`. + pub fn getLinkSection(nav: Nav) OptionalNullTerminatedString { + return switch (nav.status) { + .unresolved => unreachable, + .type_resolved => |r| r.@"linksection", + .fully_resolved => |r| r.@"linksection", + }; + } + + /// Asserts that `status != .unresolved`. pub fn isThreadlocal(nav: Nav, ip: *const InternPool) bool { return switch (nav.status) { .unresolved => unreachable, @@ -620,21 +638,6 @@ pub const Nav = struct { }; } - /// Asserts that `status == .resolved`. - pub fn toExtern(nav: *const Nav, ip: *const InternPool) ?Key.Extern { - return switch (ip.indexToKey(nav.status.resolved.val)) { - .@"extern" => |ext| ext, - else => null, - }; - } - - /// Asserts that `status == .resolved`. - pub fn isThreadLocal(nav: Nav, ip: *const InternPool) bool { - const val = nav.status.resolved.val; - if (!isVariable(ip, val)) return false; - return ip.indexToKey(val).variable.is_threadlocal; - } - /// Get the ZIR instruction corresponding to this `Nav`, used to resolve source locations. /// This is a `declaration`. pub fn srcInst(nav: Nav, ip: *const InternPool) TrackedInst.Index { |
