From 4f9f4c7d3af8769b820ba2ab61b8046f11e42b14 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sat, 22 Feb 2020 13:33:37 +0100 Subject: [PATCH] Simplify setting of ctx.args_info.profile_dir default value --- src/ccache.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ccache.cpp b/src/ccache.cpp index 44e96c632..078e2afed 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -1891,9 +1891,6 @@ calculate_result_name(Context& ctx, // The profile directory can be specified as an argument to // -fprofile-generate=, -fprofile-use= or -fprofile-dir=. if (ctx.args_info.profile_generate) { - if (ctx.args_info.profile_dir.empty()) { - ctx.args_info.profile_dir = ctx.apparent_cwd; - } cc_log("Adding profile directory %s to our hash", ctx.args_info.profile_dir.c_str()); hash_delimiter(hash, "-fprofile-dir"); @@ -1902,9 +1899,6 @@ calculate_result_name(Context& ctx, if (ctx.args_info.profile_use) { // Calculate gcda name. - if (ctx.args_info.profile_dir.empty()) { - ctx.args_info.profile_dir = ctx.apparent_cwd; - } string_view base_name = Util::remove_extension(ctx.args_info.output_obj); std::string gcda_name = fmt::format("{}/{}.gcda", ctx.args_info.profile_dir, base_name); @@ -3025,6 +3019,10 @@ process_args(Context& ctx, } } + if (args_info.profile_dir.empty()) { + args_info.profile_dir = ctx.apparent_cwd; + } + if (explicit_language && str_eq(explicit_language, "none")) { explicit_language = nullptr; } -- 2.47.3