authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-01 21:37:02-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-01 21:37:02-07:00
log53775b0999527ced0550f3abb32c4a4a715af74e
tree5873cc73d3db99d5843e3c1d8e5f68224e4b1c55
parentfc4d53e2ea6b41440e37caf32d2fd236d0f58c93

CLI: fix -fno-clang

Aro/Clang detection logic treated `-fno-clang` the same as `-fclang`.

1 files changed, 7 insertions(+), 3 deletions(-)

src/Compilation.zig+7-3
...@@ -1049,10 +1049,14 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1049,10 +1049,14 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
10491049
1050 // Make a decision on whether to use Clang or Aro for translate-c and compiling C files.1050 // Make a decision on whether to use Clang or Aro for translate-c and compiling C files.
1051 const c_frontend: CFrontend = blk: {1051 const c_frontend: CFrontend = blk: {
1052 if (!build_options.have_llvm) break :blk .aro;1052 if (options.use_clang) |want_clang| {
1053 if (options.use_clang) |explicit| if (explicit) break :blk .clang;1053 break :blk if (want_clang) .clang else .aro;
1054 break :blk .clang;1054 }
1055 break :blk if (build_options.have_llvm) .clang else .aro;
1055 };1056 };
1057 if (!build_options.have_llvm and c_frontend == .clang) {
1058 return error.ZigCompilerNotBuiltWithLLVMExtensions;
1059 }
10561060
1057 const is_safe_mode = switch (options.optimize_mode) {1061 const is_safe_mode = switch (options.optimize_mode) {
1058 .Debug, .ReleaseSafe => true,1062 .Debug, .ReleaseSafe => true,