clang-format: update to latest from docs repo

This is from openbmc/docs/style/cpp/.clang-format

Other OpenBMC repos are doing the same.

Tested: Built and validator passed.
Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index 3c4f8ec..6e9421f 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -5,9 +5,10 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/container/flat_map.hpp>
 #include <boost/endian/conversion.hpp>
+#include <nlohmann/json.hpp>
+
 #include <filesystem>
 #include <fstream>
-#include <nlohmann/json.hpp>
 
 namespace crow
 {
@@ -36,7 +37,7 @@
 using RcReleaseLockApi = std::pair<bool, std::variant<bool, RcRelaseLock>>;
 using SessionFlags = std::pair<SType, SType>;
 using ListOfSessionIds = std::vector<std::string>;
-static constexpr const char *fileName =
+static constexpr const char* fileName =
     "/var/lib/obmc/bmc-console-mgmt/locks/ibm_mc_persistent_lock_data.json";
 
 class Lock
@@ -106,22 +107,22 @@
      * Returns : False (if the request HMC or Session does not own the lock(s))
      */
 
-    virtual RcRelaseLock isItMyLock(const ListOfTransactionIds &,
-                                    const SessionFlags &);
+    virtual RcRelaseLock isItMyLock(const ListOfTransactionIds&,
+                                    const SessionFlags&);
 
     /*
      * This function validates the the list of transactionID's and returns false
      * if the transaction ID is not valid & not present in the lock table
      */
 
-    virtual bool validateRids(const ListOfTransactionIds &);
+    virtual bool validateRids(const ListOfTransactionIds&);
 
     /*
      * This function releases the locks that are already obtained by the
      * requesting Management console.
      */
 
-    void releaseLock(const ListOfTransactionIds &);
+    void releaseLock(const ListOfTransactionIds&);
 
     Lock()
     {
@@ -165,31 +166,30 @@
      * Client can choose either of the ways by using `Type` JSON key.
      *
      */
-    RcReleaseLockApi releaseLock(const ListOfTransactionIds &,
-                                 const SessionFlags &);
+    RcReleaseLockApi releaseLock(const ListOfTransactionIds&,
+                                 const SessionFlags&);
 
     /*
      * This function implements the logic for getting the list of locks obtained
      * by a particular management console.
      */
-    RcGetLockList getLockList(const ListOfSessionIds &);
+    RcGetLockList getLockList(const ListOfSessionIds&);
 
     /*
      * This function is releases all the locks obtained by a particular
      * session.
      */
 
-    void releaseLock(const std::string &);
+    void releaseLock(const std::string&);
 
-    static Lock &getInstance()
+    static Lock& getInstance()
     {
         static Lock lockObject;
         return lockObject;
     }
 
     virtual ~Lock()
-    {
-    }
+    {}
 };
 
 inline bool Lock::createPersistentLockFilePath()
@@ -235,7 +235,7 @@
             return;
         }
         BMCWEB_LOG_DEBUG << "The persistent lock data is available";
-        for (const auto &item : data.items())
+        for (const auto& item : data.items())
         {
             BMCWEB_LOG_DEBUG << item.key();
             BMCWEB_LOG_DEBUG << item.value();
@@ -265,7 +265,7 @@
         fs::perms::owner_read | fs::perms::owner_write | fs::perms::group_read;
     fs::permissions(fileName, permission);
     nlohmann::json data;
-    for (const auto &it : lockTable)
+    for (const auto& it : lockTable)
     {
         data[std::to_string(it.first)] = it.second;
     }
@@ -273,14 +273,14 @@
     persistentFile << data;
 }
 
-inline RcGetLockList Lock::getLockList(const ListOfSessionIds &listSessionId)
+inline RcGetLockList Lock::getLockList(const ListOfSessionIds& listSessionId)
 {
 
     std::vector<std::pair<uint32_t, LockRequests>> lockList;
 
     if (!lockTable.empty())
     {
-        for (const auto &i : listSessionId)
+        for (const auto& i : listSessionId)
         {
             auto it = lockTable.begin();
             while (it != lockTable.end())
@@ -306,8 +306,8 @@
     return lockList;
 }
 
-inline RcReleaseLockApi Lock::releaseLock(const ListOfTransactionIds &p,
-                                          const SessionFlags &ids)
+inline RcReleaseLockApi Lock::releaseLock(const ListOfTransactionIds& p,
+                                          const SessionFlags& ids)
 {
 
     bool status = validateRids(p);
@@ -339,7 +339,7 @@
 
     // validate the lock request
 
-    for (auto &lockRecord : lockRequestStructure)
+    for (auto& lockRecord : lockRequestStructure)
     {
         bool status = isValidLockRequest(lockRecord);
         if (!status)
@@ -351,7 +351,7 @@
     }
     // check for conflict record
 
-    const LockRequests &multiRequest = lockRequestStructure;
+    const LockRequests& multiRequest = lockRequestStructure;
     bool status = isConflictRequest(multiRequest);
 
     if (status)
@@ -374,9 +374,9 @@
     return std::make_pair(true, std::make_pair(true, 1));
 }
 
-inline void Lock::releaseLock(const ListOfTransactionIds &refRids)
+inline void Lock::releaseLock(const ListOfTransactionIds& refRids)
 {
-    for (const auto &id : refRids)
+    for (const auto& id : refRids)
     {
         if (lockTable.erase(id))
         {
@@ -395,7 +395,7 @@
     saveLocks();
 }
 
-inline void Lock::releaseLock(const std::string &sessionId)
+inline void Lock::releaseLock(const std::string& sessionId)
 {
     bool isErased = false;
     if (!lockTable.empty())
@@ -429,10 +429,10 @@
         }
     }
 }
-inline RcRelaseLock Lock::isItMyLock(const ListOfTransactionIds &refRids,
-                                     const SessionFlags &ids)
+inline RcRelaseLock Lock::isItMyLock(const ListOfTransactionIds& refRids,
+                                     const SessionFlags& ids)
 {
-    for (const auto &id : refRids)
+    for (const auto& id : refRids)
     {
         // Just need to compare the client id of the first lock records in the
         // complete lock row(in the map), because the rest of the lock records
@@ -456,9 +456,9 @@
     return std::make_pair(true, std::make_pair(0, LockRequest()));
 }
 
-inline bool Lock::validateRids(const ListOfTransactionIds &refRids)
+inline bool Lock::validateRids(const ListOfTransactionIds& refRids)
 {
-    for (const auto &id : refRids)
+    for (const auto& id : refRids)
     {
         auto search = lockTable.find(id);
 
@@ -505,7 +505,7 @@
     int lockFlag = 0;
     // validate the lockflags & segment length
 
-    for (const auto &p : std::get<4>(refLockRecord))
+    for (const auto& p : std::get<4>(refLockRecord))
     {
 
         // validate the lock flags
@@ -571,11 +571,11 @@
         // Lock table is not empty, compare the lockrequest entries with
         // the entries in the lock table
 
-        for (const auto &lockRecord1 : refLockRequestStructure)
+        for (const auto& lockRecord1 : refLockRequestStructure)
         {
-            for (const auto &map : lockTable)
+            for (const auto& map : lockTable)
             {
-                for (const auto &lockRecord2 : map.second)
+                for (const auto& lockRecord2 : map.second)
                 {
                     bool status = isConflictRecord(lockRecord1, lockRecord2);
                     if (status)
@@ -627,8 +627,8 @@
         {
             for (uint32_t j = i + 1; j < refLockRequestStructure.size(); j++)
             {
-                const LockRequest &p = refLockRequestStructure[i];
-                const LockRequest &q = refLockRequestStructure[j];
+                const LockRequest& p = refLockRequestStructure[i];
+                const LockRequest& q = refLockRequestStructure[j];
                 bool status = isConflictRecord(p, q);
 
                 if (status)
@@ -652,8 +652,8 @@
 inline bool Lock::checkByte(uint64_t resourceId1, uint64_t resourceId2,
                             uint32_t position)
 {
-    uint8_t *p = reinterpret_cast<uint8_t *>(&resourceId1);
-    uint8_t *q = reinterpret_cast<uint8_t *>(&resourceId2);
+    uint8_t* p = reinterpret_cast<uint8_t*>(&resourceId1);
+    uint8_t* q = reinterpret_cast<uint8_t*>(&resourceId2);
 
     BMCWEB_LOG_DEBUG << "Comparing bytes " << std::to_string(p[position]) << ","
                      << std::to_string(q[position]);
@@ -685,7 +685,7 @@
     else
     {
         uint32_t i = 0;
-        for (const auto &p : std::get<4>(refLockRecord1))
+        for (const auto& p : std::get<4>(refLockRecord1))
         {
 
             // return conflict when any of them is try to lock all resources
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index 9f8f8d2..e9805d6 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -6,14 +6,15 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/container/flat_set.hpp>
 #include <error_messages.hpp>
-#include <filesystem>
-#include <fstream>
 #include <ibm/locks.hpp>
 #include <nlohmann/json.hpp>
-#include <regex>
 #include <sdbusplus/message/types.hpp>
 #include <utils/json_utils.hpp>
 
+#include <filesystem>
+#include <fstream>
+#include <regex>
+
 // Allow save area file size to 500KB
 #define MAX_SAVE_AREA_FILESIZE 500000
 
@@ -29,12 +30,12 @@
 {
 namespace ibm_mc
 {
-constexpr const char *methodNotAllowedMsg = "Method Not Allowed";
-constexpr const char *resourceNotFoundMsg = "Resource Not Found";
-constexpr const char *contentNotAcceptableMsg = "Content Not Acceptable";
-constexpr const char *internalServerError = "Internal Server Error";
+constexpr const char* methodNotAllowedMsg = "Method Not Allowed";
+constexpr const char* resourceNotFoundMsg = "Resource Not Found";
+constexpr const char* contentNotAcceptableMsg = "Content Not Acceptable";
+constexpr const char* internalServerError = "Internal Server Error";
 
-bool createSaveAreaPath(crow::Response &res)
+bool createSaveAreaPath(crow::Response& res)
 {
     // The path /var/lib/obmc will be created by initrdscripts
     // Create the directories for the save-area files, when we get
@@ -71,8 +72,8 @@
     }
     return true;
 }
-void handleFilePut(const crow::Request &req, crow::Response &res,
-                   const std::string &fileID)
+void handleFilePut(const crow::Request& req, crow::Response& res,
+                   const std::string& fileID)
 {
     // Check the content-type of the request
     std::string_view contentType = req.getHeaderValue("content-type");
@@ -129,13 +130,13 @@
     }
 }
 
-void handleConfigFileList(crow::Response &res)
+void handleConfigFileList(crow::Response& res)
 {
     std::vector<std::string> pathObjList;
     std::filesystem::path loc("/var/lib/obmc/bmc-console-mgmt/save-area");
     if (std::filesystem::exists(loc) && std::filesystem::is_directory(loc))
     {
-        for (const auto &file : std::filesystem::directory_iterator(loc))
+        for (const auto& file : std::filesystem::directory_iterator(loc))
         {
             std::filesystem::path pathObj(file.path());
             pathObjList.push_back("/ibm/v1/Host/ConfigFiles/" +
@@ -154,7 +155,7 @@
     res.end();
 }
 
-void deleteConfigFiles(crow::Response &res)
+void deleteConfigFiles(crow::Response& res)
 {
     std::vector<std::string> pathObjList;
     std::error_code ec;
@@ -174,7 +175,7 @@
     res.end();
 }
 
-void getLockServiceData(crow::Response &res)
+void getLockServiceData(crow::Response& res)
 {
     res.jsonValue["@odata.type"] = "#LockService.v1_0_0.LockService";
     res.jsonValue["@odata.id"] = "/ibm/v1/HMC/LockService/";
@@ -190,7 +191,7 @@
     res.end();
 }
 
-void handleFileGet(crow::Response &res, const std::string &fileID)
+void handleFileGet(crow::Response& res, const std::string& fileID)
 {
     BMCWEB_LOG_DEBUG << "HandleGet on SaveArea files on path: " << fileID;
     std::filesystem::path loc("/var/lib/obmc/bmc-console-mgmt/save-area/" +
@@ -222,7 +223,7 @@
     return;
 }
 
-void handleFileDelete(crow::Response &res, const std::string &fileID)
+void handleFileDelete(crow::Response& res, const std::string& fileID)
 {
     std::string filePath("/var/lib/obmc/bmc-console-mgmt/save-area/" + fileID);
     BMCWEB_LOG_DEBUG << "Removing the file : " << filePath << "\n";
@@ -249,8 +250,8 @@
     return;
 }
 
-inline void handleFileUrl(const crow::Request &req, crow::Response &res,
-                          const std::string &fileID)
+inline void handleFileUrl(const crow::Request& req, crow::Response& res,
+                          const std::string& fileID)
 {
     if (req.method() == "PUT"_method)
     {
@@ -272,11 +273,11 @@
     }
 }
 
-void handleAcquireLockAPI(const crow::Request &req, crow::Response &res,
+void handleAcquireLockAPI(const crow::Request& req, crow::Response& res,
                           std::vector<nlohmann::json> body)
 {
     LockRequests lockRequestStructure;
-    for (auto &element : body)
+    for (auto& element : body)
     {
         std::string lockType;
         uint64_t resourceId;
@@ -298,7 +299,7 @@
 
         BMCWEB_LOG_DEBUG << "Segment Flags are present";
 
-        for (auto &e : segmentFlags)
+        for (auto& e : segmentFlags)
         {
             std::string lockFlags;
             uint32_t segmentLength;
@@ -329,13 +330,13 @@
         BMCWEB_LOG_DEBUG << std::get<2>(lockRequestStructure[i]);
         BMCWEB_LOG_DEBUG << std::get<3>(lockRequestStructure[i]);
 
-        for (const auto &p : std::get<4>(lockRequestStructure[i]))
+        for (const auto& p : std::get<4>(lockRequestStructure[i]))
         {
             BMCWEB_LOG_DEBUG << p.first << ", " << p.second;
         }
     }
 
-    const LockRequests &t = lockRequestStructure;
+    const LockRequests& t = lockRequestStructure;
 
     auto varAcquireLock = crow::ibm_mc_lock::Lock::getInstance().acquireLock(t);
 
@@ -407,7 +408,7 @@
         }
     }
 }
-void handleRelaseAllAPI(const crow::Request &req, crow::Response &res)
+void handleRelaseAllAPI(const crow::Request& req, crow::Response& res)
 {
     crow::ibm_mc_lock::Lock::getInstance().releaseLock(req.session->uniqueId);
     res.result(boost::beast::http::status::ok);
@@ -415,8 +416,8 @@
     return;
 }
 
-void handleReleaseLockAPI(const crow::Request &req, crow::Response &res,
-                          const std::vector<uint32_t> &listTransactionIds)
+void handleReleaseLockAPI(const crow::Request& req, crow::Response& res,
+                          const std::vector<uint32_t>& listTransactionIds)
 {
     BMCWEB_LOG_DEBUG << listTransactionIds.size();
     BMCWEB_LOG_DEBUG << "Data is present";
@@ -483,8 +484,8 @@
     }
 }
 
-void handleGetLockListAPI(const crow::Request &req, crow::Response &res,
-                          const ListOfSessionIds &listSessionIds)
+void handleGetLockListAPI(const crow::Request& req, crow::Response& res,
+                          const ListOfSessionIds& listSessionIds)
 {
     BMCWEB_LOG_DEBUG << listSessionIds.size();
 
@@ -494,9 +495,9 @@
 
     nlohmann::json lockRecords = nlohmann::json::array();
 
-    for (const auto &transactionId : var)
+    for (const auto& transactionId : var)
     {
-        for (const auto &lockRecord : transactionId.second)
+        for (const auto& lockRecord : transactionId.second)
         {
             nlohmann::json returnJson;
 
@@ -509,7 +510,7 @@
             nlohmann::json segments;
             nlohmann::json segmentInfoArray = nlohmann::json::array();
 
-            for (const auto &segment : std::get<4>(lockRecord))
+            for (const auto& segment : std::get<4>(lockRecord))
             {
                 segments["LockFlag"] = segment.first;
                 segments["SegmentLength"] = segment.second;
@@ -525,14 +526,15 @@
     res.end();
 }
 
-template <typename... Middlewares> void requestRoutes(Crow<Middlewares...> &app)
+template <typename... Middlewares>
+void requestRoutes(Crow<Middlewares...>& app)
 {
 
     // allowed only for admin
     BMCWEB_ROUTE(app, "/ibm/v1/")
         .requires({"ConfigureComponents", "ConfigureManager"})
         .methods("GET"_method)(
-            [](const crow::Request &req, crow::Response &res) {
+            [](const crow::Request& req, crow::Response& res) {
                 res.jsonValue["@odata.type"] =
                     "#ibmServiceRoot.v1_0_0.ibmServiceRoot";
                 res.jsonValue["@odata.id"] = "/ibm/v1/";
@@ -548,7 +550,7 @@
     BMCWEB_ROUTE(app, "/ibm/v1/Host/ConfigFiles")
         .requires({"ConfigureComponents", "ConfigureManager"})
         .methods("GET"_method)(
-            [](const crow::Request &req, crow::Response &res) {
+            [](const crow::Request& req, crow::Response& res) {
                 handleConfigFileList(res);
             });
 
@@ -556,27 +558,27 @@
                  "/ibm/v1/Host/ConfigFiles/Actions/FileCollection.DeleteAll")
         .requires({"ConfigureComponents", "ConfigureManager"})
         .methods("POST"_method)(
-            [](const crow::Request &req, crow::Response &res) {
+            [](const crow::Request& req, crow::Response& res) {
                 deleteConfigFiles(res);
             });
 
     BMCWEB_ROUTE(app, "/ibm/v1/Host/ConfigFiles/<path>")
         .requires({"ConfigureComponents", "ConfigureManager"})
         .methods("PUT"_method, "GET"_method, "DELETE"_method)(
-            [](const crow::Request &req, crow::Response &res,
-               const std::string &path) { handleFileUrl(req, res, path); });
+            [](const crow::Request& req, crow::Response& res,
+               const std::string& path) { handleFileUrl(req, res, path); });
 
     BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService")
         .requires({"ConfigureComponents", "ConfigureManager"})
         .methods("GET"_method)(
-            [](const crow::Request &req, crow::Response &res) {
+            [](const crow::Request& req, crow::Response& res) {
                 getLockServiceData(res);
             });
 
     BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService/Actions/LockService.AcquireLock")
         .requires({"ConfigureComponents", "ConfigureManager"})
         .methods("POST"_method)(
-            [](const crow::Request &req, crow::Response &res) {
+            [](const crow::Request& req, crow::Response& res) {
                 std::vector<nlohmann::json> body;
                 if (!redfish::json_util::readJson(req, res, "Request", body))
                 {
@@ -590,7 +592,7 @@
     BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock")
         .requires({"ConfigureComponents", "ConfigureManager"})
         .methods(
-            "POST"_method)([](const crow::Request &req, crow::Response &res) {
+            "POST"_method)([](const crow::Request& req, crow::Response& res) {
             std::string type;
             std::vector<uint32_t> listTransactionIds;
 
@@ -620,7 +622,7 @@
     BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService/Actions/LockService.GetLockList")
         .requires({"ConfigureComponents", "ConfigureManager"})
         .methods("POST"_method)(
-            [](const crow::Request &req, crow::Response &res) {
+            [](const crow::Request& req, crow::Response& res) {
                 ListOfSessionIds listSessionIds;
 
                 if (!redfish::json_util::readJson(req, res, "SessionIDs",