Commit 7a24334199

Vexu <15308111+Vexu@users.noreply.github.com>
2019-11-07 09:05:29
self hosted compiler: small fixes to imports and declarations
1 parent c6076a1
src-self-hosted/c_int.zig
@@ -68,11 +68,11 @@ pub const CInt = struct {
         },
     };
 
-    pub fn sizeInBits(id: Id, self: Target) u32 {
+    pub fn sizeInBits(cint: CInt, self: Target) u32 {
         const arch = self.getArch();
         switch (self.getOs()) {
             .freestanding => switch (self.getArch()) {
-                .msp430 => switch (id) {
+                .msp430 => switch (cint.id) {
                     .Short,
                     .UShort,
                     .Int,
@@ -85,7 +85,7 @@ pub const CInt = struct {
                     .ULongLong,
                     => return 64,
                 },
-                else => switch (id) {
+                else => switch (cint.id) {
                     .Short,
                     .UShort,
                     => return 16,
@@ -106,7 +106,7 @@ pub const CInt = struct {
             .freebsd,
             .openbsd,
             .zen,
-            => switch (id) {
+            => switch (cint.id) {
                 .Short,
                 .UShort,
                 => return 16,
@@ -121,7 +121,7 @@ pub const CInt = struct {
                 => return 64,
             },
 
-            .windows, .uefi => switch (id) {
+            .windows, .uefi => switch (cint.id) {
                 .Short,
                 .UShort,
                 => return 16,
src-self-hosted/libc_installation.zig
@@ -2,7 +2,7 @@ const std = @import("std");
 const builtin = @import("builtin");
 const event = std.event;
 const target = @import("target.zig");
-const Target = target.Target;
+const Target = std.Target;
 const c = @import("c.zig");
 const fs = std.fs;
 const Allocator = std.mem.Allocator;
@@ -322,7 +322,7 @@ pub const LibCInstallation = struct {
             },
         };
         var group = event.Group(FindError!void).init(allocator);
-        errdefer group.deinit();
+        errdefer group.wait() catch {};
         for (dyn_tests) |*dyn_test| {
             try group.call(testNativeDynamicLinker, self, allocator, dyn_test);
         }
src-self-hosted/llvm.zig
@@ -309,7 +309,7 @@ pub fn initializeAllTargets() void {
     InitializeAllAsmParsers();
 }
 
-pub fn getTriple(allocator: *std.mem.Allocator, self: Target) !std.Buffer {
+pub fn getTriple(allocator: *std.mem.Allocator, self: std.Target) !std.Buffer {
     var result = try std.Buffer.initSize(allocator, 0);
     errdefer result.deinit();
 
src-self-hosted/target.zig
@@ -1,3 +1,4 @@
+const Target = @import("std").Target;
 // const builtin = @import("builtin");
 
 pub const FloatAbi = enum {
@@ -55,7 +56,7 @@ pub fn getDynamicLinkerPath(self: Target) ?[]const u8 {
         .linux => {
             switch (env) {
                 .android => {
-                    if (is64bit(self)) {
+                    if (self.getArchPtrBitWidth() == 64) {
                         return "/system/bin/linker64";
                     } else {
                         return "/system/bin/linker";
src-self-hosted/type.zig
@@ -294,7 +294,7 @@ pub const Type = struct {
                 if (self.alignment) |self_align| {
                     if (self_align != other.alignment.?) return false;
                 }
-                if (self.data != other.data) return false;
+                if (@TagType(Data)(self.data) != @TagType(Data)(other.data)) return false;
                 switch (self.data) {
                     .Generic => |*self_generic| {
                         const other_generic = &other.data.Generic;
@@ -341,7 +341,7 @@ pub const Type = struct {
             }
         };
 
-        const CallingConvention = builtin.CallingConvention;
+        const CallingConvention = builtin.TypeInfo.CallingConvention;
 
         pub const Param = struct {
             is_noalias: bool,