authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2020-08-18 10:54:54+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-18 19:47:20-04:00
log741fb8d30675f85316f7df100801e7cf8c2b3194
treea9fc6810c9fafe1bbc775c99e0ed1375654390ba
parent15bcfcd36865fca75b93dc6ce52c904292b62a81

stage2/link: clarify comments on calling order


1 files changed, 6 insertions(+), 1 deletions(-)

src-self-hosted/link.zig+6-1
...@@ -110,6 +110,8 @@ pub const File = struct {...@@ -110,6 +110,8 @@ pub const File = struct {
110 }110 }
111 }111 }
112112
113 /// May be called before or after updateDeclExports but must be called
114 /// after allocateDeclIndexes for any given Decl.
113 pub fn updateDecl(base: *File, module: *Module, decl: *Module.Decl) !void {115 pub fn updateDecl(base: *File, module: *Module, decl: *Module.Decl) !void {
114 switch (base.tag) {116 switch (base.tag) {
115 .elf => return @fieldParentPtr(Elf, "base", base).updateDecl(module, decl),117 .elf => return @fieldParentPtr(Elf, "base", base).updateDecl(module, decl),
...@@ -127,6 +129,8 @@ pub const File = struct {...@@ -127,6 +129,8 @@ pub const File = struct {
127 }129 }
128 }130 }
129131
132 /// Must be called before any call to updateDecl or updateDeclExports for
133 /// any given Decl.
130 pub fn allocateDeclIndexes(base: *File, decl: *Module.Decl) !void {134 pub fn allocateDeclIndexes(base: *File, decl: *Module.Decl) !void {
131 switch (base.tag) {135 switch (base.tag) {
132 .elf => return @fieldParentPtr(Elf, "base", base).allocateDeclIndexes(decl),136 .elf => return @fieldParentPtr(Elf, "base", base).allocateDeclIndexes(decl),
...@@ -200,7 +204,8 @@ pub const File = struct {...@@ -200,7 +204,8 @@ pub const File = struct {
200 };204 };
201 }205 }
202206
203 /// Must be called only after a successful call to `updateDecl`.207 /// May be called before or after updateDecl, but must be called after
208 /// allocateDeclIndexes for any given Decl.
204 pub fn updateDeclExports(209 pub fn updateDeclExports(
205 base: *File,210 base: *File,
206 module: *Module,211 module: *Module,