@@ -19,6 +19,46 @@ const MacroTranslator = @import("MacroTranslator.zig");
1919const PatternList = @import ("PatternList.zig" );
2020const Scope = @import ("Scope.zig" );
2121
22+ const AnonymousRecordFieldNames = struct {
23+ pub const Key = struct {
24+ parent : QualType ,
25+ field : QualType ,
26+ };
27+
28+ pub const Context = struct {
29+ pub fn hash (ctx : Context , key : Key ) u64 {
30+ const auto_hash = std .hash_map .getAutoHashFn (Key , Context );
31+ return auto_hash (ctx , .{
32+ .parent = key .parent .unqualified (),
33+ .field = key .field .unqualified (),
34+ });
35+ }
36+
37+ pub fn eql (ctx : Context , a : Key , b : Key ) bool {
38+ const auto_eql = std .hash_map .getAutoEqlFn (Key , Context );
39+ return auto_eql (ctx , .{
40+ .parent = a .parent .unqualified (),
41+ .field = a .field .unqualified (),
42+ }, .{
43+ .parent = b .parent .unqualified (),
44+ .field = b .field .unqualified (),
45+ });
46+ }
47+ };
48+ };
49+
50+ pub const QualTypeHashContext = struct {
51+ pub fn hash (ctx : QualTypeHashContext , key : QualType ) u64 {
52+ const auto_hash = std .hash_map .getAutoHashFn (QualType , QualTypeHashContext );
53+ return auto_hash (ctx , key .unqualified ());
54+ }
55+
56+ pub fn eql (ctx : QualTypeHashContext , a : QualType , b : QualType ) bool {
57+ const auto_eql = std .hash_map .getAutoEqlFn (QualType , QualTypeHashContext );
58+ return auto_eql (ctx , a .unqualified (), b .unqualified ());
59+ }
60+ };
61+
2262pub const Error = std .mem .Allocator .Error ;
2363pub const MacroProcessingError = Error || error {UnexpectedMacroToken };
2464pub const TypeError = Error || error {UnsupportedType };
@@ -44,14 +84,16 @@ mangle_count: u32 = 0,
4484/// Table of declarations for enum, struct, union and typedef types.
4585type_decls : std .AutoArrayHashMapUnmanaged (Node.Index , []const u8 ) = .empty ,
4686/// Table of record decls that have been demoted to opaques.
47- opaque_demotes : std .AutoHashMapUnmanaged (QualType , void ) = .empty ,
87+ opaque_demotes : std .HashMapUnmanaged (QualType , void , QualTypeHashContext , std . hash_map . default_max_load_percentage ) = .empty ,
4888/// Table of unnamed enums and records that are child types of typedefs.
49- unnamed_typedefs : std .AutoHashMapUnmanaged (QualType , []const u8 ) = .empty ,
89+ unnamed_typedefs : std .HashMapUnmanaged (QualType , []const u8 , QualTypeHashContext , std . hash_map . default_max_load_percentage ) = .empty ,
5090/// Table of anonymous record to generated field names.
51- anonymous_record_field_names : std .AutoHashMapUnmanaged (struct {
52- parent : QualType ,
53- field : QualType ,
54- }, []const u8 ) = .empty ,
91+ anonymous_record_field_names : std .HashMapUnmanaged (
92+ AnonymousRecordFieldNames .Key ,
93+ []const u8 ,
94+ AnonymousRecordFieldNames .Context ,
95+ std .hash_map .default_max_load_percentage ,
96+ ) = .empty ,
5597
5698/// This one is different than the root scope's name table. This contains
5799/// a list of names that we found by visiting all the top level decls without
0 commit comments