clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: If4790d4928efc3e6690ca090aa79f0c7737c3683
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 52ac0a1..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -6,12 +6,14 @@
 AlignConsecutiveAssignments: false
 AlignConsecutiveDeclarations: false
 AlignEscapedNewlines: Right
-AlignOperands:   true
-AlignTrailingComments: true
+AlignOperands:  Align
+AlignTrailingComments:
+  Kind: Always
+  OverEmptyLines: 1
 AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
 AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
 AllowShortIfStatementsOnASingleLine: false
 AllowShortLoopsOnASingleLine: false
 AlwaysBreakAfterReturnType: None
@@ -36,12 +38,13 @@
   SplitEmptyFunction:   false
   SplitEmptyRecord:     false
   SplitEmptyNamespace:  false
+BreakAfterAttributes: Never
 BreakBeforeBinaryOperators: None
 BreakBeforeBraces: Custom
 BreakBeforeTernaryOperators: true
 BreakConstructorInitializers: AfterColon
 BreakInheritanceList: AfterColon
-BreakStringLiterals: true
+BreakStringLiterals: false
 ColumnLimit:     80
 CommentPragmas:  '^ IWYU pragma:'
 CompactNamespaces: false
@@ -49,6 +52,7 @@
 ConstructorInitializerIndentWidth: 4
 ContinuationIndentWidth: 4
 Cpp11BracedListStyle: true
+DeriveLineEnding: false
 DerivePointerAlignment: false
 PointerAlignment: Left
 DisableFormat:   false
@@ -74,9 +78,13 @@
   - Regex:           '.*'
     Priority:        6
 IndentCaseLabels: true
+IndentRequiresClause: true
 IndentWidth:     4
 IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
 MaxEmptyLinesToKeep: 1
@@ -84,13 +92,19 @@
 ObjCBlockIndentWidth: 2
 ObjCSpaceAfterProperty: false
 ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
 PenaltyBreakBeforeFirstCallParameter: 19
 PenaltyBreakComment: 300
 PenaltyBreakFirstLessLess: 120
 PenaltyBreakString: 1000
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
 ReflowComments:  true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
 SortIncludes:    true
 SortUsingDeclarations: true
 SpaceAfterCStyleCast: false
diff --git a/core_manager.cpp b/core_manager.cpp
index e764953..761abcc 100644
--- a/core_manager.cpp
+++ b/core_manager.cpp
@@ -84,8 +84,8 @@
     }
 
     const auto& host = mapperResponse.cbegin()->first;
-    auto m =
-        b.new_method_call(host.c_str(), OBJ_INTERNAL, IFACE_INTERNAL, "Create");
+    auto m = b.new_method_call(host.c_str(), OBJ_INTERNAL, IFACE_INTERNAL,
+                               "Create");
     m.append(APPLICATION_CORED, files);
     try
     {
diff --git a/dump-extensions/default/default.cpp b/dump-extensions/default/default.cpp
index 0de4e09..2dbf42f 100644
--- a/dump-extensions/default/default.cpp
+++ b/dump-extensions/default/default.cpp
@@ -4,7 +4,6 @@
 {
 namespace dump
 {
-void loadExtensions(sdbusplus::bus_t&, DumpManagerList&)
-{}
+void loadExtensions(sdbusplus::bus_t&, DumpManagerList&) {}
 } // namespace dump
 } // namespace phosphor
diff --git a/dump-extensions/openpower-dumps/dump-extensions.cpp b/dump-extensions/openpower-dumps/dump-extensions.cpp
index 45864ca..836a19a 100644
--- a/dump-extensions/openpower-dumps/dump-extensions.cpp
+++ b/dump-extensions/openpower-dumps/dump-extensions.cpp
@@ -14,7 +14,6 @@
 
 void loadExtensions(sdbusplus::bus_t& bus, DumpManagerList& dumpList)
 {
-
     dumpList.push_back(std::make_unique<openpower::dump::system::Manager>(
         bus, SYSTEM_DUMP_OBJPATH, SYSTEM_DUMP_OBJ_ENTRY));
     dumpList.push_back(std::make_unique<openpower::dump::resource::Manager>(
diff --git a/dump-extensions/openpower-dumps/dump_manager_resource.cpp b/dump-extensions/openpower-dumps/dump_manager_resource.cpp
index 604e796..93ce98c 100644
--- a/dump-extensions/openpower-dumps/dump_manager_resource.cpp
+++ b/dump-extensions/openpower-dumps/dump_manager_resource.cpp
@@ -113,7 +113,6 @@
 sdbusplus::message::object_path
     Manager::createDump(phosphor::dump::DumpCreateParams params)
 {
-
     using NotAllowed =
         sdbusplus::xyz::openbmc_project::Common::Error::NotAllowed;
     using Reason = xyz::openbmc_project::Common::NotAllowed::REASON;
diff --git a/dump-extensions/openpower-dumps/dump_manager_system.cpp b/dump-extensions/openpower-dumps/dump_manager_system.cpp
index 4aa3049..558b0e3 100644
--- a/dump-extensions/openpower-dumps/dump_manager_system.cpp
+++ b/dump-extensions/openpower-dumps/dump_manager_system.cpp
@@ -24,7 +24,6 @@
 
 void Manager::notify(uint32_t dumpId, uint64_t size)
 {
-
     // Get the timestamp
     uint64_t timeStamp =
         std::chrono::duration_cast<std::chrono::microseconds>(
diff --git a/dump_manager_bmc.cpp b/dump_manager_bmc.cpp
index f95683d..3ef3699 100644
--- a/dump_manager_bmc.cpp
+++ b/dump_manager_bmc.cpp
@@ -286,8 +286,8 @@
         if ((std::filesystem::is_directory(p.path())) &&
             std::all_of(idStr.begin(), idStr.end(), ::isdigit))
         {
-            lastEntryId =
-                std::max(lastEntryId, static_cast<uint32_t>(std::stoul(idStr)));
+            lastEntryId = std::max(lastEntryId,
+                                   static_cast<uint32_t>(std::stoul(idStr)));
             auto fileIt = std::filesystem::directory_iterator(p.path());
             // Create dump entry d-bus object.
             if (fileIt != std::filesystem::end(fileIt))
@@ -325,11 +325,12 @@
     // Delete the first existing file until the space is enough
     while (size < BMC_DUMP_MIN_SPACE_REQD)
     {
-        auto delEntry = min_element(
-            entries.begin(), entries.end(),
-            [](const auto& l, const auto& r) { return l.first < r.first; });
-        auto delPath =
-            std::filesystem::path(dumpDir) / std::to_string(delEntry->first);
+        auto delEntry = min_element(entries.begin(), entries.end(),
+                                    [](const auto& l, const auto& r) {
+            return l.first < r.first;
+        });
+        auto delPath = std::filesystem::path(dumpDir) /
+                       std::to_string(delEntry->first);
 
         size += getDirectorySize(delPath);
 
diff --git a/dump_offload.cpp b/dump_offload.cpp
index 7795bb2..c590614 100644
--- a/dump_offload.cpp
+++ b/dump_offload.cpp
@@ -76,8 +76,8 @@
                     fmt::format("writeOnUnixSocket: write() failed, errno({})",
                                 errno)
                         .c_str());
-                std::string msg =
-                    "write() on socket failed " + std::string(strerror(errno));
+                std::string msg = "write() on socket failed " +
+                                  std::string(strerror(errno));
                 throw std::runtime_error(msg);
             }
         }
@@ -102,8 +102,8 @@
         sizeof(socketAddr.sun_path))
     {
         log<level::ERR>("UNIX socket path too long");
-        std::string msg =
-            "UNIX socket path is too long " + std::string(strerror(errno));
+        std::string msg = "UNIX socket path is too long " +
+                          std::string(strerror(errno));
         throw std::length_error(msg);
     }
     strncpy(socketAddr.sun_path, sockPath.c_str(),
@@ -148,7 +148,6 @@
 
     try
     {
-
         CustomFd unixSocket = socketInit(writePath);
 
         fd_set readFD;
@@ -179,8 +178,8 @@
                     fmt::format("accept() failed, errno({}), DUMP_ID({})",
                                 errno, dumpId)
                         .c_str());
-                std::string msg =
-                    "accept() failed " + std::string(strerror(errno));
+                std::string msg = "accept() failed " +
+                                  std::string(strerror(errno));
                 throw std::runtime_error(msg);
             }
 
diff --git a/dump_utils.cpp b/dump_utils.cpp
index 830cce5..236bff0 100644
--- a/dump_utils.cpp
+++ b/dump_utils.cpp
@@ -63,9 +63,9 @@
         auto bus = sdbusplus::bus::new_default();
         auto service = getService(bus, hostStateObjPath, bootProgressInterface);
 
-        auto method =
-            bus.new_method_call(service.c_str(), hostStateObjPath,
-                                "org.freedesktop.DBus.Properties", "Get");
+        auto method = bus.new_method_call(service.c_str(), hostStateObjPath,
+                                          "org.freedesktop.DBus.Properties",
+                                          "Get");
 
         method.append(bootProgressInterface, "BootProgress");
 
diff --git a/dump_utils.hpp b/dump_utils.hpp
index 83952a3..9f683ad 100644
--- a/dump_utils.hpp
+++ b/dump_utils.hpp
@@ -57,8 +57,7 @@
      *
      *  @param[in] fd - File descriptor
      */
-    CustomFd(int fd) : fd(fd)
-    {}
+    CustomFd(int fd) : fd(fd) {}
 
     ~CustomFd()
     {
diff --git a/elog_watch.cpp b/elog_watch.cpp
index 17fd87a..e55211f 100644
--- a/elog_watch.cpp
+++ b/elog_watch.cpp
@@ -47,7 +47,6 @@
              std::bind(std::mem_fn(&Watch::delCallback), this,
                        std::placeholders::_1))
 {
-
     std::filesystem::path file(ELOG_ID_PERSIST_PATH);
     if (std::filesystem::exists(file))
     {
@@ -142,10 +141,11 @@
 
         phosphor::dump::elog::serialize(elogList);
 
-        auto item = std::find_if(
-            phosphor::dump::bmc::TypeMap.begin(),
-            phosphor::dump::bmc::TypeMap.end(),
-            [errorType](const auto& err) { return (err.second == errorType); });
+        auto item = std::find_if(phosphor::dump::bmc::TypeMap.begin(),
+                                 phosphor::dump::bmc::TypeMap.end(),
+                                 [errorType](const auto& err) {
+            return (err.second == errorType);
+        });
         if (item != phosphor::dump::bmc::TypeMap.end())
         {
             iMgr.IMgr::create((*item).first, fullPaths);
diff --git a/host-transport-extensions/pldm/common/pldm_utils.cpp b/host-transport-extensions/pldm/common/pldm_utils.cpp
index 196763a..1348886 100644
--- a/host-transport-extensions/pldm/common/pldm_utils.cpp
+++ b/host-transport-extensions/pldm/common/pldm_utils.cpp
@@ -37,7 +37,6 @@
 
 uint8_t getPLDMInstanceID(uint8_t eid)
 {
-
     constexpr auto pldmRequester = "xyz.openbmc_project.PLDM.Requester";
     constexpr auto pldm = "/xyz/openbmc_project/pldm";
     uint8_t instanceID = 0;
diff --git a/ramoops_manager.cpp b/ramoops_manager.cpp
index e9f4772..af8aa7f 100644
--- a/ramoops_manager.cpp
+++ b/ramoops_manager.cpp
@@ -66,8 +66,8 @@
     }
 
     const auto& host = mapperResponse.cbegin()->first;
-    auto m =
-        b.new_method_call(host.c_str(), OBJ_INTERNAL, IFACE_INTERNAL, "Create");
+    auto m = b.new_method_call(host.c_str(), OBJ_INTERNAL, IFACE_INTERNAL,
+                               "Create");
     m.append(RAMOOPS, files);
     try
     {
diff --git a/test/debug_inif_test.cpp b/test/debug_inif_test.cpp
index 0bb26ec..fb632dc 100644
--- a/test/debug_inif_test.cpp
+++ b/test/debug_inif_test.cpp
@@ -14,8 +14,7 @@
 class TestDumpSerial : public ::testing::Test
 {
   public:
-    TestDumpSerial()
-    {}
+    TestDumpSerial() {}
 
     void SetUp()
     {
diff --git a/watch.cpp b/watch.cpp
index 8ccfbeb..fcf46bd 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -53,8 +53,8 @@
         elog<InternalFailure>();
     }
 
-    auto rc =
-        sd_event_add_io(eventObj.get(), nullptr, fd(), events, callback, this);
+    auto rc = sd_event_add_io(eventObj.get(), nullptr, fd(), events, callback,
+                              this);
     if (0 > rc)
     {
         // Failed to add to event loop