clang-format: update with latest

Copy the latest clang-format and apply to the repository.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I10a3fe64d4ca77601e6855daf46954579312c7df
diff --git a/.clang-format b/.clang-format
index 5f0cb09..82c0e2c 100644
--- a/.clang-format
+++ b/.clang-format
@@ -79,6 +79,7 @@
 IndentWidth:     4
 IndentWrappedFunctionNames: true
 KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
 MaxEmptyLinesToKeep: 1
diff --git a/src/associations.cpp b/src/associations.cpp
index 346cebd..6042d4d 100644
--- a/src/associations.cpp
+++ b/src/associations.cpp
@@ -321,12 +321,11 @@
         // Already waiting on this path for another association,
         // so just add this endpoint and owner.
         auto& endpoints = p->second;
-        auto e =
-            std::find_if(endpoints.begin(), endpoints.end(),
-                         [&assoc, &owner](const auto& endpoint) {
-                             return (std::get<ownerPos>(endpoint) == owner) &&
-                                    (std::get<assocPos>(endpoint) == assoc);
-                         });
+        auto e = std::find_if(endpoints.begin(), endpoints.end(),
+                              [&assoc, &owner](const auto& endpoint) {
+            return (std::get<ownerPos>(endpoint) == owner) &&
+                   (std::get<assocPos>(endpoint) == assoc);
+        });
         if (e == endpoints.end())
         {
             endpoints.emplace_back(owner, std::move(assoc));
@@ -509,14 +508,14 @@
                     auto a = std::find_if(
                         assocs.begin(), assocs.end(),
                         [&endpointPath, &otherPath](const auto& ap) {
-                            const auto& endpoints = ap.second;
-                            auto endpoint = std::find(
-                                endpoints.begin(), endpoints.end(), otherPath);
-                            if (endpoint != endpoints.end())
-                            {
-                                return ap.first.starts_with(endpointPath + '/');
-                            }
-                            return false;
+                        const auto& endpoints = ap.second;
+                        auto endpoint = std::find(endpoints.begin(),
+                                                  endpoints.end(), otherPath);
+                        if (endpoint != endpoints.end())
+                        {
+                            return ap.first.starts_with(endpointPath + '/');
+                        }
+                        return false;
                         });
 
                     if (a != assocs.end())
diff --git a/src/handler.cpp b/src/handler.cpp
index a1efb84..a4401bf 100644
--- a/src/handler.cpp
+++ b/src/handler.cpp
@@ -19,9 +19,10 @@
     // If an entry for the object path already exists, just add the
     // service name and interfaces to that entry, otherwise create
     // a new entry.
-    auto entry = std::find_if(
-        objectMap.begin(), objectMap.end(),
-        [&objectPath](const auto& i) { return objectPath == i.first; });
+    auto entry = std::find_if(objectMap.begin(), objectMap.end(),
+                              [&objectPath](const auto& i) {
+        return objectPath == i.first;
+    });
 
     if (entry != objectMap.end())
     {
diff --git a/src/main.cpp b/src/main.cpp
index 568f460..242903b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -34,13 +34,13 @@
     conn->async_method_call(
         [&, newObject](const boost::system::error_code ec,
                        const std::string& nameOwner) {
-            if (ec)
-            {
-                std::cerr << "Error getting owner of " << newObject << " : "
-                          << ec << "\n";
-                return;
-            }
-            owners[nameOwner] = newObject;
+        if (ec)
+        {
+            std::cerr << "Error getting owner of " << newObject << " : " << ec
+                      << "\n";
+            return;
+        }
+        owners[nameOwner] = newObject;
         },
         "org.freedesktop.DBus", "/", "org.freedesktop.DBus", "GetNameOwner",
         newObject);
@@ -142,21 +142,21 @@
          timeoutRetries](
             const boost::system::error_code ec,
             const std::variant<std::vector<Association>>& variantAssociations) {
-            if (ec)
+        if (ec)
+        {
+            if (ec.value() == boost::system::errc::timed_out &&
+                timeoutRetries < maxTimeoutRetries)
             {
-                if (ec.value() == boost::system::errc::timed_out &&
-                    timeoutRetries < maxTimeoutRetries)
-                {
-                    doAssociations(io, systemBus, interfaceMap, objectServer,
-                                   processName, path, timeoutRetries + 1);
-                    return;
-                }
-                std::cerr << "Error getting associations from " << path << "\n";
+                doAssociations(io, systemBus, interfaceMap, objectServer,
+                               processName, path, timeoutRetries + 1);
+                return;
             }
-            std::vector<Association> associations =
-                std::get<std::vector<Association>>(variantAssociations);
-            associationChanged(io, objectServer, associations, path,
-                               processName, interfaceMap, associationMaps);
+            std::cerr << "Error getting associations from " << path << "\n";
+        }
+        std::vector<Association> associations =
+            std::get<std::vector<Association>>(variantAssociations);
+        associationChanged(io, objectServer, associations, path, processName,
+                           interfaceMap, associationMaps);
         },
         processName, path, "org.freedesktop.DBus.Properties", "Get",
         assocDefsInterface, assocDefsProperty);
@@ -174,81 +174,80 @@
         [&io, &interfaceMap, &objectServer, transaction, path, systemBus,
          timeoutRetries](const boost::system::error_code ec,
                          const std::string& introspectXml) {
-            if (ec)
+        if (ec)
+        {
+            if (ec.value() == boost::system::errc::timed_out &&
+                timeoutRetries < maxTimeoutRetries)
             {
-                if (ec.value() == boost::system::errc::timed_out &&
-                    timeoutRetries < maxTimeoutRetries)
-                {
-                    doIntrospect(io, systemBus, transaction, interfaceMap,
-                                 objectServer, path, timeoutRetries + 1);
-                    return;
-                }
-                std::cerr << "Introspect call failed with error: " << ec << ", "
-                          << ec.message()
-                          << " on process: " << transaction->processName
-                          << " path: " << path << "\n";
+                doIntrospect(io, systemBus, transaction, interfaceMap,
+                             objectServer, path, timeoutRetries + 1);
                 return;
             }
+            std::cerr << "Introspect call failed with error: " << ec << ", "
+                      << ec.message()
+                      << " on process: " << transaction->processName
+                      << " path: " << path << "\n";
+            return;
+        }
 
-            tinyxml2::XMLDocument doc;
+        tinyxml2::XMLDocument doc;
 
-            tinyxml2::XMLError e = doc.Parse(introspectXml.c_str());
-            if (e != tinyxml2::XMLError::XML_SUCCESS)
+        tinyxml2::XMLError e = doc.Parse(introspectXml.c_str());
+        if (e != tinyxml2::XMLError::XML_SUCCESS)
+        {
+            std::cerr << "XML parsing failed\n";
+            return;
+        }
+
+        tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
+        if (pRoot == nullptr)
+        {
+            std::cerr << "XML document did not contain any data\n";
+            return;
+        }
+        auto& thisPathMap = interfaceMap[path];
+        tinyxml2::XMLElement* pElement = pRoot->FirstChildElement("interface");
+        while (pElement != nullptr)
+        {
+            const char* ifaceName = pElement->Attribute("name");
+            if (ifaceName == nullptr)
             {
-                std::cerr << "XML parsing failed\n";
-                return;
+                continue;
             }
 
-            tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
-            if (pRoot == nullptr)
+            thisPathMap[transaction->processName].emplace(ifaceName);
+
+            if (std::strcmp(ifaceName, assocDefsInterface) == 0)
             {
-                std::cerr << "XML document did not contain any data\n";
-                return;
+                doAssociations(io, systemBus, interfaceMap, objectServer,
+                               transaction->processName, path);
             }
-            auto& thisPathMap = interfaceMap[path];
-            tinyxml2::XMLElement* pElement =
-                pRoot->FirstChildElement("interface");
-            while (pElement != nullptr)
+
+            pElement = pElement->NextSiblingElement("interface");
+        }
+
+        // Check if this new path has a pending association that can
+        // now be completed.
+        checkIfPendingAssociation(io, path, interfaceMap,
+                                  transaction->assocMaps, objectServer);
+
+        pElement = pRoot->FirstChildElement("node");
+        while (pElement != nullptr)
+        {
+            const char* childPath = pElement->Attribute("name");
+            if (childPath != nullptr)
             {
-                const char* ifaceName = pElement->Attribute("name");
-                if (ifaceName == nullptr)
+                std::string parentPath(path);
+                if (parentPath == "/")
                 {
-                    continue;
+                    parentPath.clear();
                 }
 
-                thisPathMap[transaction->processName].emplace(ifaceName);
-
-                if (std::strcmp(ifaceName, assocDefsInterface) == 0)
-                {
-                    doAssociations(io, systemBus, interfaceMap, objectServer,
-                                   transaction->processName, path);
-                }
-
-                pElement = pElement->NextSiblingElement("interface");
+                doIntrospect(io, systemBus, transaction, interfaceMap,
+                             objectServer, parentPath + "/" + childPath);
             }
-
-            // Check if this new path has a pending association that can
-            // now be completed.
-            checkIfPendingAssociation(io, path, interfaceMap,
-                                      transaction->assocMaps, objectServer);
-
-            pElement = pRoot->FirstChildElement("node");
-            while (pElement != nullptr)
-            {
-                const char* childPath = pElement->Attribute("name");
-                if (childPath != nullptr)
-                {
-                    std::string parentPath(path);
-                    if (parentPath == "/")
-                    {
-                        parentPath.clear();
-                    }
-
-                    doIntrospect(io, systemBus, transaction, interfaceMap,
-                                 objectServer, parentPath + "/" + childPath);
-                }
-                pElement = pElement->NextSiblingElement("node");
-            }
+            pElement = pElement->NextSiblingElement("node");
+        }
         },
         transaction->processName, path, "org.freedesktop.DBus.Introspectable",
         "Introspect");
@@ -290,33 +289,33 @@
         [&io, &interfaceMap, &nameOwners, &objectServer, systemBus,
          &assocMaps](const boost::system::error_code ec,
                      std::vector<std::string> processNames) {
-            if (ec)
-            {
-                std::cerr << "Error getting names: " << ec << "\n";
-                std::exit(EXIT_FAILURE);
-                return;
-            }
-            // Try to make startup consistent
-            std::sort(processNames.begin(), processNames.end());
+        if (ec)
+        {
+            std::cerr << "Error getting names: " << ec << "\n";
+            std::exit(EXIT_FAILURE);
+            return;
+        }
+        // Try to make startup consistent
+        std::sort(processNames.begin(), processNames.end());
 #ifdef MAPPER_ENABLE_DEBUG
-            std::shared_ptr<std::chrono::time_point<std::chrono::steady_clock>>
-                globalStartTime = std::make_shared<
-                    std::chrono::time_point<std::chrono::steady_clock>>(
-                    std::chrono::steady_clock::now());
+        std::shared_ptr<std::chrono::time_point<std::chrono::steady_clock>>
+            globalStartTime = std::make_shared<
+                std::chrono::time_point<std::chrono::steady_clock>>(
+                std::chrono::steady_clock::now());
 #endif
-            for (const std::string& processName : processNames)
+        for (const std::string& processName : processNames)
+        {
+            if (needToIntrospect(processName))
             {
-                if (needToIntrospect(processName))
-                {
-                    startNewIntrospect(systemBus, io, interfaceMap, processName,
-                                       assocMaps,
+                startNewIntrospect(systemBus, io, interfaceMap, processName,
+                                   assocMaps,
 #ifdef MAPPER_ENABLE_DEBUG
-                                       globalStartTime,
+                                   globalStartTime,
 #endif
-                                       objectServer);
-                    updateOwners(systemBus, nameOwners, processName);
-                }
+                                   objectServer);
+                updateOwners(systemBus, nameOwners, processName);
             }
+        }
         },
         "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
         "ListNames");
@@ -362,12 +361,11 @@
         auto childPath = parent + '/';
 
         // Remove this parent if there isn't a remaining child on this owner
-        auto child = std::find_if(
-            interfaceMap.begin(), interfaceMap.end(),
-            [&owner, &childPath](const auto& entry) {
-                return entry.first.starts_with(childPath) &&
-                       (entry.second.find(owner) != entry.second.end());
-            });
+        auto child = std::find_if(interfaceMap.begin(), interfaceMap.end(),
+                                  [&owner, &childPath](const auto& entry) {
+            return entry.first.starts_with(childPath) &&
+                   (entry.second.find(owner) != entry.second.end());
+        });
 
         if (child == interfaceMap.end())
         {
@@ -593,7 +591,7 @@
         "GetSubTreePaths",
         [&interfaceMap](std::string& reqPath, int32_t depth,
                         std::vector<std::string>& interfaces) {
-            return getSubTreePaths(interfaceMap, reqPath, depth, interfaces);
+        return getSubTreePaths(interfaceMap, reqPath, depth, interfaces);
         });
 
     iface->register_method(
@@ -601,9 +599,9 @@
         [&interfaceMap](const sdbusplus::message::object_path& associationPath,
                         const sdbusplus::message::object_path& reqPath,
                         int32_t depth, std::vector<std::string>& interfaces) {
-            return getAssociatedSubTree(interfaceMap, associationMaps,
-                                        associationPath, reqPath, depth,
-                                        interfaces);
+        return getAssociatedSubTree(interfaceMap, associationMaps,
+                                    associationPath, reqPath, depth,
+                                    interfaces);
         });
 
     iface->register_method(
@@ -611,9 +609,9 @@
         [&interfaceMap](const sdbusplus::message::object_path& associationPath,
                         const sdbusplus::message::object_path& reqPath,
                         int32_t depth, std::vector<std::string>& interfaces) {
-            return getAssociatedSubTreePaths(interfaceMap, associationMaps,
-                                             associationPath, reqPath, depth,
-                                             interfaces);
+        return getAssociatedSubTreePaths(interfaceMap, associationMaps,
+                                         associationPath, reqPath, depth,
+                                         interfaces);
         });
 
     iface->initialize();
diff --git a/src/processing.cpp b/src/processing.cpp
index 4298541..9b6e636 100644
--- a/src/processing.cpp
+++ b/src/processing.cpp
@@ -34,8 +34,8 @@
 
     auto inSkipList = std::find_if(skipNamespaces.begin(), skipNamespaces.end(),
                                    [&processName](auto prefix) {
-                                       return processName.starts_with(prefix);
-                                   }) != skipNamespaces.end();
+        return processName.starts_with(prefix);
+                      }) != skipNamespaces.end();
     return !(inSkipList || processName.empty());
 }
 
diff --git a/src/test/associations.cpp b/src/test/associations.cpp
index 62aefab..fca0ee1 100644
--- a/src/test/associations.cpp
+++ b/src/test/associations.cpp
@@ -499,9 +499,10 @@
     ASSERT_EQ(associationData.size(), 2);
 
     {
-        auto ad = std::find_if(
-            associationData.begin(), associationData.end(),
-            [](const auto& ad) { return std::get<0>(ad) == "ownerA"; });
+        auto ad = std::find_if(associationData.begin(), associationData.end(),
+                               [](const auto& ad) {
+            return std::get<0>(ad) == "ownerA";
+        });
         ASSERT_NE(ad, associationData.end());
 
         auto& a = std::get<1>(*ad);
@@ -510,9 +511,10 @@
         ASSERT_EQ(std::get<2>(a), "pathA");
     }
     {
-        auto ad = std::find_if(
-            associationData.begin(), associationData.end(),
-            [](const auto& ad) { return std::get<0>(ad) == "ownerB"; });
+        auto ad = std::find_if(associationData.begin(), associationData.end(),
+                               [](const auto& ad) {
+            return std::get<0>(ad) == "ownerB";
+        });
         ASSERT_NE(ad, associationData.end());
 
         auto& a = std::get<1>(*ad);
diff --git a/src/test/handler.cpp b/src/test/handler.cpp
index b7dfbb3..aad6c8a 100644
--- a/src/test/handler.cpp
+++ b/src/test/handler.cpp
@@ -80,9 +80,10 @@
                                                        }));
     ASSERT_EQ(interfaceMaps.size(), 1);
 
-    auto entry = std::find_if(
-        interfaceMaps.begin(), interfaceMaps.end(),
-        [](const auto& i) { return "test_object_path" == i.first; });
+    auto entry = std::find_if(interfaceMaps.begin(), interfaceMaps.end(),
+                              [](const auto& i) {
+        return "test_object_path" == i.first;
+    });
     ASSERT_NE(entry, interfaceMap.end());
     for (const auto& [_, interfaces] : entry->second)
     {
@@ -97,9 +98,10 @@
     addObjectMapResult(interfaceMaps, "test_object_path",
                        std::pair<std::string, InterfaceNames>(
                            "test_object_connection_1", {"test_interface_2"}));
-    entry = std::find_if(
-        interfaceMaps.begin(), interfaceMaps.end(),
-        [](const auto& i) { return "test_object_path" == i.first; });
+    entry = std::find_if(interfaceMaps.begin(), interfaceMaps.end(),
+                         [](const auto& i) {
+        return "test_object_path" == i.first;
+    });
     ASSERT_NE(entry, interfaceMaps.end());
     for (const auto& [_, interfaces] : entry->second)
     {
@@ -246,8 +248,8 @@
 {
     std::string path = "/test/object_path_0";
     std::vector<std::string> interfaces = {"bad_interface"};
-    std::vector<std::string> subtreePath =
-        getSubTreePaths(interfaceMap, path, 0, interfaces);
+    std::vector<std::string> subtreePath = getSubTreePaths(interfaceMap, path,
+                                                           0, interfaces);
     ASSERT_TRUE(subtreePath.empty());
 
     path = "/invalid_path";
@@ -263,8 +265,8 @@
     std::vector<std::string> interfaces = {"test_interface_1",
                                            "test_interface_3"};
     // Root
-    std::vector<std::string> subtreePath =
-        getSubTreePaths(interfaceMap, "/", 0, interfaces);
+    std::vector<std::string> subtreePath = getSubTreePaths(interfaceMap, "/", 0,
+                                                           interfaces);
     ASSERT_THAT(subtreePath,
                 ElementsAre("/test/object_path_0/child",
                             "/test/object_path_0/child/grandchild/dog"));
@@ -405,9 +407,9 @@
     ASSERT_THAT(subtreePath, ElementsAre("/test/object_path_0/child"));
 
     // Path1
-    subtreePath =
-        getAssociatedSubTreePaths(interfaceMap, associationMap,
-                                  path1 / "descendent", path1, 0, interfaces);
+    subtreePath = getAssociatedSubTreePaths(interfaceMap, associationMap,
+                                            path1 / "descendent", path1, 0,
+                                            interfaces);
     ASSERT_THAT(subtreePath,
                 ElementsAre("/test/object_path_0/child/grandchild"));
 }