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/IntelCPUSensorMain.cpp b/src/IntelCPUSensorMain.cpp
index 7d14915..4ad0853 100644
--- a/src/IntelCPUSensorMain.cpp
+++ b/src/IntelCPUSensorMain.cpp
@@ -82,8 +82,7 @@
 {
     CPUConfig(const uint64_t& bus, const uint64_t& addr,
               const std::string& name, const State& state) :
-        bus(bus),
-        addr(addr), name(name), state(state)
+        bus(bus), addr(addr), name(name), state(state)
     {}
     int bus;
     int addr;
@@ -140,20 +139,20 @@
     bool isWordEnd = true;
     std::transform(sensorName.begin(), sensorName.end(), sensorName.begin(),
                    [&isWordEnd](int c) {
-        if (std::isspace(c) != 0)
-        {
-            isWordEnd = true;
-        }
-        else
-        {
-            if (isWordEnd)
-            {
-                isWordEnd = false;
-                return std::toupper(c);
-            }
-        }
-        return c;
-    });
+                       if (std::isspace(c) != 0)
+                       {
+                           isWordEnd = true;
+                       }
+                       else
+                       {
+                           if (isWordEnd)
+                           {
+                               isWordEnd = false;
+                               return std::toupper(c);
+                           }
+                       }
+                       return c;
+                   });
     return sensorName;
 }
 
@@ -304,8 +303,8 @@
             std::cerr << "could not determine CPU ID for " << hwmonName << "\n";
             continue;
         }
-        int cpuId = std::visit(VariantToUnsignedIntVisitor(),
-                               findCpuId->second);
+        int cpuId =
+            std::visit(VariantToUnsignedIntVisitor(), findCpuId->second);
 
         auto directory = hwmonNamePath.parent_path();
         std::vector<fs::path> inputPaths;
@@ -326,8 +325,8 @@
             }
             auto& [type, nr, item] = *fileParts;
             auto inputPathStr = inputPath.string();
-            auto labelPath = boost::replace_all_copy(inputPathStr, item,
-                                                     "label");
+            auto labelPath =
+                boost::replace_all_copy(inputPathStr, item, "label");
             std::ifstream labelFile(labelPath);
             if (!labelFile.good())
             {
@@ -569,8 +568,8 @@
 
                 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
                 if (peci_RdPkgConfig(config.addr, PECI_MBX_INDEX_DDR_DIMM_TEMP,
-                                     rank, 4, pkgConfig.data(),
-                                     &cc) == PECI_CC_SUCCESS)
+                                     rank, 4, pkgConfig.data(), &cc) ==
+                    PECI_CC_SUCCESS)
                 {
                     // Depending on CPU generation, both 0 and 0xFF can be used
                     // to indicate no DIMM presence
@@ -607,8 +606,8 @@
                     uint8_t cc = 0;
 
                     if (peci_RdPkgConfig(config.addr, PECI_MBX_INDEX_CPU_ID, 0,
-                                         4, pkgConfig.data(),
-                                         &cc) == PECI_CC_SUCCESS)
+                                         4, pkgConfig.data(), &cc) ==
+                        PECI_CC_SUCCESS)
                     {
                         std::cout << config.name << " is detected\n";
                         if (!exportDevice(config))
@@ -629,8 +628,8 @@
                 else if (newState == State::READY)
                 {
                     rescanDelaySeconds = 5;
-                    std::cout << "DIMM(s) on " << config.name
-                              << " is/are detected\n";
+                    std::cout
+                        << "DIMM(s) on " << config.name << " is/are detected\n";
                 }
             }
 
@@ -729,10 +728,10 @@
                 {
                     continue;
                 }
-                std::string nameRaw = std::visit(VariantToStringVisitor(),
-                                                 findName->second);
-                std::string name = std::regex_replace(nameRaw, illegalDbusRegex,
-                                                      "_");
+                std::string nameRaw =
+                    std::visit(VariantToStringVisitor(), findName->second);
+                std::string name =
+                    std::regex_replace(nameRaw, illegalDbusRegex, "_");
 
                 auto present = std::optional<bool>();
                 // if we can't detect it via gpio, we set presence later
@@ -763,14 +762,14 @@
                     std::cerr << "Can't find 'Bus' setting in " << name << "\n";
                     continue;
                 }
-                uint64_t bus = std::visit(VariantToUnsignedIntVisitor(),
-                                          findBus->second);
+                uint64_t bus =
+                    std::visit(VariantToUnsignedIntVisitor(), findBus->second);
 
                 auto findAddress = cfg.find("Address");
                 if (findAddress == cfg.end())
                 {
-                    std::cerr << "Can't find 'Address' setting in " << name
-                              << "\n";
+                    std::cerr
+                        << "Can't find 'Address' setting in " << name << "\n";
                     continue;
                 }
                 uint64_t addr = std::visit(VariantToUnsignedIntVisitor(),
@@ -828,33 +827,33 @@
 
     std::function<void(sdbusplus::message_t&)> eventHandler =
         [&](sdbusplus::message_t& message) {
-        if (message.is_method_error())
-        {
-            std::cerr << "callback method error\n";
-            return;
-        }
-
-        if (debug)
-        {
-            std::cout << message.get_path() << " is changed\n";
-        }
-
-        // this implicitly cancels the timer
-        filterTimer.expires_after(std::chrono::seconds(1));
-        filterTimer.async_wait([&](const boost::system::error_code& ec) {
-            if (ec == boost::asio::error::operation_aborted)
+            if (message.is_method_error())
             {
-                return; // we're being canceled
+                std::cerr << "callback method error\n";
+                return;
             }
 
-            if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs,
-                             objectServer))
+            if (debug)
             {
-                detectCpuAsync(pingTimer, creationTimer, io, objectServer,
-                               systemBus, cpuConfigs, sensorConfigs);
+                std::cout << message.get_path() << " is changed\n";
             }
-        });
-    };
+
+            // this implicitly cancels the timer
+            filterTimer.expires_after(std::chrono::seconds(1));
+            filterTimer.async_wait([&](const boost::system::error_code& ec) {
+                if (ec == boost::asio::error::operation_aborted)
+                {
+                    return; // we're being canceled
+                }
+
+                if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs,
+                                 objectServer))
+                {
+                    detectCpuAsync(pingTimer, creationTimer, io, objectServer,
+                                   systemBus, cpuConfigs, sensorConfigs);
+                }
+            });
+        };
 
     std::vector<std::unique_ptr<sdbusplus::bus::match_t>> matches =
         setupPropertiesChangedMatches(*systemBus, sensorTypes, eventHandler);