stage2: update for new usingnamespace semantics

This commit is contained in:
Andrew Kelley 2021-08-30 18:47:00 -07:00
parent a2ff3a13fe
commit e41e75a486
10 changed files with 40 additions and 28 deletions

View File

@ -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);
}

View File

@ -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"),

View File

@ -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,

View File

@ -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));

View File

@ -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;

View File

@ -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 =

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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{
\\
);