]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Simplify setting of ctx.args_info.profile_dir default value
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 22 Feb 2020 12:33:37 +0000 (13:33 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 22 Feb 2020 20:53:27 +0000 (21:53 +0100)
src/ccache.cpp

index 44e96c63283d2b6824517107213ace5ce7547175..078e2afed180de82d0a9282b3e6a249ea054e021 100644 (file)
@@ -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;
   }