diff options
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig index 9c7d3ee885..24047f8798 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -6749,3 +6749,25 @@ pub fn getDeclExports(mod: Module, decl_index: Decl.Index) []const *Export { return &[0]*Export{}; } } + +pub const Feature = enum { + panic_fn, + panic_unwrap_error, + safety_check_formatted, + error_return_trace, + is_named_enum_value, + error_set_has_value, +}; + +pub fn backendSupportsFeature(mod: Module, feature: Feature) bool { + return switch (feature) { + .panic_fn => mod.comp.bin_file.options.target.ofmt == .c or + mod.comp.bin_file.options.use_llvm, + .panic_unwrap_error => mod.comp.bin_file.options.target.ofmt == .c or + mod.comp.bin_file.options.use_llvm, + .safety_check_formatted => mod.comp.bin_file.options.use_llvm, + .error_return_trace => mod.comp.bin_file.options.use_llvm, + .is_named_enum_value => mod.comp.bin_file.options.use_llvm, + .error_set_has_value => mod.comp.bin_file.options.use_llvm, + }; +} |
