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: Ie029f7917035731dc2a3fd61c8bbd55685de6278
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d43e884..28e3328 100644
--- a/.clang-format
+++ b/.clang-format
@@ -87,7 +87,7 @@
 IndentWrappedFunctionNames: true
 InsertNewlineAtEOF: true
 KeepEmptyLinesAtTheStartOfBlocks: false
-LambdaBodyIndentation: OuterScope
+LambdaBodyIndentation: Signature
 LineEnding: LF
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
@@ -98,13 +98,14 @@
 ObjCSpaceBeforeProtocolList: true
 PackConstructorInitializers: BinPack
 PenaltyBreakAssignment: 25
-PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakBeforeFirstCallParameter: 50
 PenaltyBreakComment: 300
 PenaltyBreakFirstLessLess: 120
 PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
-PenaltyIndentedWhitespace: 0
+PenaltyIndentedWhitespace: 1
 PointerAlignment: Left
 QualifierAlignment: Left
 ReferenceAlignment: Left
diff --git a/dump/create_pel.cpp b/dump/create_pel.cpp
index d92e570..90a7ea7 100644
--- a/dump/create_pel.cpp
+++ b/dump/create_pel.cpp
@@ -70,11 +70,11 @@
     }
     try
     {
-        auto service = util::getService(bus, opLoggingInterface,
-                                        loggingObjectPath);
-        auto method = bus.new_method_call(service.c_str(), loggingObjectPath,
-                                          opLoggingInterface,
-                                          "CreatePELWithFFDCFiles");
+        auto service =
+            util::getService(bus, opLoggingInterface, loggingObjectPath);
+        auto method =
+            bus.new_method_call(service.c_str(), loggingObjectPath,
+                                opLoggingInterface, "CreatePELWithFFDCFiles");
         auto level =
             sdbusplus::xyz::openbmc_project::Logging::server::convertForMessage(
                 severity);
diff --git a/dump/dump_collect_main.cpp b/dump/dump_collect_main.cpp
index dc6562b..319309a 100644
--- a/dump/dump_collect_main.cpp
+++ b/dump/dump_collect_main.cpp
@@ -30,9 +30,9 @@
 
     app.add_option("--type, -t", type, "Type of the dump")
         ->required()
-        ->check(CLI::IsMember({SBE_DUMP_TYPE_HARDWARE, SBE_DUMP_TYPE_HOSTBOOT,
-                               SBE_DUMP_TYPE_SBE, SBE_DUMP_TYPE_PERFORMANCE,
-                               SBE_DUMP_TYPE_MSBE}));
+        ->check(CLI::IsMember(
+            {SBE_DUMP_TYPE_HARDWARE, SBE_DUMP_TYPE_HOSTBOOT, SBE_DUMP_TYPE_SBE,
+             SBE_DUMP_TYPE_PERFORMANCE, SBE_DUMP_TYPE_MSBE}));
 
     app.add_option("--id, -i", id, "ID of the dump")->required();
 
diff --git a/dump/dump_monitor.cpp b/dump/dump_monitor.cpp
index 0afe7ca..4a9a357 100644
--- a/dump/dump_monitor.cpp
+++ b/dump/dump_monitor.cpp
@@ -28,8 +28,8 @@
 
     uint32_t dumpId = std::strtoul(dumpIdStr.c_str(), nullptr, 16);
     int dumpType = getDumpTypeFromId(dumpId);
-    std::filesystem::path dumpPath = std::filesystem::path(dumpOutPath) /
-                                     dumpIdStr;
+    std::filesystem::path dumpPath =
+        std::filesystem::path(dumpOutPath) / dumpIdStr;
 
     // Add type, ID, and dump path to args
     args.push_back("-t");
diff --git a/dump/dump_utils.cpp b/dump/dump_utils.cpp
index 18c1d3f..74ec563 100644
--- a/dump/dump_utils.cpp
+++ b/dump/dump_utils.cpp
@@ -23,25 +23,25 @@
         sdbusplus::bus::match::rules::propertiesChanged(
             path, "xyz.openbmc_project.Common.Progress"),
         [&](sdbusplus::message_t& msg) {
-        std::string interface;
-        std::map<std::string, std::variant<std::string, uint8_t>> property;
-        msg.read(interface, property);
+            std::string interface;
+            std::map<std::string, std::variant<std::string, uint8_t>> property;
+            msg.read(interface, property);
 
-        const auto dumpStatus = property.find("Status");
-        if (dumpStatus != property.end())
-        {
-            const std::string* status =
-                std::get_if<std::string>(&(dumpStatus->second));
-            if (status &&
-                *status !=
-                    "xyz.openbmc_project.Common.Progress.OperationStatus.InProgress")
+            const auto dumpStatus = property.find("Status");
+            if (dumpStatus != property.end())
             {
-                lg2::info("Dump status({STATUS}) : path={PATH}", "STATUS",
-                          status->c_str(), "PATH", path.c_str());
-                inProgress = false;
+                const std::string* status =
+                    std::get_if<std::string>(&(dumpStatus->second));
+                if (status &&
+                    *status !=
+                        "xyz.openbmc_project.Common.Progress.OperationStatus.InProgress")
+                {
+                    lg2::info("Dump status({STATUS}) : path={PATH}", "STATUS",
+                              status->c_str(), "PATH", path.c_str());
+                    inProgress = false;
+                }
             }
-        }
-    });
+        });
 
     // Timeout management
     for (uint32_t secondsCount = 0; inProgress && secondsCount < timeout;
@@ -74,8 +74,8 @@
     {
         auto bus = sdbusplus::bus::new_default();
         auto service = getService(bus, interface, path);
-        auto method = bus.new_method_call(service.c_str(), path, interface,
-                                          function);
+        auto method =
+            bus.new_method_call(service.c_str(), path, interface, function);
 
         std::unordered_map<std::string, std::variant<std::string, uint64_t>>
             createParams = {
diff --git a/dump/sbe_dump_collector.cpp b/dump/sbe_dump_collector.cpp
index 0a821a0..b0b3c75 100644
--- a/dump/sbe_dump_collector.cpp
+++ b/dump/sbe_dump_collector.cpp
@@ -142,9 +142,10 @@
 
     for (const auto& [procTarget, ocmbTargets] : targetMap)
     {
-        auto future = std::async(std::launch::async,
-                                 [this, procTarget, ocmbTargets, path, id, type,
-                                  cstate, failingUnit]() {
+        auto future = std::async(std::launch::async, [this, procTarget,
+                                                      ocmbTargets, path, id,
+                                                      type, cstate,
+                                                      failingUnit]() {
             try
             {
                 this->collectDumpFromSBE(procTarget, path, id, type, cstate,
@@ -273,11 +274,9 @@
     return isDumpFailure;
 }
 
-void SbeDumpCollector::collectDumpFromSBE(struct pdbg_target* chip,
-                                          const std::filesystem::path& path,
-                                          uint32_t id, uint8_t type,
-                                          uint8_t clockState,
-                                          uint64_t failingUnit)
+void SbeDumpCollector::collectDumpFromSBE(
+    struct pdbg_target* chip, const std::filesystem::path& path, uint32_t id,
+    uint8_t type, uint8_t clockState, uint64_t failingUnit)
 {
     auto chipPos = pdbg_target_index(chip);
     SBETypes sbeType = getSBEType(chip);
diff --git a/dump/sbe_dump_collector.hpp b/dump/sbe_dump_collector.hpp
index b926203..1cb2348 100644
--- a/dump/sbe_dump_collector.hpp
+++ b/dump/sbe_dump_collector.hpp
@@ -152,10 +152,9 @@
      * @return uint8_t - Returns 1 if fastarray collection is needed, 0
      * otherwise.
      */
-    inline uint8_t checkFastarrayCollectionNeeded(const uint8_t clockState,
-                                                  const uint8_t type,
-                                                  uint64_t failingUnit,
-                                                  const uint8_t chipPos) const
+    inline uint8_t checkFastarrayCollectionNeeded(
+        const uint8_t clockState, const uint8_t type, uint64_t failingUnit,
+        const uint8_t chipPos) const
     {
         using namespace openpower::dump::SBE;
 
diff --git a/watchdog/ffdc_file.cpp b/watchdog/ffdc_file.cpp
index 6aa4a00..62cb1e5 100644
--- a/watchdog/ffdc_file.cpp
+++ b/watchdog/ffdc_file.cpp
@@ -41,8 +41,8 @@
     int fd = open(tempFile.getPath().c_str(), O_RDWR);
     if (fd == -1)
     {
-        throw std::runtime_error{std::string{"Unable to open FFDC file: "} +
-                                 strerror(errno)};
+        throw std::runtime_error{
+            std::string{"Unable to open FFDC file: "} + strerror(errno)};
     }
 
     ssize_t rc = write(fd, calloutData.c_str(), calloutData.size());
diff --git a/watchdog/utils.cpp b/watchdog/utils.cpp
index a66fc8e..ae4a80b 100644
--- a/watchdog/utils.cpp
+++ b/watchdog/utils.cpp
@@ -16,8 +16,8 @@
 TemporaryFile::TemporaryFile()
 {
     // Build template path required by mkstemp()
-    std::string templatePath = fs::temp_directory_path() /
-                               "openpower-debug-collector-XXXXXX";
+    std::string templatePath =
+        fs::temp_directory_path() / "openpower-debug-collector-XXXXXX";
 
     // Generate unique file name, create file, and open it.  The XXXXXX
     // characters are replaced by mkstemp() to make the file name unique.
diff --git a/watchdog/watchdog_dbus.cpp b/watchdog/watchdog_dbus.cpp
index 87aa3f9..c3a797d 100644
--- a/watchdog/watchdog_dbus.cpp
+++ b/watchdog/watchdog_dbus.cpp
@@ -51,16 +51,16 @@
             if (extended == "")
             {
                 // return the method
-                method = bus.new_method_call(service.c_str(), path.c_str(),
-                                             interface.c_str(),
-                                             function.c_str());
+                method =
+                    bus.new_method_call(service.c_str(), path.c_str(),
+                                        interface.c_str(), function.c_str());
             }
             else
             {
                 // return extended method
-                method = bus.new_method_call(service.c_str(), path.c_str(),
-                                             extended.c_str(),
-                                             function.c_str());
+                method =
+                    bus.new_method_call(service.c_str(), path.c_str(),
+                                        extended.c_str(), function.c_str());
             }
 
             rc = RC_SUCCESS;
diff --git a/watchdog/watchdog_handler.cpp b/watchdog/watchdog_handler.cpp
index ec58402..2a2b245 100644
--- a/watchdog/watchdog_handler.cpp
+++ b/watchdog/watchdog_handler.cpp
@@ -81,8 +81,8 @@
             sdbusplus::bus::match::rules::propertiesChanged(
                 path.c_str(), matchInterface.c_str()),
             [&](auto& msg) {
-        return dumpStatusChanged(msg, path, progressStatus);
-    });
+                return dumpStatusChanged(msg, path, progressStatus);
+            });
 
     // wait for dump status to be completed (complete == true)
     // or until timeout interval