diff --git a/src/AstGen.zig b/src/AstGen.zig index c96a97ddeb..570b2cd943 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -9072,14 +9072,6 @@ const GenZir = struct { 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 { return @bitCast(i32, node_index) - @bitCast(i32, gz.decl_node_index); } diff --git a/src/clang_options_data.zig b/src/clang_options_data.zig index eb8dfc5753..524374a7e9 100644 --- a/src/clang_options_data.zig +++ b/src/clang_options_data.zig @@ -1,6 +1,12 @@ // This file is generated by tools/update_clang_options.zig. // 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{ flagpd1("C"), flagpd1("CC"), diff --git a/src/codegen/spirv/spec.zig b/src/codegen/spirv/spec.zig index 429ed63d23..26d1925646 100644 --- a/src/codegen/spirv/spec.zig +++ b/src/codegen/spirv/spec.zig @@ -582,8 +582,8 @@ pub const Opcode = enum(u16) { OpSpecConstantCompositeContinuedINTEL = 6092, _, - const OpReportIntersectionKHR = OpReportIntersectionNV; - const OpTypeAccelerationStructureKHR = OpTypeAccelerationStructureNV; + const OpReportIntersectionKHR: Opcode = .OpReportIntersectionNV; + const OpTypeAccelerationStructureKHR: Opcode = .OpTypeAccelerationStructureNV; }; pub const ImageOperands = packed struct { Bias: bool align(@alignOf(u32)) = false, diff --git a/src/libc_installation.zig b/src/libc_installation.zig index b639e0f2f8..c011abbfcc 100644 --- a/src/libc_installation.zig +++ b/src/libc_installation.zig @@ -12,7 +12,7 @@ const is_haiku = Target.current.os.tag == .haiku; 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. pub const LibCInstallation = struct { @@ -183,9 +183,9 @@ pub const LibCInstallation = struct { if (!build_options.have_llvm) return error.WindowsSdkNotFound; var sdk: *ZigWindowsSDK = undefined; - switch (zig_find_windows_sdk(&sdk)) { + switch (ZigWindowsSDK.find(&sdk)) { .None => { - defer zig_free_windows_sdk(sdk); + defer sdk.free(); var batch = Batch(FindError!void, 5, .auto_async).init(); batch.add(&async self.findNativeMsvcIncludeDir(args, sdk)); diff --git a/src/link/MachO/DebugSymbols.zig b/src/link/MachO/DebugSymbols.zig index 5f7b119bdc..ee99adafaa 100644 --- a/src/link/MachO/DebugSymbols.zig +++ b/src/link/MachO/DebugSymbols.zig @@ -20,7 +20,10 @@ const SrcFn = MachO.SrcFn; const TextBlock = MachO.TextBlock; 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; diff --git a/src/link/tapi/parse/test.zig b/src/link/tapi/parse/test.zig index b96a71fe97..fc0bed5df6 100644 --- a/src/link/tapi/parse/test.zig +++ b/src/link/tapi/parse/test.zig @@ -1,8 +1,8 @@ const std = @import("std"); const mem = std.mem; const testing = std.testing; - -usingnamespace @import("../parse.zig"); +const Tree = @import("../parse.zig").Tree; +const Node = @import("../parse.zig").Node; test "explicit doc" { const source = diff --git a/src/type.zig b/src/type.zig index aa4517ab05..b6602ba18d 100644 --- a/src/type.zig +++ b/src/type.zig @@ -197,7 +197,7 @@ pub const Type = extern union { /// Prefer `castTag` to this. pub fn cast(self: Type, comptime T: type) ?*T { 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) { return null; diff --git a/src/value.zig b/src/value.zig index 5ac9f142c4..8aaf70c428 100644 --- a/src/value.zig +++ b/src/value.zig @@ -315,7 +315,7 @@ pub const Value = extern union { /// Prefer `castTag` to this. pub fn cast(self: Value, comptime T: type) ?*T { 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) { return null; diff --git a/src/windows_sdk.zig b/src/windows_sdk.zig index ca69ff4548..3ff53dc2e1 100644 --- a/src/windows_sdk.zig +++ b/src/windows_sdk.zig @@ -11,12 +11,17 @@ pub const ZigWindowsSDK = extern struct { version81_len: usize, msvc_lib_dir_ptr: ?[*]const u8, 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; diff --git a/tools/update_clang_options.zig b/tools/update_clang_options.zig index 04cdbf44de..407e813ef3 100644 --- a/tools/update_clang_options.zig +++ b/tools/update_clang_options.zig @@ -473,7 +473,13 @@ pub fn main() anyerror!void { try stdout.writeAll( \\// This file is generated by tools/update_clang_options.zig. \\// 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{ \\ );