authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-08-30 18:47:00-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-09-01 17:54:07-07:00
loge41e75a4862e955266a7e760133ea757e5afb8ce
tree03dcceb5e2cdf88289040cc8b37c79c58f0a0a4c
parenta2ff3a13fe22b5693bbd719bf4eaee06a9d6be57

stage2: update for new usingnamespace semantics


10 files changed, 40 insertions(+), 28 deletions(-)

src/AstGen.zig-8
......@@ -9072,14 +9072,6 @@ const GenZir = struct {
90729072 return @intCast(u32, gz.decl_line + astgen.source_line);
90739073 }
90749074
9075 fn tokSrcLoc(gz: GenZir, token_index: ast.TokenIndex) LazySrcLoc {
9076 return .{ .token_offset = token_index - gz.srcToken() };
9077 }
9078
9079 fn nodeSrcLoc(gz: GenZir, node_index: ast.Node.Index) LazySrcLoc {
9080 return .{ .node_offset = gz.nodeIndexToRelative(node_index) };
9081 }
9082
90839075 fn nodeIndexToRelative(gz: GenZir, node_index: ast.Node.Index) i32 {
90849076 return @bitCast(i32, node_index) - @bitCast(i32, gz.decl_node_index);
90859077 }
src/clang_options_data.zig+7-1
......@@ -1,6 +1,12 @@
11// This file is generated by tools/update_clang_options.zig.
22// zig fmt: off
3usingnamespace @import("clang_options.zig");
3const clang_options = @import("clang_options.zig");
4const CliArg = clang_options.CliArg;
5const flagpd1 = clang_options.flagpd1;
6const flagpsl = clang_options.flagpsl;
7const joinpd1 = clang_options.joinpd1;
8const jspd1 = clang_options.jspd1;
9const sepd1 = clang_options.sepd1;
410pub const data = blk: { @setEvalBranchQuota(6000); break :blk &[_]CliArg{
511flagpd1("C"),
612flagpd1("CC"),
src/codegen/spirv/spec.zig+2-2
......@@ -582,8 +582,8 @@ pub const Opcode = enum(u16) {
582582 OpSpecConstantCompositeContinuedINTEL = 6092,
583583 _,
584584
585 const OpReportIntersectionKHR = OpReportIntersectionNV;
586 const OpTypeAccelerationStructureKHR = OpTypeAccelerationStructureNV;
585 const OpReportIntersectionKHR: Opcode = .OpReportIntersectionNV;
586 const OpTypeAccelerationStructureKHR: Opcode = .OpTypeAccelerationStructureNV;
587587};
588588pub const ImageOperands = packed struct {
589589 Bias: bool align(@alignOf(u32)) = false,
src/libc_installation.zig+3-3
......@@ -12,7 +12,7 @@ const is_haiku = Target.current.os.tag == .haiku;
1212
1313const log = std.log.scoped(.libc_installation);
1414
15usingnamespace @import("windows_sdk.zig");
15const ZigWindowsSDK = @import("windows_sdk.zig").ZigWindowsSDK;
1616
1717/// See the render function implementation for documentation of the fields.
1818pub const LibCInstallation = struct {
......@@ -183,9 +183,9 @@ pub const LibCInstallation = struct {
183183 if (!build_options.have_llvm)
184184 return error.WindowsSdkNotFound;
185185 var sdk: *ZigWindowsSDK = undefined;
186 switch (zig_find_windows_sdk(&sdk)) {
186 switch (ZigWindowsSDK.find(&sdk)) {
187187 .None => {
188 defer zig_free_windows_sdk(sdk);
188 defer sdk.free();
189189
190190 var batch = Batch(FindError!void, 5, .auto_async).init();
191191 batch.add(&async self.findNativeMsvcIncludeDir(args, sdk));
src/link/MachO/DebugSymbols.zig+4-1
......@@ -20,7 +20,10 @@ const SrcFn = MachO.SrcFn;
2020const TextBlock = MachO.TextBlock;
2121const padToIdeal = MachO.padToIdeal;
2222
23usingnamespace @import("commands.zig");
23const commands = @import("commands.zig");
24const emptyHeader = commands.emptyHeader;
25const LoadCommand = commands.LoadCommand;
26const SegmentCommand = commands.SegmentCommand;
2427
2528const page_size: u16 = 0x1000;
2629
src/link/tapi/parse/test.zig+2-2
......@@ -1,8 +1,8 @@
11const std = @import("std");
22const mem = std.mem;
33const testing = std.testing;
4
5usingnamespace @import("../parse.zig");
4const Tree = @import("../parse.zig").Tree;
5const Node = @import("../parse.zig").Node;
66
77test "explicit doc" {
88 const source =
src/type.zig+1-1
......@@ -197,7 +197,7 @@ pub const Type = extern union {
197197 /// Prefer `castTag` to this.
198198 pub fn cast(self: Type, comptime T: type) ?*T {
199199 if (@hasField(T, "base_tag")) {
200 return base.castTag(T.base_tag);
200 return self.castTag(T.base_tag);
201201 }
202202 if (self.tag_if_small_enough < Tag.no_payload_count) {
203203 return null;
src/value.zig+1-1
......@@ -315,7 +315,7 @@ pub const Value = extern union {
315315 /// Prefer `castTag` to this.
316316 pub fn cast(self: Value, comptime T: type) ?*T {
317317 if (@hasField(T, "base_tag")) {
318 return base.castTag(T.base_tag);
318 return self.castTag(T.base_tag);
319319 }
320320 if (self.tag_if_small_enough < Tag.no_payload_count) {
321321 return null;
src/windows_sdk.zig+13-8
......@@ -11,12 +11,17 @@ pub const ZigWindowsSDK = extern struct {
1111 version81_len: usize,
1212 msvc_lib_dir_ptr: ?[*]const u8,
1313 msvc_lib_dir_len: usize,
14
15 pub const find = zig_find_windows_sdk;
16 pub const free = zig_free_windows_sdk;
17
18 pub const FindError = enum(c_int) {
19 None,
20 OutOfMemory,
21 NotFound,
22 PathTooLong,
23 };
24
25 extern fn zig_find_windows_sdk(out_sdk: **ZigWindowsSDK) FindError;
26 extern fn zig_free_windows_sdk(sdk: *ZigWindowsSDK) void;
1427};
15pub const ZigFindWindowsSdkError = enum(c_int) {
16 None,
17 OutOfMemory,
18 NotFound,
19 PathTooLong,
20};
21pub extern fn zig_find_windows_sdk(out_sdk: **ZigWindowsSDK) ZigFindWindowsSdkError;
22pub extern fn zig_free_windows_sdk(sdk: *ZigWindowsSDK) void;
tools/update_clang_options.zig+7-1
......@@ -473,7 +473,13 @@ pub fn main() anyerror!void {
473473 try stdout.writeAll(
474474 \\// This file is generated by tools/update_clang_options.zig.
475475 \\// zig fmt: off
476 \\usingnamespace @import("clang_options.zig");
476 \\const clang_options = @import("clang_options.zig");
477 \\const CliArg = clang_options.CliArg;
478 \\const flagpd1 = clang_options.flagpd1;
479 \\const flagpsl = clang_options.flagpsl;
480 \\const joinpd1 = clang_options.joinpd1;
481 \\const jspd1 = clang_options.jspd1;
482 \\const sepd1 = clang_options.sepd1;
477483 \\pub const data = blk: { @setEvalBranchQuota(6000); break :blk &[_]CliArg{
478484 \\
479485 );