@@ -2008,9 +2008,9 @@ pub const WipNav = struct {
2008
2008
.decl_const_runtime_bits ,
2009
2009
.decl_const_comptime_state ,
2010
2010
.decl_const_runtime_bits_comptime_state ,
2011
- .decl_empty_func ,
2011
+ .decl_nullary_func ,
2012
2012
.decl_func ,
2013
- .decl_empty_func_generic ,
2013
+ .decl_nullary_func_generic ,
2014
2014
.decl_func_generic ,
2015
2015
= > false ,
2016
2016
.generic_decl_var ,
@@ -2626,8 +2626,8 @@ pub fn finishWipNavFunc(
2626
2626
abbrev_code_buf ,
2627
2627
try dwarf .refAbbrevCode (switch (abbrev_code ) {
2628
2628
else = > unreachable ,
2629
- .decl_func = > .decl_empty_func ,
2630
- .decl_instance_func = > .decl_instance_empty_func ,
2629
+ .decl_func = > .decl_nullary_func ,
2630
+ .decl_instance_func = > .decl_instance_nullary_func ,
2631
2631
}),
2632
2632
);
2633
2633
}
@@ -3012,29 +3012,34 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo
3012
3012
if (nav_gop .found_existing ) switch (try dwarf .debug_info .declAbbrevCode (wip_nav .unit , nav_gop .value_ptr .* )) {
3013
3013
.null = > {},
3014
3014
else = > unreachable ,
3015
- .decl_empty_func , .decl_func , .decl_instance_empty_func , .decl_instance_func = > return ,
3016
- .decl_empty_func_generic ,
3015
+ .decl_nullary_func , .decl_func , .decl_instance_nullary_func , .decl_instance_func = > return ,
3016
+ .decl_nullary_func_generic ,
3017
3017
.decl_func_generic ,
3018
- .decl_instance_empty_func_generic ,
3018
+ .decl_instance_nullary_func_generic ,
3019
3019
.decl_instance_func_generic ,
3020
3020
= > dwarf .debug_info .section .getUnit (wip_nav .unit ).getEntry (nav_gop .value_ptr .* ).clear (),
3021
3021
} else nav_gop .value_ptr .* = try dwarf .addCommonEntry (wip_nav .unit );
3022
3022
wip_nav .entry = nav_gop .value_ptr .* ;
3023
3023
3024
3024
const func_type = ip .indexToKey (func .ty ).func_type ;
3025
+ const is_nullary = ! func_type .is_var_args and for (0.. func_type .param_types .len ) | param_index | {
3026
+ if (! func_type .paramIsComptime (std .math .cast (u5 , param_index ) orelse break false )) break false ;
3027
+ } else true ;
3025
3028
const diw = wip_nav .debug_info .writer (dwarf .gpa );
3026
- try wip_nav .declCommon (if (func_type . param_types . len > 0 or func_type . is_var_args ) .{
3027
- .decl = .decl_func_generic ,
3029
+ try wip_nav .declCommon (if (is_nullary ) .{
3030
+ .decl = .decl_nullary_func_generic ,
3028
3031
.generic_decl = .generic_decl_func ,
3029
- .decl_instance = .decl_instance_func_generic ,
3032
+ .decl_instance = .decl_instance_nullary_func_generic ,
3030
3033
} else .{
3031
- .decl = .decl_empty_func_generic ,
3034
+ .decl = .decl_func_generic ,
3032
3035
.generic_decl = .generic_decl_func ,
3033
- .decl_instance = .decl_instance_empty_func_generic ,
3036
+ .decl_instance = .decl_instance_func_generic ,
3034
3037
}, & nav , inst_info .file , & decl );
3035
3038
try wip_nav .refType (.fromInterned (func_type .return_type ));
3036
- if (func_type . param_types . len > 0 or func_type . is_var_args ) {
3039
+ if (! is_nullary ) {
3037
3040
for (0.. func_type .param_types .len ) | param_index | {
3041
+ if (std .math .cast (u5 , param_index )) | small_param_index |
3042
+ if (func_type .paramIsComptime (small_param_index )) continue ;
3038
3043
try wip_nav .abbrevCode (.func_type_param );
3039
3044
try wip_nav .refType (.fromInterned (func_type .param_types .get (ip )[param_index ]));
3040
3045
}
@@ -3568,12 +3573,14 @@ fn updateLazyType(
3568
3573
};
3569
3574
try diw .writeByte (@intFromEnum (cc ));
3570
3575
try wip_nav .refType (.fromInterned (func_type .return_type ));
3571
- for (0.. func_type .param_types .len ) | param_index | {
3572
- try wip_nav .abbrevCode (.func_type_param );
3573
- try wip_nav .refType (.fromInterned (func_type .param_types .get (ip )[param_index ]));
3576
+ if (! is_nullary ) {
3577
+ for (0.. func_type .param_types .len ) | param_index | {
3578
+ try wip_nav .abbrevCode (.func_type_param );
3579
+ try wip_nav .refType (.fromInterned (func_type .param_types .get (ip )[param_index ]));
3580
+ }
3581
+ if (func_type .is_var_args ) try wip_nav .abbrevCode (.is_var_args );
3582
+ try uleb128 (diw , @intFromEnum (AbbrevCode .null ));
3574
3583
}
3575
- if (func_type .is_var_args ) try wip_nav .abbrevCode (.is_var_args );
3576
- if (! is_nullary ) try uleb128 (diw , @intFromEnum (AbbrevCode .null ));
3577
3584
},
3578
3585
.error_set_type = > | error_set_type | {
3579
3586
try wip_nav .abbrevCode (if (error_set_type .names .len == 0 ) .generated_empty_enum_type else .generated_enum_type );
@@ -4787,9 +4794,9 @@ const AbbrevCode = enum {
4787
4794
decl_const_runtime_bits ,
4788
4795
decl_const_comptime_state ,
4789
4796
decl_const_runtime_bits_comptime_state ,
4790
- decl_empty_func ,
4797
+ decl_nullary_func ,
4791
4798
decl_func ,
4792
- decl_empty_func_generic ,
4799
+ decl_nullary_func_generic ,
4793
4800
decl_func_generic ,
4794
4801
generic_decl_var ,
4795
4802
generic_decl_const ,
@@ -4806,9 +4813,9 @@ const AbbrevCode = enum {
4806
4813
decl_instance_const_runtime_bits ,
4807
4814
decl_instance_const_comptime_state ,
4808
4815
decl_instance_const_runtime_bits_comptime_state ,
4809
- decl_instance_empty_func ,
4816
+ decl_instance_nullary_func ,
4810
4817
decl_instance_func ,
4811
- decl_instance_empty_func_generic ,
4818
+ decl_instance_nullary_func_generic ,
4812
4819
decl_instance_func_generic ,
4813
4820
// the rest are unrestricted other than empty variants must not be longer
4814
4821
// than the non-empty variant, and so should appear first
@@ -5019,7 +5026,7 @@ const AbbrevCode = enum {
5019
5026
.{ .ZIG_comptime_value , .ref_addr },
5020
5027
},
5021
5028
},
5022
- .decl_empty_func = .{
5029
+ .decl_nullary_func = .{
5023
5030
.tag = .subprogram ,
5024
5031
.attrs = decl_abbrev_common_attrs ++ .{
5025
5032
.{ .linkage_name , .strp },
@@ -5044,7 +5051,7 @@ const AbbrevCode = enum {
5044
5051
.{ .noreturn , .flag },
5045
5052
},
5046
5053
},
5047
- .decl_empty_func_generic = .{
5054
+ .decl_nullary_func_generic = .{
5048
5055
.tag = .subprogram ,
5049
5056
.attrs = decl_abbrev_common_attrs ++ .{
5050
5057
.{ .type , .ref_addr },
@@ -5167,7 +5174,7 @@ const AbbrevCode = enum {
5167
5174
.{ .ZIG_comptime_value , .ref_addr },
5168
5175
},
5169
5176
},
5170
- .decl_instance_empty_func = .{
5177
+ .decl_instance_nullary_func = .{
5171
5178
.tag = .subprogram ,
5172
5179
.attrs = decl_instance_abbrev_common_attrs ++ .{
5173
5180
.{ .linkage_name , .strp },
@@ -5192,7 +5199,7 @@ const AbbrevCode = enum {
5192
5199
.{ .noreturn , .flag },
5193
5200
},
5194
5201
},
5195
- .decl_instance_empty_func_generic = .{
5202
+ .decl_instance_nullary_func_generic = .{
5196
5203
.tag = .subprogram ,
5197
5204
.attrs = decl_instance_abbrev_common_attrs ++ .{
5198
5205
.{ .type , .ref_addr },
0 commit comments