mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
stage2: update for new usingnamespace semantics
This commit is contained in:
parent
a2ff3a13fe
commit
e41e75a486
@ -9072,14 +9072,6 @@ const GenZir = struct {
|
|||||||
return @intCast(u32, gz.decl_line + astgen.source_line);
|
return @intCast(u32, gz.decl_line + astgen.source_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tokSrcLoc(gz: GenZir, token_index: ast.TokenIndex) LazySrcLoc {
|
|
||||||
return .{ .token_offset = token_index - gz.srcToken() };
|
|
||||||
}
|
|
||||||
|
|
||||||
fn nodeSrcLoc(gz: GenZir, node_index: ast.Node.Index) LazySrcLoc {
|
|
||||||
return .{ .node_offset = gz.nodeIndexToRelative(node_index) };
|
|
||||||
}
|
|
||||||
|
|
||||||
fn nodeIndexToRelative(gz: GenZir, node_index: ast.Node.Index) i32 {
|
fn nodeIndexToRelative(gz: GenZir, node_index: ast.Node.Index) i32 {
|
||||||
return @bitCast(i32, node_index) - @bitCast(i32, gz.decl_node_index);
|
return @bitCast(i32, node_index) - @bitCast(i32, gz.decl_node_index);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
// This file is generated by tools/update_clang_options.zig.
|
// This file is generated by tools/update_clang_options.zig.
|
||||||
// zig fmt: off
|
// zig fmt: off
|
||||||
usingnamespace @import("clang_options.zig");
|
const clang_options = @import("clang_options.zig");
|
||||||
|
const CliArg = clang_options.CliArg;
|
||||||
|
const flagpd1 = clang_options.flagpd1;
|
||||||
|
const flagpsl = clang_options.flagpsl;
|
||||||
|
const joinpd1 = clang_options.joinpd1;
|
||||||
|
const jspd1 = clang_options.jspd1;
|
||||||
|
const sepd1 = clang_options.sepd1;
|
||||||
pub const data = blk: { @setEvalBranchQuota(6000); break :blk &[_]CliArg{
|
pub const data = blk: { @setEvalBranchQuota(6000); break :blk &[_]CliArg{
|
||||||
flagpd1("C"),
|
flagpd1("C"),
|
||||||
flagpd1("CC"),
|
flagpd1("CC"),
|
||||||
|
|||||||
@ -582,8 +582,8 @@ pub const Opcode = enum(u16) {
|
|||||||
OpSpecConstantCompositeContinuedINTEL = 6092,
|
OpSpecConstantCompositeContinuedINTEL = 6092,
|
||||||
_,
|
_,
|
||||||
|
|
||||||
const OpReportIntersectionKHR = OpReportIntersectionNV;
|
const OpReportIntersectionKHR: Opcode = .OpReportIntersectionNV;
|
||||||
const OpTypeAccelerationStructureKHR = OpTypeAccelerationStructureNV;
|
const OpTypeAccelerationStructureKHR: Opcode = .OpTypeAccelerationStructureNV;
|
||||||
};
|
};
|
||||||
pub const ImageOperands = packed struct {
|
pub const ImageOperands = packed struct {
|
||||||
Bias: bool align(@alignOf(u32)) = false,
|
Bias: bool align(@alignOf(u32)) = false,
|
||||||
|
|||||||
@ -12,7 +12,7 @@ const is_haiku = Target.current.os.tag == .haiku;
|
|||||||
|
|
||||||
const log = std.log.scoped(.libc_installation);
|
const log = std.log.scoped(.libc_installation);
|
||||||
|
|
||||||
usingnamespace @import("windows_sdk.zig");
|
const ZigWindowsSDK = @import("windows_sdk.zig").ZigWindowsSDK;
|
||||||
|
|
||||||
/// See the render function implementation for documentation of the fields.
|
/// See the render function implementation for documentation of the fields.
|
||||||
pub const LibCInstallation = struct {
|
pub const LibCInstallation = struct {
|
||||||
@ -183,9 +183,9 @@ pub const LibCInstallation = struct {
|
|||||||
if (!build_options.have_llvm)
|
if (!build_options.have_llvm)
|
||||||
return error.WindowsSdkNotFound;
|
return error.WindowsSdkNotFound;
|
||||||
var sdk: *ZigWindowsSDK = undefined;
|
var sdk: *ZigWindowsSDK = undefined;
|
||||||
switch (zig_find_windows_sdk(&sdk)) {
|
switch (ZigWindowsSDK.find(&sdk)) {
|
||||||
.None => {
|
.None => {
|
||||||
defer zig_free_windows_sdk(sdk);
|
defer sdk.free();
|
||||||
|
|
||||||
var batch = Batch(FindError!void, 5, .auto_async).init();
|
var batch = Batch(FindError!void, 5, .auto_async).init();
|
||||||
batch.add(&async self.findNativeMsvcIncludeDir(args, sdk));
|
batch.add(&async self.findNativeMsvcIncludeDir(args, sdk));
|
||||||
|
|||||||
@ -20,7 +20,10 @@ const SrcFn = MachO.SrcFn;
|
|||||||
const TextBlock = MachO.TextBlock;
|
const TextBlock = MachO.TextBlock;
|
||||||
const padToIdeal = MachO.padToIdeal;
|
const padToIdeal = MachO.padToIdeal;
|
||||||
|
|
||||||
usingnamespace @import("commands.zig");
|
const commands = @import("commands.zig");
|
||||||
|
const emptyHeader = commands.emptyHeader;
|
||||||
|
const LoadCommand = commands.LoadCommand;
|
||||||
|
const SegmentCommand = commands.SegmentCommand;
|
||||||
|
|
||||||
const page_size: u16 = 0x1000;
|
const page_size: u16 = 0x1000;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const mem = std.mem;
|
const mem = std.mem;
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
|
const Tree = @import("../parse.zig").Tree;
|
||||||
usingnamespace @import("../parse.zig");
|
const Node = @import("../parse.zig").Node;
|
||||||
|
|
||||||
test "explicit doc" {
|
test "explicit doc" {
|
||||||
const source =
|
const source =
|
||||||
|
|||||||
@ -197,7 +197,7 @@ pub const Type = extern union {
|
|||||||
/// Prefer `castTag` to this.
|
/// Prefer `castTag` to this.
|
||||||
pub fn cast(self: Type, comptime T: type) ?*T {
|
pub fn cast(self: Type, comptime T: type) ?*T {
|
||||||
if (@hasField(T, "base_tag")) {
|
if (@hasField(T, "base_tag")) {
|
||||||
return base.castTag(T.base_tag);
|
return self.castTag(T.base_tag);
|
||||||
}
|
}
|
||||||
if (self.tag_if_small_enough < Tag.no_payload_count) {
|
if (self.tag_if_small_enough < Tag.no_payload_count) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -315,7 +315,7 @@ pub const Value = extern union {
|
|||||||
/// Prefer `castTag` to this.
|
/// Prefer `castTag` to this.
|
||||||
pub fn cast(self: Value, comptime T: type) ?*T {
|
pub fn cast(self: Value, comptime T: type) ?*T {
|
||||||
if (@hasField(T, "base_tag")) {
|
if (@hasField(T, "base_tag")) {
|
||||||
return base.castTag(T.base_tag);
|
return self.castTag(T.base_tag);
|
||||||
}
|
}
|
||||||
if (self.tag_if_small_enough < Tag.no_payload_count) {
|
if (self.tag_if_small_enough < Tag.no_payload_count) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -11,12 +11,17 @@ pub const ZigWindowsSDK = extern struct {
|
|||||||
version81_len: usize,
|
version81_len: usize,
|
||||||
msvc_lib_dir_ptr: ?[*]const u8,
|
msvc_lib_dir_ptr: ?[*]const u8,
|
||||||
msvc_lib_dir_len: usize,
|
msvc_lib_dir_len: usize,
|
||||||
|
|
||||||
|
pub const find = zig_find_windows_sdk;
|
||||||
|
pub const free = zig_free_windows_sdk;
|
||||||
|
|
||||||
|
pub const FindError = enum(c_int) {
|
||||||
|
None,
|
||||||
|
OutOfMemory,
|
||||||
|
NotFound,
|
||||||
|
PathTooLong,
|
||||||
|
};
|
||||||
|
|
||||||
|
extern fn zig_find_windows_sdk(out_sdk: **ZigWindowsSDK) FindError;
|
||||||
|
extern fn zig_free_windows_sdk(sdk: *ZigWindowsSDK) void;
|
||||||
};
|
};
|
||||||
pub const ZigFindWindowsSdkError = enum(c_int) {
|
|
||||||
None,
|
|
||||||
OutOfMemory,
|
|
||||||
NotFound,
|
|
||||||
PathTooLong,
|
|
||||||
};
|
|
||||||
pub extern fn zig_find_windows_sdk(out_sdk: **ZigWindowsSDK) ZigFindWindowsSdkError;
|
|
||||||
pub extern fn zig_free_windows_sdk(sdk: *ZigWindowsSDK) void;
|
|
||||||
|
|||||||
@ -473,7 +473,13 @@ pub fn main() anyerror!void {
|
|||||||
try stdout.writeAll(
|
try stdout.writeAll(
|
||||||
\\// This file is generated by tools/update_clang_options.zig.
|
\\// This file is generated by tools/update_clang_options.zig.
|
||||||
\\// zig fmt: off
|
\\// zig fmt: off
|
||||||
\\usingnamespace @import("clang_options.zig");
|
\\const clang_options = @import("clang_options.zig");
|
||||||
|
\\const CliArg = clang_options.CliArg;
|
||||||
|
\\const flagpd1 = clang_options.flagpd1;
|
||||||
|
\\const flagpsl = clang_options.flagpsl;
|
||||||
|
\\const joinpd1 = clang_options.joinpd1;
|
||||||
|
\\const jspd1 = clang_options.jspd1;
|
||||||
|
\\const sepd1 = clang_options.sepd1;
|
||||||
\\pub const data = blk: { @setEvalBranchQuota(6000); break :blk &[_]CliArg{
|
\\pub const data = blk: { @setEvalBranchQuota(6000); break :blk &[_]CliArg{
|
||||||
\\
|
\\
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user