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 {...@@ -9072,14 +9072,6 @@ const GenZir = struct {
9072 return @intCast(u32, gz.decl_line + astgen.source_line);9072 return @intCast(u32, gz.decl_line + astgen.source_line);
9073 }9073 }
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
9083 fn nodeIndexToRelative(gz: GenZir, node_index: ast.Node.Index) i32 {9075 fn nodeIndexToRelative(gz: GenZir, node_index: ast.Node.Index) i32 {
9084 return @bitCast(i32, node_index) - @bitCast(i32, gz.decl_node_index);9076 return @bitCast(i32, node_index) - @bitCast(i32, gz.decl_node_index);
9085 }9077 }
src/clang_options_data.zig+7-1
...@@ -1,6 +1,12 @@...@@ -1,6 +1,12 @@
1// This file is generated by tools/update_clang_options.zig.1// This file is generated by tools/update_clang_options.zig.
2// zig fmt: off2// 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;
4pub const data = blk: { @setEvalBranchQuota(6000); break :blk &[_]CliArg{10pub const data = blk: { @setEvalBranchQuota(6000); break :blk &[_]CliArg{
5flagpd1("C"),11flagpd1("C"),
6flagpd1("CC"),12flagpd1("CC"),
src/codegen/spirv/spec.zig+2-2
...@@ -582,8 +582,8 @@ pub const Opcode = enum(u16) {...@@ -582,8 +582,8 @@ pub const Opcode = enum(u16) {
582 OpSpecConstantCompositeContinuedINTEL = 6092,582 OpSpecConstantCompositeContinuedINTEL = 6092,
583 _,583 _,
584584
585 const OpReportIntersectionKHR = OpReportIntersectionNV;585 const OpReportIntersectionKHR: Opcode = .OpReportIntersectionNV;
586 const OpTypeAccelerationStructureKHR = OpTypeAccelerationStructureNV;586 const OpTypeAccelerationStructureKHR: Opcode = .OpTypeAccelerationStructureNV;
587};587};
588pub const ImageOperands = packed struct {588pub const ImageOperands = packed struct {
589 Bias: bool align(@alignOf(u32)) = false,589 Bias: bool align(@alignOf(u32)) = false,
src/libc_installation.zig+3-3
...@@ -12,7 +12,7 @@ const is_haiku = Target.current.os.tag == .haiku;...@@ -12,7 +12,7 @@ const is_haiku = Target.current.os.tag == .haiku;
1212
13const log = std.log.scoped(.libc_installation);13const log = std.log.scoped(.libc_installation);
1414
15usingnamespace @import("windows_sdk.zig");15const ZigWindowsSDK = @import("windows_sdk.zig").ZigWindowsSDK;
1616
17/// See the render function implementation for documentation of the fields.17/// See the render function implementation for documentation of the fields.
18pub const LibCInstallation = struct {18pub const LibCInstallation = struct {
...@@ -183,9 +183,9 @@ pub const LibCInstallation = struct {...@@ -183,9 +183,9 @@ pub const LibCInstallation = struct {
183 if (!build_options.have_llvm)183 if (!build_options.have_llvm)
184 return error.WindowsSdkNotFound;184 return error.WindowsSdkNotFound;
185 var sdk: *ZigWindowsSDK = undefined;185 var sdk: *ZigWindowsSDK = undefined;
186 switch (zig_find_windows_sdk(&sdk)) {186 switch (ZigWindowsSDK.find(&sdk)) {
187 .None => {187 .None => {
188 defer zig_free_windows_sdk(sdk);188 defer sdk.free();
189189
190 var batch = Batch(FindError!void, 5, .auto_async).init();190 var batch = Batch(FindError!void, 5, .auto_async).init();
191 batch.add(&async self.findNativeMsvcIncludeDir(args, sdk));191 batch.add(&async self.findNativeMsvcIncludeDir(args, sdk));
src/link/MachO/DebugSymbols.zig+4-1
...@@ -20,7 +20,10 @@ const SrcFn = MachO.SrcFn;...@@ -20,7 +20,10 @@ const SrcFn = MachO.SrcFn;
20const TextBlock = MachO.TextBlock;20const TextBlock = MachO.TextBlock;
21const padToIdeal = MachO.padToIdeal;21const 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
25const page_size: u16 = 0x1000;28const page_size: u16 = 0x1000;
2629
src/link/tapi/parse/test.zig+2-2
...@@ -1,8 +1,8 @@...@@ -1,8 +1,8 @@
1const std = @import("std");1const std = @import("std");
2const mem = std.mem;2const mem = std.mem;
3const testing = std.testing;3const testing = std.testing;
44const Tree = @import("../parse.zig").Tree;
5usingnamespace @import("../parse.zig");5const Node = @import("../parse.zig").Node;
66
7test "explicit doc" {7test "explicit doc" {
8 const source =8 const source =
src/type.zig+1-1
...@@ -197,7 +197,7 @@ pub const Type = extern union {...@@ -197,7 +197,7 @@ pub const Type = extern union {
197 /// Prefer `castTag` to this.197 /// Prefer `castTag` to this.
198 pub fn cast(self: Type, comptime T: type) ?*T {198 pub fn cast(self: Type, comptime T: type) ?*T {
199 if (@hasField(T, "base_tag")) {199 if (@hasField(T, "base_tag")) {
200 return base.castTag(T.base_tag);200 return self.castTag(T.base_tag);
201 }201 }
202 if (self.tag_if_small_enough < Tag.no_payload_count) {202 if (self.tag_if_small_enough < Tag.no_payload_count) {
203 return null;203 return null;
src/value.zig+1-1
...@@ -315,7 +315,7 @@ pub const Value = extern union {...@@ -315,7 +315,7 @@ pub const Value = extern union {
315 /// Prefer `castTag` to this.315 /// Prefer `castTag` to this.
316 pub fn cast(self: Value, comptime T: type) ?*T {316 pub fn cast(self: Value, comptime T: type) ?*T {
317 if (@hasField(T, "base_tag")) {317 if (@hasField(T, "base_tag")) {
318 return base.castTag(T.base_tag);318 return self.castTag(T.base_tag);
319 }319 }
320 if (self.tag_if_small_enough < Tag.no_payload_count) {320 if (self.tag_if_small_enough < Tag.no_payload_count) {
321 return null;321 return null;
src/windows_sdk.zig+13-8
...@@ -11,12 +11,17 @@ pub const ZigWindowsSDK = extern struct {...@@ -11,12 +11,17 @@ pub const ZigWindowsSDK = extern struct {
11 version81_len: usize,11 version81_len: usize,
12 msvc_lib_dir_ptr: ?[*]const u8,12 msvc_lib_dir_ptr: ?[*]const u8,
13 msvc_lib_dir_len: usize,13 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;
14};27};
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 {...@@ -473,7 +473,13 @@ pub fn main() anyerror!void {
473 try stdout.writeAll(473 try stdout.writeAll(
474 \\// This file is generated by tools/update_clang_options.zig.474 \\// This file is generated by tools/update_clang_options.zig.
475 \\// zig fmt: off475 \\// 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;
477 \\pub const data = blk: { @setEvalBranchQuota(6000); break :blk &[_]CliArg{483 \\pub const data = blk: { @setEvalBranchQuota(6000); break :blk &[_]CliArg{
478 \\484 \\
479 );485 );