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: I7c1a903d0b8fe5df2da9a73bda2d84113e9d854d
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/ipmi.cpp b/ipmi.cpp
index 3151559..5718e3c 100644
--- a/ipmi.cpp
+++ b/ipmi.cpp
@@ -256,8 +256,8 @@
     }
     std::memcpy(&request, data.data(), sizeof(request));
 
-    std::vector<uint8_t> result = mgr->read(request.sessionId, request.offset,
-                                            request.requestedSize);
+    std::vector<uint8_t> result =
+        mgr->read(request.sessionId, request.offset, request.requestedSize);
 
     /* If the Read fails, it returns success but with only the crc and 0 bytes
      * of data.
diff --git a/main.cpp b/main.cpp
index b34e52c..0e36533 100644
--- a/main.cpp
+++ b/main.cpp
@@ -48,15 +48,16 @@
                  "Registering OEM:[%#08X], Cmd:[%#04X] for Blob Commands\n",
                  oem::obmcOemNumber, oem::Cmd::blobTransferCmd);
 
-    ipmi::registerOemHandler(ipmi::prioOemBase, oem::obmcOemNumber,
-                             oem::Cmd::blobTransferCmd, ::ipmi::Privilege::User,
-                             [](ipmi::Context::ptr ctx, uint8_t cmd,
-                                const std::vector<uint8_t>& data) {
-        // Get current IPMI channel and get the max transfer size
-        // (assuming that it does not change).
-        return handleBlobCommand(cmd, data,
-                                 ipmi::getChannelMaxTransferSize(ctx->channel));
-    });
+    ipmi::registerOemHandler(
+        ipmi::prioOemBase, oem::obmcOemNumber, oem::Cmd::blobTransferCmd,
+        ::ipmi::Privilege::User,
+        [](ipmi::Context::ptr ctx, uint8_t cmd,
+           const std::vector<uint8_t>& data) {
+            // Get current IPMI channel and get the max transfer size
+            // (assuming that it does not change).
+            return handleBlobCommand(
+                cmd, data, ipmi::getChannelMaxTransferSize(ctx->channel));
+        });
 
     /* Install handlers. */
     try
diff --git a/manager.cpp b/manager.cpp
index ba019d4..0a274c2 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -256,8 +256,8 @@
     return nullptr;
 }
 
-GenericBlobInterface* BlobManager::getActionHandler(uint16_t session,
-                                                    uint16_t requiredFlags)
+GenericBlobInterface*
+    BlobManager::getActionHandler(uint16_t session, uint16_t requiredFlags)
 {
     if (auto item = sessions.find(session);
         item != sessions.end() && (item->second.flags & requiredFlags))
diff --git a/manager.hpp b/manager.hpp
index 02b9e8a..fbb272d 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -21,9 +21,7 @@
 {
     SessionInfo() = default;
     SessionInfo(const std::string& path, GenericBlobInterface* handler,
-                uint16_t flags) :
-        blobId(path),
-        handler(handler), flags(flags)
+                uint16_t flags) : blobId(path), handler(handler), flags(flags)
     {}
     ~SessionInfo() = default;
 
diff --git a/test/helper.hpp b/test/helper.hpp
index ac2c572..64aaefc 100644
--- a/test/helper.hpp
+++ b/test/helper.hpp
@@ -10,7 +10,6 @@
 
 namespace blobs
 {
-std::vector<std::uint8_t>
-    validateReply(ipmi::RspType<std::vector<uint8_t>> reply,
-                  bool hasData = true);
+std::vector<std::uint8_t> validateReply(
+    ipmi::RspType<std::vector<uint8_t>> reply, bool hasData = true);
 } // namespace blobs
diff --git a/test/ipmi_open_unittest.cpp b/test/ipmi_open_unittest.cpp
index cdd4dc3..b938cbe 100644
--- a/test/ipmi_open_unittest.cpp
+++ b/test/ipmi_open_unittest.cpp
@@ -77,9 +77,9 @@
 
     EXPECT_CALL(mgr, open(req.flags, StrEq(blobId), NotNull()))
         .WillOnce(Invoke([&](uint16_t, const std::string&, uint16_t* session) {
-        (*session) = returnedSession;
-        return true;
-    }));
+            (*session) = returnedSession;
+            return true;
+        }));
 
     auto result = validateReply(openBlob(&mgr, request));
 
diff --git a/test/ipmi_sessionstat_unittest.cpp b/test/ipmi_sessionstat_unittest.cpp
index 56171f2..3278f25 100644
--- a/test/ipmi_sessionstat_unittest.cpp
+++ b/test/ipmi_sessionstat_unittest.cpp
@@ -64,10 +64,10 @@
     EXPECT_CALL(mgr, stat(Matcher<uint16_t>(req.sessionId),
                           Matcher<BlobMeta*>(NotNull())))
         .WillOnce(Invoke([&](uint16_t, BlobMeta* meta) {
-        meta->blobState = blobState;
-        meta->size = size;
-        return true;
-    }));
+            meta->blobState = blobState;
+            meta->size = size;
+            return true;
+        }));
 
     auto result = validateReply(sessionStatBlob(&mgr, request));
 
@@ -105,9 +105,9 @@
     EXPECT_CALL(mgr, stat(Matcher<uint16_t>(req.sessionId),
                           Matcher<BlobMeta*>(NotNull())))
         .WillOnce(Invoke([&](uint16_t, BlobMeta* meta) {
-        (*meta) = lmeta;
-        return true;
-    }));
+            (*meta) = lmeta;
+            return true;
+        }));
 
     auto result = validateReply(sessionStatBlob(&mgr, request));
 
diff --git a/test/ipmi_stat_unittest.cpp b/test/ipmi_stat_unittest.cpp
index aab3a76..ab091ad 100644
--- a/test/ipmi_stat_unittest.cpp
+++ b/test/ipmi_stat_unittest.cpp
@@ -88,10 +88,10 @@
     EXPECT_CALL(mgr, stat(Matcher<const std::string&>(StrEq(blobId)),
                           Matcher<BlobMeta*>(NotNull())))
         .WillOnce(Invoke([&](const std::string&, BlobMeta* meta) {
-        meta->blobState = blobState;
-        meta->size = size;
-        return true;
-    }));
+            meta->blobState = blobState;
+            meta->size = size;
+            return true;
+        }));
 
     auto result = validateReply(statBlob(&mgr, request));
 
@@ -131,9 +131,9 @@
     EXPECT_CALL(mgr, stat(Matcher<const std::string&>(StrEq(blobId)),
                           Matcher<BlobMeta*>(NotNull())))
         .WillOnce(Invoke([&](const std::string&, BlobMeta* meta) {
-        (*meta) = lmeta;
-        return true;
-    }));
+            (*meta) = lmeta;
+            return true;
+        }));
 
     auto result = validateReply(statBlob(&mgr, request));
 
diff --git a/test/ipmi_unittest.cpp b/test/ipmi_unittest.cpp
index ed2f026..4364b89 100644
--- a/test/ipmi_unittest.cpp
+++ b/test/ipmi_unittest.cpp
@@ -43,8 +43,9 @@
     // return it.
     std::string request = "asdf";
     request.push_back('\0');
-    EXPECT_STREQ("asdf", stringFromBuffer(std::vector<uint8_t>(request.begin(),
-                                                               request.end()))
-                             .c_str());
+    EXPECT_STREQ(
+        "asdf",
+        stringFromBuffer(std::vector<uint8_t>(request.begin(), request.end()))
+            .c_str());
 }
 } // namespace blobs
diff --git a/test/ipmi_write_unittest.cpp b/test/ipmi_write_unittest.cpp
index 12cf1bc..18f2909 100644
--- a/test/ipmi_write_unittest.cpp
+++ b/test/ipmi_write_unittest.cpp
@@ -28,8 +28,8 @@
     std::array<uint8_t, 2> expectedBytes = {0x66, 0x67};
     request.insert(request.end(), expectedBytes.begin(), expectedBytes.end());
 
-    EXPECT_CALL(
-        mgr, write(req.sessionId, req.offset, ElementsAreArray(expectedBytes)))
+    EXPECT_CALL(mgr, write(req.sessionId, req.offset,
+                           ElementsAreArray(expectedBytes)))
         .WillOnce(Return(false));
 
     EXPECT_EQ(ipmi::responseUnspecifiedError(), writeBlob(&mgr, request));
@@ -53,8 +53,8 @@
     std::array<uint8_t, 2> expectedBytes = {0x66, 0x67};
     request.insert(request.end(), expectedBytes.begin(), expectedBytes.end());
 
-    EXPECT_CALL(
-        mgr, write(req.sessionId, req.offset, ElementsAreArray(expectedBytes)))
+    EXPECT_CALL(mgr, write(req.sessionId, req.offset,
+                           ElementsAreArray(expectedBytes)))
         .WillOnce(Return(true));
 
     EXPECT_EQ(ipmi::responseSuccess(std::vector<uint8_t>{}),
diff --git a/test/process_unittest.cpp b/test/process_unittest.cpp
index c4273c4..e3c68a9 100644
--- a/test/process_unittest.cpp
+++ b/test/process_unittest.cpp
@@ -213,12 +213,12 @@
     std::vector<uint8_t> request(MAX_IPMI_BUFFER - 1);
     uint32_t payloadLen = sizeof(uint16_t) + sizeof(uint8_t);
 
-    IpmiBlobHandler h = [payloadLen](ManagerInterface*,
-                                     std::span<const uint8_t>) {
-        std::vector<uint8_t> output(payloadLen, 0);
-        output[2] = 0x56;
-        return ipmi::responseSuccess(output);
-    };
+    IpmiBlobHandler h =
+        [payloadLen](ManagerInterface*, std::span<const uint8_t>) {
+            std::vector<uint8_t> output(payloadLen, 0);
+            output[2] = 0x56;
+            return ipmi::responseSuccess(output);
+        };
 
     EXPECT_CALL(crcMock, generateCrc(_)).WillOnce(Return(0x3412));
 
@@ -239,12 +239,12 @@
     std::vector<uint8_t> request(MAX_IPMI_BUFFER - 1);
     uint32_t payloadLen = sizeof(uint16_t) + sizeof(uint8_t);
 
-    IpmiBlobHandler h = [payloadLen](ManagerInterface*,
-                                     std::span<const uint8_t>) {
-        std::vector<uint8_t> output(payloadLen, 0);
-        output[2] = 0x56;
-        return ipmi::responseSuccess(output);
-    };
+    IpmiBlobHandler h =
+        [payloadLen](ManagerInterface*, std::span<const uint8_t>) {
+            std::vector<uint8_t> output(payloadLen, 0);
+            output[2] = 0x56;
+            return ipmi::responseSuccess(output);
+        };
 
     EXPECT_EQ(ipmi::responseResponseError(),
               processBlobCommand(h, &manager, request, 0));