std::string thinlto_index = arg.substr(arg.find('=') + 1);
args_info.thinlto_index_path = thinlto_index;
// Thinlto backend phase, the extension of input file is .o but the file is
- // IR. So treat it as assembler file.
- args_info.actual_language = "assembler";
+ // IR.
+ args_info.actual_language = "ir";
state.add_common_arg(args[i]);
return Statistic::none;
}
return tl::unexpected(Statistic::unsupported_source_language);
}
- if (args_info.actual_language == "assembler") {
- // -MD/-MMD for assembler file does not produce a dependency file.
+ if (args_info.actual_language == "assembler"
+ || args_info.actual_language == "ir") {
+ // -MD/-MMD do not produce a dependency file.
args_info.generating_dependencies = false;
}
- args_info.direct_i_file = language_is_preprocessed(args_info.actual_language);
+ args_info.preprocess_input_file =
+ !language_is_preprocessed(args_info.actual_language);
- if (config.cpp_extension().empty()) {
+ if (!args_info.preprocess_input_file) {
+ config.set_cpp_extension(
+ util::pstr(args_info.input_file.extension()).str().substr(1));
+ } else if (config.cpp_extension().empty()) {
std::string p_language = p_language_for_language(args_info.actual_language);
config.set_cpp_extension(extension_for_language(p_language).substr(1));
}
-// Copyright (C) 2020-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2026 Joel Rosdahl and other contributors
//
// See doc/authors.adoc for a complete list of contributors.
//
// Have we seen -gsplit-dwarf?
bool seen_split_dwarf = false;
- // Are we compiling a .i or .ii file directly?
- bool direct_i_file = false;
+ // Should we run the preprocessor on the input file? False for .i/.ii files,
+ // assembler or ThinLTO backend phase.
+ bool preprocess_input_file = true;
// Whether the output is a precompiled header.
bool output_is_precompiled_header = false;
const bool capture_stdout = is_clang_cu;
- if (ctx.args_info.direct_i_file) {
- // We are compiling a .i or .ii file - that means we can skip the cpp stage
- // and directly form the correct i_tmpfile.
+ if (!ctx.args_info.preprocess_input_file) {
+ // We are compiling a file that should be used as is (not be preprocessed).
preprocessed_path = ctx.args_info.input_file;
} else {
// Run cpp on the input file to obtain the .i.
-// Copyright (C) 2010-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2010-2026 Joel Rosdahl and other contributors
//
// See doc/authors.adoc for a complete list of contributors.
//
{"objective-c++-cpp-output", "objective-c++-cpp-output"},
{"assembler-with-cpp", "assembler" },
{"assembler", "assembler" },
+ {"ir", "ir" }, // Clang ThinLTO
{nullptr, nullptr },
};