Skip to content

Commit 53775b0

Browse files
committed
CLI: fix -fno-clang
Aro/Clang detection logic treated `-fno-clang` the same as `-fclang`.
1 parent fc4d53e commit 53775b0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Compilation.zig

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,10 +1049,14 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
10491049

10501050
// Make a decision on whether to use Clang or Aro for translate-c and compiling C files.
10511051
const c_frontend: CFrontend = blk: {
1052-
if (!build_options.have_llvm) break :blk .aro;
1053-
if (options.use_clang) |explicit| if (explicit) break :blk .clang;
1054-
break :blk .clang;
1052+
if (options.use_clang) |want_clang| {
1053+
break :blk if (want_clang) .clang else .aro;
1054+
}
1055+
break :blk if (build_options.have_llvm) .clang else .aro;
10551056
};
1057+
if (!build_options.have_llvm and c_frontend == .clang) {
1058+
return error.ZigCompilerNotBuiltWithLLVMExtensions;
1059+
}
10561060

10571061
const is_safe_mode = switch (options.optimize_mode) {
10581062
.Debug, .ReleaseSafe => true,

0 commit comments

Comments
 (0)