aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-10-02 16:25:15 -0400
committerGitHub <noreply@github.com>2021-10-02 16:25:15 -0400
commitac52e005640e9dc7829356f857a82b0bc3894245 (patch)
treeac2b5258254af857546337ccf63eabf36f036cdb /src/codegen
parent4916e26be434309209585a7c8a7918ed58c79466 (diff)
parent1d2c3af90627fd2b5ffdd3a9c5f96fd73dddb2d5 (diff)
downloadzig-ac52e005640e9dc7829356f857a82b0bc3894245.tar.gz
zig-ac52e005640e9dc7829356f857a82b0bc3894245.zip
Merge pull request #9873 from SpexGuy/fix-struct-namespaces
Stage 2: A bunch of cleaning up
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/c.zig4
-rw-r--r--src/codegen/llvm.zig4
-rw-r--r--src/codegen/spirv.zig4
-rw-r--r--src/codegen/wasm.zig2
4 files changed, 7 insertions, 7 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index d2ce9cc6de..8ba43b3125 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -246,7 +246,7 @@ pub const DeclGen = struct {
fn fail(dg: *DeclGen, comptime format: []const u8, args: anytype) error{ AnalysisFail, OutOfMemory } {
@setCold(true);
const src: LazySrcLoc = .{ .node_offset = 0 };
- const src_loc = src.toSrcLocWithDecl(dg.decl);
+ const src_loc = src.toSrcLoc(dg.decl);
dg.error_msg = try Module.ErrorMsg.create(dg.module.gpa, src_loc, format, args);
return error.AnalysisFail;
}
@@ -1696,7 +1696,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index) !CValue {
fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue {
const air_datas = f.air.instructions.items(.data);
const air_extra = f.air.extraData(Air.Asm, air_datas[inst].ty_pl.payload);
- const zir = f.object.dg.decl.namespace.file_scope.zir;
+ const zir = f.object.dg.decl.getFileScope().zir;
const extended = zir.instructions.items(.data)[air_extra.data.zir_index].extended;
const zir_extra = zir.extraData(Zir.Inst.Asm, extended.operand);
const asm_source = zir.nullTerminatedString(zir_extra.data.asm_source);
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 98e12f5430..761dd2a8bc 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -557,7 +557,7 @@ pub const DeclGen = struct {
fn todo(self: *DeclGen, comptime format: []const u8, args: anytype) error{ OutOfMemory, CodegenFail } {
@setCold(true);
assert(self.err_msg == null);
- const src_loc = @as(LazySrcLoc, .{ .node_offset = 0 }).toSrcLocWithDecl(self.decl);
+ const src_loc = @as(LazySrcLoc, .{ .node_offset = 0 }).toSrcLoc(self.decl);
self.err_msg = try Module.ErrorMsg.create(self.gpa, src_loc, "TODO (LLVM): " ++ format, args);
return error.CodegenFail;
}
@@ -1819,7 +1819,7 @@ pub const FuncGen = struct {
const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
const air_asm = self.air.extraData(Air.Asm, ty_pl.payload);
- const zir = self.dg.decl.namespace.file_scope.zir;
+ const zir = self.dg.decl.getFileScope().zir;
const extended = zir.instructions.items(.data)[air_asm.data.zir_index].extended;
const zir_extra = zir.extraData(Zir.Inst.Asm, extended.operand);
const asm_source = zir.nullTerminatedString(zir_extra.data.asm_source);
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index 5826daa5a5..25a1d228e0 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -139,7 +139,7 @@ pub const SPIRVModule = struct {
}
fn resolveSourceFileName(self: *SPIRVModule, decl: *Decl) !ResultId {
- const path = decl.namespace.file_scope.sub_file_path;
+ const path = decl.getFileScope().sub_file_path;
const result = try self.file_names.getOrPut(path);
if (!result.found_existing) {
result.value_ptr.* = self.allocResultId();
@@ -295,7 +295,7 @@ pub const DeclGen = struct {
fn fail(self: *DeclGen, comptime format: []const u8, args: anytype) Error {
@setCold(true);
const src: LazySrcLoc = .{ .node_offset = 0 };
- const src_loc = src.toSrcLocWithDecl(self.decl);
+ const src_loc = src.toSrcLoc(self.decl);
self.error_msg = try Module.ErrorMsg.create(self.spv.module.gpa, src_loc, format, args);
return error.AnalysisFail;
}
diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig
index 9bd80f7d84..6902553257 100644
--- a/src/codegen/wasm.zig
+++ b/src/codegen/wasm.zig
@@ -540,7 +540,7 @@ pub const Context = struct {
/// Sets `err_msg` on `Context` and returns `error.CodegemFail` which is caught in link/Wasm.zig
fn fail(self: *Context, comptime fmt: []const u8, args: anytype) InnerError {
const src: LazySrcLoc = .{ .node_offset = 0 };
- const src_loc = src.toSrcLocWithDecl(self.decl);
+ const src_loc = src.toSrcLoc(self.decl);
self.err_msg = try Module.ErrorMsg.create(self.gpa, src_loc, fmt, args);
return error.CodegenFail;
}