| ... | @@ -2086,6 +2086,11 @@ fn finishBoolExpr( | ... | @@ -2086,6 +2086,11 @@ fn finishBoolExpr( |
| 2086 | } | 2086 | } |
| 2087 | }, | 2087 | }, |
| 2088 | .Pointer => { | 2088 | .Pointer => { |
| | 2089 | if (node.tag() == .string_literal) { |
| | 2090 | // @intFromPtr(node) != 0 |
| | 2091 | const int_from_ptr = try Tag.int_from_ptr.create(c.arena, node); |
| | 2092 | return Tag.not_equal.create(c.arena, .{ .lhs = int_from_ptr, .rhs = Tag.zero_literal.init() }); |
| | 2093 | } |
| 2089 | // node != null | 2094 | // node != null |
| 2090 | return Tag.not_equal.create(c.arena, .{ .lhs = node, .rhs = Tag.null_literal.init() }); | 2095 | return Tag.not_equal.create(c.arena, .{ .lhs = node, .rhs = Tag.null_literal.init() }); |
| 2091 | }, | 2096 | }, |
| ... | @@ -5794,10 +5799,11 @@ fn macroIntToBool(c: *Context, node: Node) !Node { | ... | @@ -5794,10 +5799,11 @@ fn macroIntToBool(c: *Context, node: Node) !Node { |
| 5794 | return node; | 5799 | return node; |
| 5795 | } | 5800 | } |
| 5796 | if (node.tag() == .string_literal) { | 5801 | if (node.tag() == .string_literal) { |
| | 5802 | // @intFromPtr(node) != 0 |
| 5797 | const int_from_ptr = try Tag.int_from_ptr.create(c.arena, node); | 5803 | const int_from_ptr = try Tag.int_from_ptr.create(c.arena, node); |
| 5798 | return Tag.not_equal.create(c.arena, .{ .lhs = int_from_ptr, .rhs = Tag.zero_literal.init() }); | 5804 | return Tag.not_equal.create(c.arena, .{ .lhs = int_from_ptr, .rhs = Tag.zero_literal.init() }); |
| 5799 | } | 5805 | } |
| 5800 | | 5806 | // node != 0 |
| 5801 | return Tag.not_equal.create(c.arena, .{ .lhs = node, .rhs = Tag.zero_literal.init() }); | 5807 | return Tag.not_equal.create(c.arena, .{ .lhs = node, .rhs = Tag.zero_literal.init() }); |
| 5802 | } | 5808 | } |
| 5803 | | 5809 | |