]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
refactor: Simplify nested ifs
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 24 Feb 2025 19:18:35 +0000 (20:18 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 27 Feb 2025 19:31:17 +0000 (20:31 +0100)
src/ccache/argprocessing.cpp

index c10c0278d716c3930c4fb0443aaec08155043d26..c2eaa6f9d67a1ac0fa902996097340f3d83af870 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2025 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -1191,17 +1191,16 @@ process_option_arg(const Context& ctx,
   // Potentially rewrite concatenated absolute path argument to relative.
   if (arg[0] == '-') {
     const auto [option, path] = util::split_option_with_concat_path(arg);
-    if (path) {
-      if (compopt_takes_concat_arg(option) && compopt_takes_path(option)) {
-        const auto relpath = core::make_relative_path(ctx, *path);
-        std::string new_option = FMT("{}{}", option, relpath);
-        if (compopt_affects_cpp_output(option)) {
-          state.cpp_args.push_back(std::move(new_option));
-        } else {
-          state.common_args.push_back(std::move(new_option));
-        }
-        return Statistic::none;
+    if (path && compopt_takes_concat_arg(option)
+        && compopt_takes_path(option)) {
+      const auto relpath = core::make_relative_path(ctx, *path);
+      std::string new_option = FMT("{}{}", option, relpath);
+      if (compopt_affects_cpp_output(option)) {
+        state.cpp_args.push_back(std::move(new_option));
+      } else {
+        state.common_args.push_back(std::move(new_option));
       }
+      return Statistic::none;
     }
   }