diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-10-16 12:26:06 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-10-16 12:26:06 -0700 |
| commit | 4d6d6977b05571e6d164dbf5f26c7a48ee3541a3 (patch) | |
| tree | beb25554dc6e6f9f238ee84d0096f89a557f4ea5 /src/Module.zig | |
| parent | 82ec56e47e004176cc380cc69764602c4a8d0768 (diff) | |
| download | zig-4d6d6977b05571e6d164dbf5f26c7a48ee3541a3.tar.gz zig-4d6d6977b05571e6d164dbf5f26c7a48ee3541a3.zip | |
stage2: fixes to extern variables
* Relax compile error for "unable to export type foo" to allow
integers, structs, arrays, and floats. This will need to be further
improved to do the same checks as we do for C ABI struct field types.
* LLVM backend: fix extern variables
* LLVM backend: implement AIR instruction `wrap_err_union_payload`
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig index 43c0178863..a42ec3c2e1 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -754,6 +754,15 @@ pub const Decl = struct { fn removeDependency(decl: *Decl, other: *Decl) void { assert(decl.dependencies.swapRemove(other)); } + + pub fn isExtern(decl: Decl) bool { + assert(decl.has_tv); + return switch (decl.val.tag()) { + .extern_fn => true, + .variable => decl.val.castTag(.variable).?.data.init.tag() == .unreachable_value, + else => false, + }; + } }; /// This state is attached to every Decl when Module emit_h is non-null. |
