| ... | @@ -911,7 +911,7 @@ fn buildOutputType( | ... | @@ -911,7 +911,7 @@ fn buildOutputType( |
| 911 | // These get appended to by CLI flags and then slurped when a `--mod` flag | 911 | // These get appended to by CLI flags and then slurped when a `--mod` flag |
| 912 | // is encountered. | 912 | // is encountered. |
| 913 | var cssan: ClangSearchSanitizer = .{}; | 913 | var cssan: ClangSearchSanitizer = .{}; |
| 914 | var clang_argv: std.ArrayListUnmanaged([]const u8) = .{}; | 914 | var cc_argv: std.ArrayListUnmanaged([]const u8) = .{}; |
| 915 | var deps: std.ArrayListUnmanaged(CliModule.Dep) = .{}; | 915 | var deps: std.ArrayListUnmanaged(CliModule.Dep) = .{}; |
| 916 | | 916 | |
| 917 | // Contains every module specified via --mod. The dependencies are added | 917 | // Contains every module specified via --mod. The dependencies are added |
| ... | @@ -1067,7 +1067,7 @@ fn buildOutputType( | ... | @@ -1067,7 +1067,7 @@ fn buildOutputType( |
| 1067 | }, | 1067 | }, |
| 1068 | .root_src_path = fs.path.basename(root_src), | 1068 | .root_src_path = fs.path.basename(root_src), |
| 1069 | }, | 1069 | }, |
| 1070 | .cc_argv = try clang_argv.toOwnedSlice(arena), | 1070 | .cc_argv = try cc_argv.toOwnedSlice(arena), |
| 1071 | .inherited = mod_opts, | 1071 | .inherited = mod_opts, |
| 1072 | .target_arch_os_abi = target_arch_os_abi, | 1072 | .target_arch_os_abi = target_arch_os_abi, |
| 1073 | .target_mcpu = target_mcpu, | 1073 | .target_mcpu = target_mcpu, |
| ... | @@ -1226,22 +1226,22 @@ fn buildOutputType( | ... | @@ -1226,22 +1226,22 @@ fn buildOutputType( |
| 1226 | .search_strategy = lib_search_strategy, | 1226 | .search_strategy = lib_search_strategy, |
| 1227 | }); | 1227 | }); |
| 1228 | } else if (mem.eql(u8, arg, "-D")) { | 1228 | } else if (mem.eql(u8, arg, "-D")) { |
| 1229 | try clang_argv.appendSlice(arena, &.{ arg, args_iter.nextOrFatal() }); | 1229 | try cc_argv.appendSlice(arena, &.{ arg, args_iter.nextOrFatal() }); |
| 1230 | } else if (mem.eql(u8, arg, "-I")) { | 1230 | } else if (mem.eql(u8, arg, "-I")) { |
| 1231 | try cssan.addIncludePath(arena, &clang_argv, .I, arg, args_iter.nextOrFatal(), false); | 1231 | try cssan.addIncludePath(arena, &cc_argv, .I, arg, args_iter.nextOrFatal(), false); |
| 1232 | } else if (mem.eql(u8, arg, "-isystem")) { | 1232 | } else if (mem.eql(u8, arg, "-isystem")) { |
| 1233 | try cssan.addIncludePath(arena, &clang_argv, .isystem, arg, args_iter.nextOrFatal(), false); | 1233 | try cssan.addIncludePath(arena, &cc_argv, .isystem, arg, args_iter.nextOrFatal(), false); |
| 1234 | } else if (mem.eql(u8, arg, "-iwithsysroot")) { | 1234 | } else if (mem.eql(u8, arg, "-iwithsysroot")) { |
| 1235 | try cssan.addIncludePath(arena, &clang_argv, .iwithsysroot, arg, args_iter.nextOrFatal(), false); | 1235 | try cssan.addIncludePath(arena, &cc_argv, .iwithsysroot, arg, args_iter.nextOrFatal(), false); |
| 1236 | } else if (mem.eql(u8, arg, "-idirafter")) { | 1236 | } else if (mem.eql(u8, arg, "-idirafter")) { |
| 1237 | try cssan.addIncludePath(arena, &clang_argv, .idirafter, arg, args_iter.nextOrFatal(), false); | 1237 | try cssan.addIncludePath(arena, &cc_argv, .idirafter, arg, args_iter.nextOrFatal(), false); |
| 1238 | } else if (mem.eql(u8, arg, "-iframework")) { | 1238 | } else if (mem.eql(u8, arg, "-iframework")) { |
| 1239 | const path = args_iter.nextOrFatal(); | 1239 | const path = args_iter.nextOrFatal(); |
| 1240 | try cssan.addIncludePath(arena, &clang_argv, .iframework, arg, path, false); | 1240 | try cssan.addIncludePath(arena, &cc_argv, .iframework, arg, path, false); |
| 1241 | try create_module.framework_dirs.append(arena, path); // Forward to the backend as -F | 1241 | try create_module.framework_dirs.append(arena, path); // Forward to the backend as -F |
| 1242 | } else if (mem.eql(u8, arg, "-iframeworkwithsysroot")) { | 1242 | } else if (mem.eql(u8, arg, "-iframeworkwithsysroot")) { |
| 1243 | const path = args_iter.nextOrFatal(); | 1243 | const path = args_iter.nextOrFatal(); |
| 1244 | try cssan.addIncludePath(arena, &clang_argv, .iframeworkwithsysroot, arg, path, false); | 1244 | try cssan.addIncludePath(arena, &cc_argv, .iframeworkwithsysroot, arg, path, false); |
| 1245 | try create_module.framework_dirs.append(arena, path); // Forward to the backend as -F | 1245 | try create_module.framework_dirs.append(arena, path); // Forward to the backend as -F |
| 1246 | } else if (mem.eql(u8, arg, "--version")) { | 1246 | } else if (mem.eql(u8, arg, "--version")) { |
| 1247 | const next_arg = args_iter.nextOrFatal(); | 1247 | const next_arg = args_iter.nextOrFatal(); |
| ... | @@ -1268,7 +1268,7 @@ fn buildOutputType( | ... | @@ -1268,7 +1268,7 @@ fn buildOutputType( |
| 1268 | } else if (mem.eql(u8, arg, "--sysroot")) { | 1268 | } else if (mem.eql(u8, arg, "--sysroot")) { |
| 1269 | const next_arg = args_iter.nextOrFatal(); | 1269 | const next_arg = args_iter.nextOrFatal(); |
| 1270 | create_module.sysroot = next_arg; | 1270 | create_module.sysroot = next_arg; |
| 1271 | try clang_argv.appendSlice(arena, &.{ "-isysroot", next_arg }); | 1271 | try cc_argv.appendSlice(arena, &.{ "-isysroot", next_arg }); |
| 1272 | } else if (mem.eql(u8, arg, "--libc")) { | 1272 | } else if (mem.eql(u8, arg, "--libc")) { |
| 1273 | create_module.libc_paths_file = args_iter.nextOrFatal(); | 1273 | create_module.libc_paths_file = args_iter.nextOrFatal(); |
| 1274 | } else if (mem.eql(u8, arg, "--test-filter")) { | 1274 | } else if (mem.eql(u8, arg, "--test-filter")) { |
| ... | @@ -1650,9 +1650,9 @@ fn buildOutputType( | ... | @@ -1650,9 +1650,9 @@ fn buildOutputType( |
| 1650 | .search_strategy = lib_search_strategy, | 1650 | .search_strategy = lib_search_strategy, |
| 1651 | }); | 1651 | }); |
| 1652 | } else if (mem.startsWith(u8, arg, "-D")) { | 1652 | } else if (mem.startsWith(u8, arg, "-D")) { |
| 1653 | try clang_argv.append(arena, arg); | 1653 | try cc_argv.append(arena, arg); |
| 1654 | } else if (mem.startsWith(u8, arg, "-I")) { | 1654 | } else if (mem.startsWith(u8, arg, "-I")) { |
| 1655 | try cssan.addIncludePath(arena, &clang_argv, .I, arg, arg[2..], true); | 1655 | try cssan.addIncludePath(arena, &cc_argv, .I, arg, arg[2..], true); |
| 1656 | } else if (mem.eql(u8, arg, "-x")) { | 1656 | } else if (mem.eql(u8, arg, "-x")) { |
| 1657 | const lang = args_iter.nextOrFatal(); | 1657 | const lang = args_iter.nextOrFatal(); |
| 1658 | if (mem.eql(u8, lang, "none")) { | 1658 | if (mem.eql(u8, lang, "none")) { |
| ... | @@ -1776,7 +1776,7 @@ fn buildOutputType( | ... | @@ -1776,7 +1776,7 @@ fn buildOutputType( |
| 1776 | } | 1776 | } |
| 1777 | }, | 1777 | }, |
| 1778 | .other => { | 1778 | .other => { |
| 1779 | try clang_argv.appendSlice(arena, it.other_args); | 1779 | try cc_argv.appendSlice(arena, it.other_args); |
| 1780 | }, | 1780 | }, |
| 1781 | .positional => switch (file_ext orelse Compilation.classifyFileExt(mem.sliceTo(it.only_arg, 0))) { | 1781 | .positional => switch (file_ext orelse Compilation.classifyFileExt(mem.sliceTo(it.only_arg, 0))) { |
| 1782 | .assembly, .assembly_with_cpp, .c, .cpp, .ll, .bc, .h, .m, .mm, .cu => { | 1782 | .assembly, .assembly_with_cpp, .c, .cpp, .ll, .bc, .h, .m, .mm, .cu => { |
| ... | @@ -1985,7 +1985,7 @@ fn buildOutputType( | ... | @@ -1985,7 +1985,7 @@ fn buildOutputType( |
| 1985 | { | 1985 | { |
| 1986 | mod_opts.optimize_mode = .Debug; | 1986 | mod_opts.optimize_mode = .Debug; |
| 1987 | } else { | 1987 | } else { |
| 1988 | try clang_argv.appendSlice(arena, it.other_args); | 1988 | try cc_argv.appendSlice(arena, it.other_args); |
| 1989 | } | 1989 | } |
| 1990 | }, | 1990 | }, |
| 1991 | .debug => { | 1991 | .debug => { |
| ... | @@ -1996,9 +1996,9 @@ fn buildOutputType( | ... | @@ -1996,9 +1996,9 @@ fn buildOutputType( |
| 1996 | mem.eql(u8, it.only_arg, "gline-tables-only")) | 1996 | mem.eql(u8, it.only_arg, "gline-tables-only")) |
| 1997 | { | 1997 | { |
| 1998 | // We handled with strip = false above. but we also want reduced debug info. | 1998 | // We handled with strip = false above. but we also want reduced debug info. |
| 1999 | try clang_argv.append(arena, "-gline-tables-only"); | 1999 | try cc_argv.append(arena, "-gline-tables-only"); |
| 2000 | } else { | 2000 | } else { |
| 2001 | try clang_argv.appendSlice(arena, it.other_args); | 2001 | try cc_argv.appendSlice(arena, it.other_args); |
| 2002 | } | 2002 | } |
| 2003 | }, | 2003 | }, |
| 2004 | .gdwarf32 => { | 2004 | .gdwarf32 => { |
| ... | @@ -2015,7 +2015,7 @@ fn buildOutputType( | ... | @@ -2015,7 +2015,7 @@ fn buildOutputType( |
| 2015 | } else if (mem.eql(u8, it.only_arg, "thread")) { | 2015 | } else if (mem.eql(u8, it.only_arg, "thread")) { |
| 2016 | mod_opts.sanitize_thread = true; | 2016 | mod_opts.sanitize_thread = true; |
| 2017 | } else { | 2017 | } else { |
| 2018 | try clang_argv.appendSlice(arena, it.other_args); | 2018 | try cc_argv.appendSlice(arena, it.other_args); |
| 2019 | } | 2019 | } |
| 2020 | }, | 2020 | }, |
| 2021 | .linker_script => linker_script = it.only_arg, | 2021 | .linker_script => linker_script = it.only_arg, |
| ... | @@ -2024,14 +2024,14 @@ fn buildOutputType( | ... | @@ -2024,14 +2024,14 @@ fn buildOutputType( |
| 2024 | // Have Clang print more infos, some tools such as CMake | 2024 | // Have Clang print more infos, some tools such as CMake |
| 2025 | // parse this to discover any implicit include and | 2025 | // parse this to discover any implicit include and |
| 2026 | // library dir to look-up into. | 2026 | // library dir to look-up into. |
| 2027 | try clang_argv.append(arena, "-v"); | 2027 | try cc_argv.append(arena, "-v"); |
| 2028 | }, | 2028 | }, |
| 2029 | .dry_run => { | 2029 | .dry_run => { |
| 2030 | // This flag means "dry run". Clang will not actually output anything | 2030 | // This flag means "dry run". Clang will not actually output anything |
| 2031 | // to the file system. | 2031 | // to the file system. |
| 2032 | verbose_link = true; | 2032 | verbose_link = true; |
| 2033 | disable_c_depfile = true; | 2033 | disable_c_depfile = true; |
| 2034 | try clang_argv.append(arena, "-###"); | 2034 | try cc_argv.append(arena, "-###"); |
| 2035 | }, | 2035 | }, |
| 2036 | .for_linker => try linker_args.append(it.only_arg), | 2036 | .for_linker => try linker_args.append(it.only_arg), |
| 2037 | .linker_input_z => { | 2037 | .linker_input_z => { |
| ... | @@ -2043,14 +2043,14 @@ fn buildOutputType( | ... | @@ -2043,14 +2043,14 @@ fn buildOutputType( |
| 2043 | .m => try create_module.llvm_m_args.append(arena, it.only_arg), | 2043 | .m => try create_module.llvm_m_args.append(arena, it.only_arg), |
| 2044 | .dep_file => { | 2044 | .dep_file => { |
| 2045 | disable_c_depfile = true; | 2045 | disable_c_depfile = true; |
| 2046 | try clang_argv.appendSlice(arena, it.other_args); | 2046 | try cc_argv.appendSlice(arena, it.other_args); |
| 2047 | }, | 2047 | }, |
| 2048 | .dep_file_to_stdout => { // -M, -MM | 2048 | .dep_file_to_stdout => { // -M, -MM |
| 2049 | // "Like -MD, but also implies -E and writes to stdout by default" | 2049 | // "Like -MD, but also implies -E and writes to stdout by default" |
| 2050 | // "Like -MMD, but also implies -E and writes to stdout by default" | 2050 | // "Like -MMD, but also implies -E and writes to stdout by default" |
| 2051 | c_out_mode = .preprocessor; | 2051 | c_out_mode = .preprocessor; |
| 2052 | disable_c_depfile = true; | 2052 | disable_c_depfile = true; |
| 2053 | try clang_argv.appendSlice(arena, it.other_args); | 2053 | try cc_argv.appendSlice(arena, it.other_args); |
| 2054 | }, | 2054 | }, |
| 2055 | .framework_dir => try create_module.framework_dirs.append(arena, it.only_arg), | 2055 | .framework_dir => try create_module.framework_dirs.append(arena, it.only_arg), |
| 2056 | .framework => try create_module.frameworks.put(arena, it.only_arg, .{}), | 2056 | .framework => try create_module.frameworks.put(arena, it.only_arg, .{}), |
| ... | @@ -2595,7 +2595,7 @@ fn buildOutputType( | ... | @@ -2595,7 +2595,7 @@ fn buildOutputType( |
| 2595 | }, | 2595 | }, |
| 2596 | .root_src_path = fs.path.basename(src_path), | 2596 | .root_src_path = fs.path.basename(src_path), |
| 2597 | }, | 2597 | }, |
| 2598 | .cc_argv = try clang_argv.toOwnedSlice(arena), | 2598 | .cc_argv = try cc_argv.toOwnedSlice(arena), |
| 2599 | .inherited = mod_opts, | 2599 | .inherited = mod_opts, |
| 2600 | .target_arch_os_abi = target_arch_os_abi, | 2600 | .target_arch_os_abi = target_arch_os_abi, |
| 2601 | .target_mcpu = target_mcpu, | 2601 | .target_mcpu = target_mcpu, |