mirror of
https://github.com/ziglang/zig.git
synced 2026-11-22 04:37:39 -05:00
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`
This commit is contained in:
1 parent
82ec56e47e
commit
4d6d6977b0
3 files changed
+63
-22
No files matched your search
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user