clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version.  The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.

See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.

Change-Id: Ib7af6345a7b9e858700bd81645fe87d9d7e9d0fb
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/src/Utils.cpp b/src/Utils.cpp
index e3cbfeb..ac0778d 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -95,10 +95,9 @@
  * @return a string to the full path of the file to create a temp sensor with or
  * nullopt to indicate that no sensor should be created for this basename.
  */
-std::optional<std::string>
-    getFullHwmonFilePath(const std::string& directory,
-                         const std::string& hwmonBaseName,
-                         const std::set<std::string>& permitSet)
+std::optional<std::string> getFullHwmonFilePath(
+    const std::string& directory, const std::string& hwmonBaseName,
+    const std::set<std::string>& permitSet)
 {
     std::optional<std::string> result;
     std::string filename;
@@ -354,27 +353,28 @@
     conn->async_method_call(
         [conn, retries](boost::system::error_code ec,
                         const std::variant<std::string>& state) {
-        if (ec)
-        {
-            if (retries != 0U)
+            if (ec)
             {
-                auto timer = std::make_shared<boost::asio::steady_timer>(
-                    conn->get_io_context());
-                timer->expires_after(std::chrono::seconds(15));
-                timer->async_wait(
-                    [timer, conn, retries](boost::system::error_code) {
-                    getPowerStatus(conn, retries - 1);
-                });
+                if (retries != 0U)
+                {
+                    auto timer = std::make_shared<boost::asio::steady_timer>(
+                        conn->get_io_context());
+                    timer->expires_after(std::chrono::seconds(15));
+                    timer->async_wait(
+                        [timer, conn, retries](boost::system::error_code) {
+                            getPowerStatus(conn, retries - 1);
+                        });
+                    return;
+                }
+
+                // we commonly come up before power control, we'll capture the
+                // property change later
+                std::cerr << "error getting power status " << ec.message()
+                          << "\n";
                 return;
             }
-
-            // we commonly come up before power control, we'll capture the
-            // property change later
-            std::cerr << "error getting power status " << ec.message() << "\n";
-            return;
-        }
-        powerStatusOn = std::get<std::string>(state).ends_with(".Running");
-    },
+            powerStatusOn = std::get<std::string>(state).ends_with(".Running");
+        },
         power::busname, power::path, properties::interface, properties::get,
         power::interface, power::property);
 }
@@ -386,29 +386,30 @@
     conn->async_method_call(
         [conn, retries](boost::system::error_code ec,
                         const std::variant<std::string>& state) {
-        if (ec)
-        {
-            if (retries != 0U)
+            if (ec)
             {
-                auto timer = std::make_shared<boost::asio::steady_timer>(
-                    conn->get_io_context());
-                timer->expires_after(std::chrono::seconds(15));
-                timer->async_wait(
-                    [timer, conn, retries](boost::system::error_code) {
-                    getPostStatus(conn, retries - 1);
-                });
+                if (retries != 0U)
+                {
+                    auto timer = std::make_shared<boost::asio::steady_timer>(
+                        conn->get_io_context());
+                    timer->expires_after(std::chrono::seconds(15));
+                    timer->async_wait(
+                        [timer, conn, retries](boost::system::error_code) {
+                            getPostStatus(conn, retries - 1);
+                        });
+                    return;
+                }
+                // we commonly come up before power control, we'll capture the
+                // property change later
+                std::cerr << "error getting post status " << ec.message()
+                          << "\n";
                 return;
             }
-            // we commonly come up before power control, we'll capture the
-            // property change later
-            std::cerr << "error getting post status " << ec.message() << "\n";
-            return;
-        }
-        const auto& value = std::get<std::string>(state);
-        biosHasPost = (value != "Inactive") &&
-                      (value != "xyz.openbmc_project.State.OperatingSystem."
-                                "Status.OSStatus.Inactive");
-    },
+            const auto& value = std::get<std::string>(state);
+            biosHasPost = (value != "Inactive") &&
+                          (value != "xyz.openbmc_project.State.OperatingSystem."
+                                    "Status.OSStatus.Inactive");
+        },
         post::busname, post::path, properties::interface, properties::get,
         post::interface, post::property);
 }
@@ -420,28 +421,29 @@
     conn->async_method_call(
         [conn, retries](boost::system::error_code ec,
                         const std::variant<std::string>& state) {
-        if (ec)
-        {
-            if (retries != 0U)
+            if (ec)
             {
-                auto timer = std::make_shared<boost::asio::steady_timer>(
-                    conn->get_io_context());
-                timer->expires_after(std::chrono::seconds(15));
-                timer->async_wait(
-                    [timer, conn, retries](boost::system::error_code) {
-                    getChassisStatus(conn, retries - 1);
-                });
+                if (retries != 0U)
+                {
+                    auto timer = std::make_shared<boost::asio::steady_timer>(
+                        conn->get_io_context());
+                    timer->expires_after(std::chrono::seconds(15));
+                    timer->async_wait(
+                        [timer, conn, retries](boost::system::error_code) {
+                            getChassisStatus(conn, retries - 1);
+                        });
+                    return;
+                }
+
+                // we commonly come up before power control, we'll capture the
+                // property change later
+                std::cerr << "error getting chassis power status "
+                          << ec.message() << "\n";
                 return;
             }
-
-            // we commonly come up before power control, we'll capture the
-            // property change later
-            std::cerr << "error getting chassis power status " << ec.message()
-                      << "\n";
-            return;
-        }
-        chassisStatusOn = std::get<std::string>(state).ends_with(chassis::sOn);
-    },
+            chassisStatusOn =
+                std::get<std::string>(state).ends_with(chassis::sOn);
+        },
         chassis::busname, chassis::path, properties::interface, properties::get,
         chassis::interface, chassis::property);
 }
@@ -465,40 +467,40 @@
             "',path='" + std::string(power::path) + "',arg0='" +
             std::string(power::interface) + "'",
         [hostStatusCallback](sdbusplus::message_t& message) {
-        std::string objectName;
-        boost::container::flat_map<std::string, std::variant<std::string>>
-            values;
-        message.read(objectName, values);
-        auto findState = values.find(power::property);
-        if (findState != values.end())
-        {
-            bool on =
-                std::get<std::string>(findState->second).ends_with(".Running");
-            if (!on)
+            std::string objectName;
+            boost::container::flat_map<std::string, std::variant<std::string>>
+                values;
+            message.read(objectName, values);
+            auto findState = values.find(power::property);
+            if (findState != values.end())
             {
-                timer.cancel();
-                powerStatusOn = false;
-                hostStatusCallback(PowerState::on, powerStatusOn);
-                return;
+                bool on = std::get<std::string>(findState->second)
+                              .ends_with(".Running");
+                if (!on)
+                {
+                    timer.cancel();
+                    powerStatusOn = false;
+                    hostStatusCallback(PowerState::on, powerStatusOn);
+                    return;
+                }
+                // on comes too quickly
+                timer.expires_after(std::chrono::seconds(10));
+                timer.async_wait(
+                    [hostStatusCallback](boost::system::error_code ec) {
+                        if (ec == boost::asio::error::operation_aborted)
+                        {
+                            return;
+                        }
+                        if (ec)
+                        {
+                            std::cerr << "Timer error " << ec.message() << "\n";
+                            return;
+                        }
+                        powerStatusOn = true;
+                        hostStatusCallback(PowerState::on, powerStatusOn);
+                    });
             }
-            // on comes too quickly
-            timer.expires_after(std::chrono::seconds(10));
-            timer.async_wait(
-                [hostStatusCallback](boost::system::error_code ec) {
-                if (ec == boost::asio::error::operation_aborted)
-                {
-                    return;
-                }
-                if (ec)
-                {
-                    std::cerr << "Timer error " << ec.message() << "\n";
-                    return;
-                }
-                powerStatusOn = true;
-                hostStatusCallback(PowerState::on, powerStatusOn);
-            });
-        }
-    });
+        });
 
     postMatch = std::make_unique<sdbusplus::bus::match_t>(
         static_cast<sdbusplus::bus_t&>(*conn),
@@ -506,20 +508,21 @@
             "',path='" + std::string(post::path) + "',arg0='" +
             std::string(post::interface) + "'",
         [hostStatusCallback](sdbusplus::message_t& message) {
-        std::string objectName;
-        boost::container::flat_map<std::string, std::variant<std::string>>
-            values;
-        message.read(objectName, values);
-        auto findState = values.find(post::property);
-        if (findState != values.end())
-        {
-            auto& value = std::get<std::string>(findState->second);
-            biosHasPost = (value != "Inactive") &&
-                          (value != "xyz.openbmc_project.State.OperatingSystem."
-                                    "Status.OSStatus.Inactive");
-            hostStatusCallback(PowerState::biosPost, biosHasPost);
-        }
-    });
+            std::string objectName;
+            boost::container::flat_map<std::string, std::variant<std::string>>
+                values;
+            message.read(objectName, values);
+            auto findState = values.find(post::property);
+            if (findState != values.end())
+            {
+                auto& value = std::get<std::string>(findState->second);
+                biosHasPost =
+                    (value != "Inactive") &&
+                    (value != "xyz.openbmc_project.State.OperatingSystem."
+                              "Status.OSStatus.Inactive");
+                hostStatusCallback(PowerState::biosPost, biosHasPost);
+            }
+        });
 
     chassisMatch = std::make_unique<sdbusplus::bus::match_t>(
         static_cast<sdbusplus::bus_t&>(*conn),
@@ -528,40 +531,40 @@
             std::string(chassis::interface) + "'",
         [hostStatusCallback = std::move(hostStatusCallback)](
             sdbusplus::message_t& message) {
-        std::string objectName;
-        boost::container::flat_map<std::string, std::variant<std::string>>
-            values;
-        message.read(objectName, values);
-        auto findState = values.find(chassis::property);
-        if (findState != values.end())
-        {
-            bool on = std::get<std::string>(findState->second)
-                          .ends_with(chassis::sOn);
-            if (!on)
+            std::string objectName;
+            boost::container::flat_map<std::string, std::variant<std::string>>
+                values;
+            message.read(objectName, values);
+            auto findState = values.find(chassis::property);
+            if (findState != values.end())
             {
-                timerChassisOn.cancel();
-                chassisStatusOn = false;
-                hostStatusCallback(PowerState::chassisOn, chassisStatusOn);
-                return;
+                bool on = std::get<std::string>(findState->second)
+                              .ends_with(chassis::sOn);
+                if (!on)
+                {
+                    timerChassisOn.cancel();
+                    chassisStatusOn = false;
+                    hostStatusCallback(PowerState::chassisOn, chassisStatusOn);
+                    return;
+                }
+                // on comes too quickly
+                timerChassisOn.expires_after(std::chrono::seconds(10));
+                timerChassisOn.async_wait([hostStatusCallback](
+                                              boost::system::error_code ec) {
+                    if (ec == boost::asio::error::operation_aborted)
+                    {
+                        return;
+                    }
+                    if (ec)
+                    {
+                        std::cerr << "Timer error " << ec.message() << "\n";
+                        return;
+                    }
+                    chassisStatusOn = true;
+                    hostStatusCallback(PowerState::chassisOn, chassisStatusOn);
+                });
             }
-            // on comes too quickly
-            timerChassisOn.expires_after(std::chrono::seconds(10));
-            timerChassisOn.async_wait(
-                [hostStatusCallback](boost::system::error_code ec) {
-                if (ec == boost::asio::error::operation_aborted)
-                {
-                    return;
-                }
-                if (ec)
-                {
-                    std::cerr << "Timer error " << ec.message() << "\n";
-                    return;
-                }
-                chassisStatusOn = true;
-                hostStatusCallback(PowerState::chassisOn, chassisStatusOn);
-            });
-        }
-    });
+        });
     getPowerStatus(conn);
     getPostStatus(conn);
     getChassisStatus(conn);
@@ -672,21 +675,21 @@
     conn->async_method_call(
         [association, path](const boost::system::error_code ec,
                             const GetSubTreeType& subtree) {
-        // The parent of the config is always the inventory object, and may be
-        // the associated chassis. If the parent is not itself a chassis or
-        // board, the sensor is associated with the system chassis.
-        std::string parent = fs::path(path).parent_path().string();
-        if (ec)
-        {
-            // In case of error, set the default associations and
-            // initialize the association Interface.
-            setInventoryAssociation(association, parent, parent);
-            return;
-        }
-        setInventoryAssociation(
-            association, parent,
-            findContainingChassis(parent, subtree).value_or(parent));
-    },
+            // The parent of the config is always the inventory object, and may
+            // be the associated chassis. If the parent is not itself a chassis
+            // or board, the sensor is associated with the system chassis.
+            std::string parent = fs::path(path).parent_path().string();
+            if (ec)
+            {
+                // In case of error, set the default associations and
+                // initialize the association Interface.
+                setInventoryAssociation(association, parent, parent);
+                return;
+            }
+            setInventoryAssociation(
+                association, parent,
+                findContainingChassis(parent, subtree).value_or(parent));
+        },
         mapper::busName, mapper::path, mapper::interface, "GetSubTree",
         "/xyz/openbmc_project/inventory/system", 2, allInterfaces);
 }
@@ -764,62 +767,67 @@
     static std::unique_ptr<sdbusplus::bus::match_t> specialModeIntfMatch =
         std::make_unique<sdbusplus::bus::match_t>(
             conn, filterSpecialModeIntfAdd, [](sdbusplus::message_t& m) {
-        sdbusplus::message::object_path path;
-        using PropertyMap =
-            boost::container::flat_map<std::string, std::variant<std::string>>;
-        boost::container::flat_map<std::string, PropertyMap> interfaceAdded;
-        m.read(path, interfaceAdded);
-        auto intfItr = interfaceAdded.find(specialModeInterface);
-        if (intfItr == interfaceAdded.end())
-        {
-            return;
-        }
-        PropertyMap& propertyList = intfItr->second;
-        auto itr = propertyList.find("SpecialMode");
-        if (itr == propertyList.end())
-        {
-            std::cerr << "error getting  SpecialMode property "
-                      << "\n";
-            return;
-        }
-        auto* manufacturingModeStatus = std::get_if<std::string>(&itr->second);
-        handleSpecialModeChange(*manufacturingModeStatus);
-    });
+                sdbusplus::message::object_path path;
+                using PropertyMap =
+                    boost::container::flat_map<std::string,
+                                               std::variant<std::string>>;
+                boost::container::flat_map<std::string, PropertyMap>
+                    interfaceAdded;
+                m.read(path, interfaceAdded);
+                auto intfItr = interfaceAdded.find(specialModeInterface);
+                if (intfItr == interfaceAdded.end())
+                {
+                    return;
+                }
+                PropertyMap& propertyList = intfItr->second;
+                auto itr = propertyList.find("SpecialMode");
+                if (itr == propertyList.end())
+                {
+                    std::cerr << "error getting  SpecialMode property "
+                              << "\n";
+                    return;
+                }
+                auto* manufacturingModeStatus =
+                    std::get_if<std::string>(&itr->second);
+                handleSpecialModeChange(*manufacturingModeStatus);
+            });
 
     const std::string filterSpecialModeChange =
         rules::type::signal() + rules::member("PropertiesChanged") +
         rules::interface("org.freedesktop.DBus.Properties") +
         rules::argN(0, specialModeInterface);
     static std::unique_ptr<sdbusplus::bus::match_t> specialModeChangeMatch =
-        std::make_unique<sdbusplus::bus::match_t>(conn, filterSpecialModeChange,
-                                                  [](sdbusplus::message_t& m) {
-        std::string interfaceName;
-        boost::container::flat_map<std::string, std::variant<std::string>>
-            propertiesChanged;
+        std::make_unique<sdbusplus::bus::match_t>(
+            conn, filterSpecialModeChange, [](sdbusplus::message_t& m) {
+                std::string interfaceName;
+                boost::container::flat_map<std::string,
+                                           std::variant<std::string>>
+                    propertiesChanged;
 
-        m.read(interfaceName, propertiesChanged);
-        auto itr = propertiesChanged.find("SpecialMode");
-        if (itr == propertiesChanged.end())
-        {
-            return;
-        }
-        auto* manufacturingModeStatus = std::get_if<std::string>(&itr->second);
-        handleSpecialModeChange(*manufacturingModeStatus);
-    });
+                m.read(interfaceName, propertiesChanged);
+                auto itr = propertiesChanged.find("SpecialMode");
+                if (itr == propertiesChanged.end())
+                {
+                    return;
+                }
+                auto* manufacturingModeStatus =
+                    std::get_if<std::string>(&itr->second);
+                handleSpecialModeChange(*manufacturingModeStatus);
+            });
 
     conn.async_method_call(
         [](const boost::system::error_code ec,
            const std::variant<std::string>& getManufactMode) {
-        if (ec)
-        {
-            std::cerr << "error getting  SpecialMode status " << ec.message()
-                      << "\n";
-            return;
-        }
-        const auto* manufacturingModeStatus =
-            std::get_if<std::string>(&getManufactMode);
-        handleSpecialModeChange(*manufacturingModeStatus);
-    },
+            if (ec)
+            {
+                std::cerr << "error getting  SpecialMode status "
+                          << ec.message() << "\n";
+                return;
+            }
+            const auto* manufacturingModeStatus =
+                std::get_if<std::string>(&getManufactMode);
+            handleSpecialModeChange(*manufacturingModeStatus);
+        },
         "xyz.openbmc_project.SpecialMode",
         "/xyz/openbmc_project/security/special_mode",
         "org.freedesktop.DBus.Properties", "Get", specialModeInterface,