| ... | @@ -447,7 +447,13 @@ fn declVisitorNamesOnly(c: *Context, decl: *const clang.Decl) Error!void { | ... | @@ -447,7 +447,13 @@ fn declVisitorNamesOnly(c: *Context, decl: *const clang.Decl) Error!void { |
| 447 | // TODO https://github.com/ziglang/zig/issues/3756 | 447 | // TODO https://github.com/ziglang/zig/issues/3756 |
| 448 | // TODO https://github.com/ziglang/zig/issues/1802 | 448 | // TODO https://github.com/ziglang/zig/issues/1802 |
| 449 | const name = if (isZigPrimitiveType(decl_name)) try std.fmt.allocPrint(c.arena, "{s}_{d}", .{ decl_name, c.getMangle() }) else decl_name; | 449 | const name = if (isZigPrimitiveType(decl_name)) try std.fmt.allocPrint(c.arena, "{s}_{d}", .{ decl_name, c.getMangle() }) else decl_name; |
| 450 | try c.unnamed_typedefs.putNoClobber(c.gpa, addr, name); | 450 | const result = try c.unnamed_typedefs.getOrPut(c.gpa, addr); |
| | 451 | if (result.found_existing) { |
| | 452 | // One typedef can declare multiple names. |
| | 453 | // Don't put this one in `decl_table` so it's processed later. |
| | 454 | return; |
| | 455 | } |
| | 456 | result.entry.value = name; |
| 451 | // Put this typedef in the decl_table to avoid redefinitions. | 457 | // Put this typedef in the decl_table to avoid redefinitions. |
| 452 | try c.decl_table.putNoClobber(c.gpa, @ptrToInt(typedef_decl.getCanonicalDecl()), name); | 458 | try c.decl_table.putNoClobber(c.gpa, @ptrToInt(typedef_decl.getCanonicalDecl()), name); |
| 453 | } | 459 | } |