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: I85f99c9dfb356b15f40667aa920fbaff1af015a3
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/dbusSensor.cpp b/dbusSensor.cpp
index f79705b..527a848 100644
--- a/dbusSensor.cpp
+++ b/dbusSensor.cpp
@@ -19,19 +19,18 @@
 
 DbusSensor::DbusSensor(sdbusplus::bus_t& bus, const std::string& path,
                        VirtualSensor& virtualSensor) :
-    bus(bus),
-    path(path), virtualSensor(virtualSensor),
+    bus(bus), path(path), virtualSensor(virtualSensor),
     signalPropChange(
         bus, sdbusplus::bus::match::rules::propertiesChanged(path, sensorIntf),
         [this](sdbusplus::message_t& message) {
-    handleDbusSignalPropChange(message);
-}),
+            handleDbusSignalPropChange(message);
+        }),
     signalRemove(
         bus,
         sdbusplus::bus::match::rules::interfacesRemoved(interfacesSensorPath),
         [this](sdbusplus::message_t& message) {
-    handleDbusSignalRemove(message);
-})
+            handleDbusSignalRemove(message);
+        })
 {
     initSensorValue();
 }
@@ -60,8 +59,8 @@
                 sdbusplus::bus::match::rules::nameOwnerChanged() +
                     sdbusplus::bus::match::rules::arg0namespace(servName),
                 [this](sdbusplus::message_t& message) {
-                handleDbusSignalNameOwnerChanged(message);
-            });
+                    handleDbusSignalNameOwnerChanged(message);
+                });
 
             value = getDbusProperty<double>(bus, servName, path, sensorIntf,
                                             "Value");
diff --git a/exprtkTools.hpp b/exprtkTools.hpp
index be85895..936b134 100644
--- a/exprtkTools.hpp
+++ b/exprtkTools.hpp
@@ -57,16 +57,16 @@
         return std::reduce(std::begin(argList), std::end(argList),
                            std::numeric_limits<double>::quiet_NaN(),
                            [](auto a, auto b) {
-            if (std::isnan(b))
-            {
-                return a;
-            }
-            if (std::isnan(a))
-            {
-                return b;
-            }
-            return std::max(a, b);
-        });
+                               if (std::isnan(b))
+                               {
+                                   return a;
+                               }
+                               if (std::isnan(a))
+                               {
+                                   return b;
+                               }
+                               return std::max(a, b);
+                           });
     }
 };
 
@@ -78,16 +78,16 @@
         return std::reduce(std::begin(argList), std::end(argList),
                            std::numeric_limits<double>::quiet_NaN(),
                            [](auto a, auto b) {
-            if (std::isnan(b))
-            {
-                return a;
-            }
-            if (std::isnan(a))
-            {
-                return b;
-            }
-            return a + b;
-        });
+                               if (std::isnan(b))
+                               {
+                                   return a;
+                               }
+                               if (std::isnan(a))
+                               {
+                                   return b;
+                               }
+                               return a + b;
+                           });
     }
 };
 
diff --git a/virtualSensor.cpp b/virtualSensor.cpp
index 081408b..13786d8 100644
--- a/virtualSensor.cpp
+++ b/virtualSensor.cpp
@@ -129,9 +129,9 @@
 
 std::string getSeverityField(const PropertyMap& propertyMap)
 {
-    static const std::array thresholdTypes{"Warning", "Critical",
-                                           "PerformanceLoss", "SoftShutdown",
-                                           "HardShutdown"};
+    static const std::array thresholdTypes{
+        "Warning", "Critical", "PerformanceLoss", "SoftShutdown",
+        "HardShutdown"};
 
     std::string severity;
     if (auto itr = propertyMap.find("Severity"); itr != propertyMap.end())
@@ -148,8 +148,8 @@
         }
         else
         {
-            auto sev = getNumberFromConfig<uint64_t>(propertyMap, "Severity",
-                                                     true);
+            auto sev =
+                getNumberFromConfig<uint64_t>(propertyMap, "Severity", true);
             /* Checking bounds ourselves so we throw invalid argument on
              * invalid user input */
             if (sev >= thresholdTypes.size())
@@ -180,8 +180,8 @@
     auto threshold = getThresholdType(direction, severity);
     thresholds[threshold] = value;
 
-    auto hysteresis = getNumberFromConfig<double>(propertyMap, "Hysteresis",
-                                                  false);
+    auto hysteresis =
+        getNumberFromConfig<double>(propertyMap, "Hysteresis", false);
     if (hysteresis != std::numeric_limits<double>::quiet_NaN())
     {
         thresholds[threshold + "Hysteresis"] = hysteresis;
@@ -206,8 +206,8 @@
             std::replace(sensor.begin(), sensor.end(), ' ', '_');
             auto sensorObjPath = sensorDbusPath + sensorType + "/" + sensor;
 
-            auto paramPtr = std::make_unique<SensorParam>(bus, sensorObjPath,
-                                                          *this);
+            auto paramPtr =
+                std::make_unique<SensorParam>(bus, sensorObjPath, *this);
             symbols.create_variable(sensor);
             paramMap.emplace(std::move(sensor), std::move(paramPtr));
         }
@@ -329,8 +329,8 @@
                 {
                     auto path = sensorDbusPath + sensorType + "/" + name;
 
-                    auto paramPtr = std::make_unique<SensorParam>(bus, path,
-                                                                  *this);
+                    auto paramPtr =
+                        std::make_unique<SensorParam>(bus, path, *this);
                     std::string paramName = j["ParamName"];
                     symbols.create_variable(paramName);
                     paramMap.emplace(std::move(paramName), std::move(paramPtr));
@@ -380,19 +380,18 @@
     std::filesystem::path p(entityPath);
     auto assocsDbus =
         AssociationList{{"chassis", "all_sensors", p.parent_path().string()}};
-    associationIface = std::make_unique<AssociationObject>(bus,
-                                                           objPath.c_str());
+    associationIface =
+        std::make_unique<AssociationObject>(bus, objPath.c_str());
     associationIface->associations(assocsDbus);
 }
 
-void VirtualSensor::initVirtualSensor(const InterfaceMap& interfaceMap,
-                                      const std::string& objPath,
-                                      const std::string& sensorType,
-                                      const std::string& calculationIface)
+void VirtualSensor::initVirtualSensor(
+    const InterfaceMap& interfaceMap, const std::string& objPath,
+    const std::string& sensorType, const std::string& calculationIface)
 {
     Json thresholds;
-    const std::string vsThresholdsIntf = calculationIface +
-                                         vsThresholdsIfaceSuffix;
+    const std::string vsThresholdsIntf =
+        calculationIface + vsThresholdsIfaceSuffix;
 
     for (const auto& [interface, propertyMap] : interfaceMap)
     {
@@ -472,8 +471,8 @@
             throw std::invalid_argument("ParamName not found in symbols");
         }
     }
-    auto itr = std::find(calculationIfaces.begin(), calculationIfaces.end(),
-                         exprStr);
+    auto itr =
+        std::find(calculationIfaces.begin(), calculationIfaces.end(), exprStr);
     auto val = (itr == calculationIfaces.end())
                    ? expression.value()
                    : calculateValue(exprStr, paramMap);
@@ -710,10 +709,10 @@
 
     try
     {
-        auto method = bus.new_method_call("xyz.openbmc_project.EntityManager",
-                                          "/xyz/openbmc_project/inventory",
-                                          "org.freedesktop.DBus.ObjectManager",
-                                          "GetManagedObjects");
+        auto method = bus.new_method_call(
+            "xyz.openbmc_project.EntityManager",
+            "/xyz/openbmc_project/inventory",
+            "org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
         auto reply = bus.call(method);
         reply.read(objects);
     }
diff --git a/virtualSensor.hpp b/virtualSensor.hpp
index 4248221..314b374 100644
--- a/virtualSensor.hpp
+++ b/virtualSensor.hpp
@@ -96,8 +96,7 @@
      */
     VirtualSensor(sdbusplus::bus_t& bus, const char* objPath,
                   const Json& sensorConfig, const std::string& name) :
-        ValueObject(bus, objPath, action::defer_emit),
-        bus(bus), name(name)
+        ValueObject(bus, objPath, action::defer_emit), bus(bus), name(name)
     {
         initVirtualSensor(sensorConfig, objPath);
     }
@@ -117,8 +116,8 @@
                   const InterfaceMap& ifacemap, const std::string& name,
                   const std::string& type, const std::string& calculationType,
                   const std::string& entityPath) :
-        ValueObject(bus, objPath, action::defer_emit),
-        bus(bus), name(name), entityPath(entityPath)
+        ValueObject(bus, objPath, action::defer_emit), bus(bus), name(name),
+        entityPath(entityPath)
     {
         initVirtualSensor(ifacemap, objPath, type, calculationType);
     }