From 129c76655cc6adcf72dcb917df8c0feb061c5d1b Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Fri, 7 Jun 2024 16:30:12 +0200 Subject: [PATCH] refactor: Convert Context::i_tmpfile to fs::path --- src/ccache/Context.hpp | 2 +- src/ccache/ccache.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ccache/Context.hpp b/src/ccache/Context.hpp index 83ed89e3..aad606b9 100644 --- a/src/ccache/Context.hpp +++ b/src/ccache/Context.hpp @@ -74,7 +74,7 @@ public: bool diagnostics_color_failed = false; // The name of the temporary preprocessed file. - std::string i_tmpfile; + std::filesystem::path i_tmpfile; // The preprocessor's stderr output. util::Bytes cpp_stderr_data; diff --git a/src/ccache/ccache.cpp b/src/ccache/ccache.cpp index d26d7632..b9c2df31 100644 --- a/src/ccache/ccache.cpp +++ b/src/ccache/ccache.cpp @@ -463,7 +463,7 @@ print_included_files(const Context& ctx, FILE* fp) // when computing the hash sum. // - Stores the paths and hashes of included files in ctx.included_files. static tl::expected -process_preprocessed_file(Context& ctx, Hash& hash, const std::string& path) +process_preprocessed_file(Context& ctx, Hash& hash, const fs::path& path) { auto data = util::read_file(path); if (!data) { @@ -1285,13 +1285,13 @@ to_cache(Context& ctx, static tl::expected get_result_key_from_cpp(Context& ctx, Args& args, Hash& hash) { - std::string preprocessed_path; + fs::path preprocessed_path; util::Bytes cpp_stderr_data; 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. - preprocessed_path = util::pstr(ctx.args_info.input_file); + preprocessed_path = ctx.args_info.input_file; } else { // Run cpp on the input file to obtain the .i. @@ -1301,7 +1301,7 @@ get_result_key_from_cpp(Context& ctx, Args& args, Hash& hash) util::value_or_throw(util::TemporaryFile::create( FMT("{}/cpp_stdout", ctx.config.temporary_dir()), FMT(".{}", ctx.config.cpp_extension()))); - preprocessed_path = tmp_stdout.path.string(); + preprocessed_path = tmp_stdout.path; tmp_stdout.fd.close(); // We're only using the path. ctx.register_pending_tmp_file(preprocessed_path); -- 2.47.2