mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
translate-c: deduplicate global declaration
Fix #15456 Signed-off-by: Tw <weii.tan>
This commit is contained in:
parent
363269a2a9
commit
131b328c10
@ -4195,8 +4195,11 @@ fn maybeSuppressResult(c: *Context, used: ResultUsed, result: Node) TransError!N
|
||||
}
|
||||
|
||||
fn addTopLevelDecl(c: *Context, name: []const u8, decl_node: Node) !void {
|
||||
try c.global_scope.sym_table.put(name, decl_node);
|
||||
try c.global_scope.nodes.append(decl_node);
|
||||
const gop = try c.global_scope.sym_table.getOrPut(name);
|
||||
if (!gop.found_existing) {
|
||||
gop.value_ptr.* = decl_node;
|
||||
try c.global_scope.nodes.append(decl_node);
|
||||
}
|
||||
}
|
||||
|
||||
fn transQualTypeInitializedStringLiteral(c: *Context, elem_ty: Node, string_lit: *const clang.StringLiteral) TypeError!Node {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user