From: Joel Rosdahl Date: Sat, 22 Feb 2020 12:33:37 +0000 (+0100) Subject: Simplify setting of ctx.args_info.profile_dir default value X-Git-Tag: v4.0~603 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4f9f4c7d3af8769b820ba2ab61b8046f11e42b14;p=thirdparty%2Fccache.git Simplify setting of ctx.args_info.profile_dir default value --- 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; }