| ... | ... | @@ -270,11 +270,11 @@ pub const LangToExt = std.ComptimeStringMap(FileExt, .{ |
| 270 | 270 | .{ "c", .c }, |
| 271 | 271 | .{ "c-header", .h }, |
| 272 | 272 | .{ "c++", .cpp }, |
| 273 | | .{ "c++-header", .h }, |
| 273 | .{ "c++-header", .hpp }, |
| 274 | 274 | .{ "objective-c", .m }, |
| 275 | | .{ "objective-c-header", .h }, |
| 275 | .{ "objective-c-header", .hm }, |
| 276 | 276 | .{ "objective-c++", .mm }, |
| 277 | | .{ "objective-c++-header", .h }, |
| 277 | .{ "objective-c++-header", .hmm }, |
| 278 | 278 | .{ "assembler", .assembly }, |
| 279 | 279 | .{ "assembler-with-cpp", .assembly_with_cpp }, |
| 280 | 280 | .{ "cuda", .cu }, |
| ... | ... | @@ -887,6 +887,8 @@ pub const ClangPreprocessorMode = enum { |
| 887 | 887 | yes, |
| 888 | 888 | /// This means we are doing `zig cc -E`. |
| 889 | 889 | stdout, |
| 890 | /// precompiled C header |
| 891 | pch, |
| 890 | 892 | }; |
| 891 | 893 | |
| 892 | 894 | pub const Framework = link.File.MachO.Framework; |
| ... | ... | @@ -4393,6 +4395,10 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P |
| 4393 | 4395 | .assembly_with_cpp => "assembler-with-cpp", |
| 4394 | 4396 | .c => "c", |
| 4395 | 4397 | .cpp => "c++", |
| 4398 | .h => "c-header", |
| 4399 | .hpp => "c++-header", |
| 4400 | .hm => "objective-c-header", |
| 4401 | .hmm => "objective-c++-header", |
| 4396 | 4402 | .cu => "cuda", |
| 4397 | 4403 | .m => "objective-c", |
| 4398 | 4404 | .mm => "objective-c++", |
| ... | ... | @@ -4418,10 +4424,11 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P |
| 4418 | 4424 | else |
| 4419 | 4425 | "/dev/null"; |
| 4420 | 4426 | |
| 4421 | | try argv.ensureUnusedCapacity(5); |
| 4427 | try argv.ensureUnusedCapacity(6); |
| 4422 | 4428 | switch (comp.clang_preprocessor_mode) { |
| 4423 | | .no => argv.appendSliceAssumeCapacity(&[_][]const u8{ "-c", "-o", out_obj_path }), |
| 4424 | | .yes => argv.appendSliceAssumeCapacity(&[_][]const u8{ "-E", "-o", out_obj_path }), |
| 4429 | .no => argv.appendSliceAssumeCapacity(&.{ "-c", "-o", out_obj_path }), |
| 4430 | .yes => argv.appendSliceAssumeCapacity(&.{ "-E", "-o", out_obj_path }), |
| 4431 | .pch => argv.appendSliceAssumeCapacity(&.{ "-Xclang", "-emit-pch", "-o", out_obj_path }), |
| 4425 | 4432 | .stdout => argv.appendAssumeCapacity("-E"), |
| 4426 | 4433 | } |
| 4427 | 4434 | |
| ... | ... | @@ -4456,10 +4463,11 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P |
| 4456 | 4463 | try argv.appendSlice(c_object.src.extra_flags); |
| 4457 | 4464 | try argv.appendSlice(c_object.src.cache_exempt_flags); |
| 4458 | 4465 | |
| 4459 | | try argv.ensureUnusedCapacity(5); |
| 4466 | try argv.ensureUnusedCapacity(6); |
| 4460 | 4467 | switch (comp.clang_preprocessor_mode) { |
| 4461 | 4468 | .no => argv.appendSliceAssumeCapacity(&.{ "-c", "-o", out_obj_path }), |
| 4462 | 4469 | .yes => argv.appendSliceAssumeCapacity(&.{ "-E", "-o", out_obj_path }), |
| 4470 | .pch => argv.appendSliceAssumeCapacity(&.{ "-Xclang", "-emit-pch", "-o", out_obj_path }), |
| 4463 | 4471 | .stdout => argv.appendAssumeCapacity("-E"), |
| 4464 | 4472 | } |
| 4465 | 4473 | if (comp.clang_passthrough_mode) { |
| ... | ... | @@ -5101,7 +5109,7 @@ pub fn addCCArgs( |
| 5101 | 5109 | try argv.appendSlice(&[_][]const u8{ "-target", llvm_triple }); |
| 5102 | 5110 | |
| 5103 | 5111 | if (target.os.tag == .windows) switch (ext) { |
| 5104 | | .c, .cpp, .m, .mm, .h, .cu, .rc, .assembly, .assembly_with_cpp => { |
| 5112 | .c, .cpp, .m, .mm, .h, .hpp, .hm, .hmm, .cu, .rc, .assembly, .assembly_with_cpp => { |
| 5105 | 5113 | const minver: u16 = @truncate(@intFromEnum(target.os.getVersionRange().windows.min) >> 16); |
| 5106 | 5114 | try argv.append( |
| 5107 | 5115 | try std.fmt.allocPrint(arena, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}), |
| ... | ... | @@ -5111,7 +5119,7 @@ pub fn addCCArgs( |
| 5111 | 5119 | }; |
| 5112 | 5120 | |
| 5113 | 5121 | switch (ext) { |
| 5114 | | .c, .cpp, .m, .mm, .h, .cu, .rc => { |
| 5122 | .c, .cpp, .m, .mm, .h, .hpp, .hm, .hmm, .cu, .rc => { |
| 5115 | 5123 | try argv.appendSlice(&[_][]const u8{ |
| 5116 | 5124 | "-nostdinc", |
| 5117 | 5125 | "-fno-spell-checking", |
| ... | ... | @@ -5679,6 +5687,9 @@ pub const FileExt = enum { |
| 5679 | 5687 | cpp, |
| 5680 | 5688 | cu, |
| 5681 | 5689 | h, |
| 5690 | hpp, |
| 5691 | hm, |
| 5692 | hmm, |
| 5682 | 5693 | m, |
| 5683 | 5694 | mm, |
| 5684 | 5695 | ll, |
| ... | ... | @@ -5697,7 +5708,7 @@ pub const FileExt = enum { |
| 5697 | 5708 | |
| 5698 | 5709 | pub fn clangSupportsDepFile(ext: FileExt) bool { |
| 5699 | 5710 | return switch (ext) { |
| 5700 | | .c, .cpp, .h, .m, .mm, .cu => true, |
| 5711 | .c, .cpp, .h, .hpp, .hm, .hmm, .m, .mm, .cu => true, |
| 5701 | 5712 | |
| 5702 | 5713 | .ll, |
| 5703 | 5714 | .bc, |
| ... | ... | @@ -5722,6 +5733,9 @@ pub const FileExt = enum { |
| 5722 | 5733 | .cpp => ".cpp", |
| 5723 | 5734 | .cu => ".cu", |
| 5724 | 5735 | .h => ".h", |
| 5736 | .hpp => ".h", |
| 5737 | .hm => ".h", |
| 5738 | .hmm => ".h", |
| 5725 | 5739 | .m => ".m", |
| 5726 | 5740 | .mm => ".mm", |
| 5727 | 5741 | .ll => ".ll", |