stage2: get rid of failed_root_src_file

This commit is contained in:
Andrew Kelley 2021-05-17 15:29:06 -07:00
parent ab6b0ad8a4
commit d5e894a9a7
3 changed files with 11 additions and 23 deletions

View File

@ -1,17 +1,8 @@
* modify stage2 CBE tests so that only 1 uses pub export main and the
rest use pub fn main
* get the test runner and `zig test` working
* get behavior tests passing for stage2
* use a hash map for instructions because the array is too big
- no, actually modify the Zir.Inst.Ref strategy so that each decl gets
their indexes starting at 0 so that we can use an array to store Sema
results rather than a map.
* implement the new AstGen compile errors
* get rid of failed_root_src_file
* get rid of Scope.DeclRef
* get rid of NameHash
* handle decl collision with usingnamespace
@ -68,3 +59,13 @@
* repl: if you try `run` with -ofmt=c you get an access denied error because it
tries to execute the .c file as a child process instead of executing `zig run`
on it.
=== file issues: ===
* C backend: honor the exported symbol name. Right now if you do `pub fn main`
it generates bogus C code because the `@export` name is not honored, and it allows
the `main` which should be not exported, to clobber the exported symbol name.
* get the test runner and `zig test` working
- get behavior tests passing for stage2

View File

@ -1681,8 +1681,7 @@ pub fn totalErrorCount(self: *Compilation) usize {
var total: usize = self.failed_c_objects.count() + self.misc_failures.count();
if (self.bin_file.options.module) |module| {
total += module.failed_exports.items().len +
@boolToInt(module.failed_root_src_file != null);
total += module.failed_exports.items().len;
for (module.failed_files.items()) |entry| {
if (entry.value) |_| {
@ -1789,15 +1788,6 @@ pub fn getAllErrorsAlloc(self: *Compilation) !AllErrors {
for (module.failed_exports.items()) |entry| {
try AllErrors.add(module, &arena, &errors, entry.value.*);
}
if (module.failed_root_src_file) |err| {
const file_path = try module.root_pkg.root_src_directory.join(&arena.allocator, &[_][]const u8{
module.root_pkg.root_src_path,
});
const msg = try std.fmt.allocPrint(&arena.allocator, "unable to read {s}: {s}", .{
file_path, @errorName(err),
});
try AllErrors.addPlain(&arena, &errors, msg);
}
}
if (errors.items.len == 0 and self.link_error_flags.no_entry_point_found) {

View File

@ -92,9 +92,6 @@ error_name_list: ArrayListUnmanaged([]const u8) = .{},
/// previous analysis.
generation: u32 = 0,
/// When populated it means there was an error opening/reading the root source file.
failed_root_src_file: ?anyerror = null,
stage1_flags: packed struct {
have_winmain: bool = false,
have_wwinmain: bool = false,