cbe: fix pointers to aliases of extern values
This commit is contained in:
committed by
Andrew Kelley
parent
11695745e5
commit
70c71935c7
@@ -888,15 +888,19 @@ pub const Decl = struct {
|
||||
assert(decl.dependencies.swapRemove(other));
|
||||
}
|
||||
|
||||
pub fn isExtern(decl: Decl, mod: *Module) bool {
|
||||
pub fn getExternDecl(decl: Decl, mod: *Module) OptionalIndex {
|
||||
assert(decl.has_tv);
|
||||
return switch (mod.intern_pool.indexToKey(decl.val.toIntern())) {
|
||||
.variable => |variable| variable.is_extern,
|
||||
.extern_func => true,
|
||||
else => false,
|
||||
.variable => |variable| if (variable.is_extern) variable.decl.toOptional() else .none,
|
||||
.extern_func => |extern_func| extern_func.decl.toOptional(),
|
||||
else => .none,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn isExtern(decl: Decl, mod: *Module) bool {
|
||||
return decl.getExternDecl(mod) != .none;
|
||||
}
|
||||
|
||||
pub fn getAlignment(decl: Decl, mod: *Module) u32 {
|
||||
assert(decl.has_tv);
|
||||
return @as(u32, @intCast(decl.alignment.toByteUnitsOptional() orelse decl.ty.abiAlignment(mod)));
|
||||
|
||||
Reference in New Issue
Block a user