authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-04-11 17:55:49-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-04-11 17:56:48-04:00
log3c34c313cf999238753b34f01b0437a552fb3be0
treea191e0bf9075e1aade1d387b1ca7fa07275bed96
parent4ceaa0595a02b3695e37bd999bd58efb7c1e0550

revert Translate C: Add comment containing c source location for failed decls

This reverts 0db108101a30a2ac5ec4dc9911d488f9036256b8. Unfortunately this caused a regression. Closes #5007.

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

src-self-hosted/translate_c.zig+1-3
...@@ -3058,7 +3058,6 @@ fn transCreateCompoundAssign(...@@ -3058,7 +3058,6 @@ fn transCreateCompoundAssign(
3058 // common case3058 // common case
3059 // c: lhs += rhs3059 // c: lhs += rhs
3060 // zig: lhs += rhs3060 // zig: lhs += rhs
3061
3062 if ((is_mod or is_div) and is_signed) {3061 if ((is_mod or is_div) and is_signed) {
3063 const op_token = try appendToken(rp.c, .Equal, "=");3062 const op_token = try appendToken(rp.c, .Equal, "=");
3064 const op_node = try rp.c.a().create(ast.Node.InfixOp);3063 const op_node = try rp.c.a().create(ast.Node.InfixOp);
...@@ -4773,7 +4772,6 @@ pub fn failDecl(c: *Context, loc: ZigClangSourceLocation, name: []const u8, comp...@@ -4773,7 +4772,6 @@ pub fn failDecl(c: *Context, loc: ZigClangSourceLocation, name: []const u8, comp
4773 const msg_tok = try appendTokenFmt(c, .StringLiteral, "\"" ++ format ++ "\"", args);4772 const msg_tok = try appendTokenFmt(c, .StringLiteral, "\"" ++ format ++ "\"", args);
4774 const rparen_tok = try appendToken(c, .RParen, ")");4773 const rparen_tok = try appendToken(c, .RParen, ")");
4775 const semi_tok = try appendToken(c, .Semicolon, ";");4774 const semi_tok = try appendToken(c, .Semicolon, ";");
4776 _ = try appendTokenFmt(c, .LineComment, "// {}", .{c.locStr(loc)});
47774775
4778 const msg_node = try c.a().create(ast.Node.StringLiteral);4776 const msg_node = try c.a().create(ast.Node.StringLiteral);
4779 msg_node.* = ast.Node.StringLiteral{4777 msg_node.* = ast.Node.StringLiteral{
...@@ -5442,7 +5440,7 @@ fn parseCPrimaryExpr(c: *Context, it: *CTokenList.Iterator, source: []const u8,...@@ -5442,7 +5440,7 @@ fn parseCPrimaryExpr(c: *Context, it: *CTokenList.Iterator, source: []const u8,
5442 };5440 };
5443 return &node.base;5441 return &node.base;
5444 } else {5442 } else {
5445 const token = try appendTokenFmt(c, .IntegerLiteral, "0x{x}", .{source[tok.start+1..tok.end-1]});5443 const token = try appendTokenFmt(c, .IntegerLiteral, "0x{x}", .{source[tok.start + 1 .. tok.end - 1]});
5446 const node = try c.a().create(ast.Node.IntegerLiteral);5444 const node = try c.a().create(ast.Node.IntegerLiteral);
5447 node.* = .{5445 node.* = .{
5448 .token = token,5446 .token = token,