// The path to the dependency file (implicit or specified with -MFdepfile,
// -Wp,-MD,depfile or -Wp,-MMD,depfile).
- std::string output_dep;
+ std::filesystem::path output_dep;
// The path to the stack usage (implicit when using -fstack-usage).
std::string output_su;
#include <ccache/util/assertions.hpp>
#include <ccache/util/file.hpp>
#include <ccache/util/filesystem.hpp>
+#include <ccache/util/format.hpp>
#include <ccache/util/logging.hpp>
#include <ccache/util/path.hpp>
#include <ccache/util/string.hpp>
return; // nothing to do
}
- const std::string& output_dep = ctx.args_info.output_dep;
+ const auto& output_dep = ctx.args_info.output_dep;
const auto content = util::read_file<std::string>(output_dep);
if (!content) {
LOG("Failed to read dependency file {}: {}", output_dep, content.error());
if (state.output_dep_origin <= OutputDepOrigin::mf) {
state.output_dep_origin = OutputDepOrigin::mf;
- args_info.output_dep =
- util::pstr(core::make_relative_path(ctx, dep_file));
+ args_info.output_dep = core::make_relative_path(ctx, dep_file);
}
// Keep the format of the args the same.
if (separate_argument) {
state.dep_args.push_back("-MF");
state.dep_args.push_back(args_info.output_dep);
} else {
- state.dep_args.push_back("-MF" + args_info.output_dep);
+ state.dep_args.push_back(FMT("-MF{}", args_info.output_dep));
}
return Statistic::none;
}
if (args_info.generating_dependencies) {
if (state.output_dep_origin == OutputDepOrigin::none) {
- args_info.output_dep =
- util::pstr(util::with_extension(args_info.output_obj, ".d"));
+ args_info.output_dep = util::with_extension(args_info.output_obj, ".d");
if (!config.run_second_cpp()) {
// If we're compiling preprocessed code we're sending dep_args to the
// preprocessor so we need to use -MF to write to the correct .d file