Commit a475877007

Andrew Kelley <andrew@ziglang.org>
2020-01-31 00:43:54
fix translate-c regression
clang.zig had incorrect enum for builtin types
1 parent c5df0b3
Changed files (3)
lib
std
src-self-hosted
lib/std/zig/ast.zig
@@ -10,10 +10,14 @@ pub const TokenIndex = usize;
 pub const Tree = struct {
     source: []const u8,
     tokens: TokenList,
+
     /// undefined on parse error (errors not empty)
     root_node: *Node.Root,
     arena_allocator: std.heap.ArenaAllocator,
     errors: ErrorList,
+
+    /// translate-c uses this to avoid having to emit correct newlines
+    /// TODO get rid of this hack
     generated: bool = false,
 
     pub const TokenList = SegmentedList(Token, 64);
src-self-hosted/clang.zig
@@ -612,6 +612,18 @@ pub const ZigClangBuiltinTypeKind = extern enum {
     OCLIntelSubgroupAVCImeResultDualRefStreamout,
     OCLIntelSubgroupAVCImeSingleRefStreamin,
     OCLIntelSubgroupAVCImeDualRefStreamin,
+    SveInt8,
+    SveInt16,
+    SveInt32,
+    SveInt64,
+    SveUint8,
+    SveUint16,
+    SveUint32,
+    SveUint64,
+    SveFloat16,
+    SveFloat32,
+    SveFloat64,
+    SveBool,
     Void,
     Bool,
     Char_U,
src-self-hosted/translate_c.zig
@@ -4716,6 +4716,7 @@ fn appendToken(c: *Context, token_id: Token.Id, bytes: []const u8) !ast.TokenInd
 }
 
 fn appendTokenFmt(c: *Context, token_id: Token.Id, comptime format: []const u8, args: var) !ast.TokenIndex {
+    assert(token_id != .Invalid);
     const S = struct {
         fn callback(context: *Context, bytes: []const u8) error{OutOfMemory}!void {
             return context.source_buffer.append(bytes);