Add clang-format to repo

Add clang-format to repo.

Change-Id: Ib3f81524b66414df3e6c93d8a6df6e22c43841e0
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp
index aecb481..a7ed952 100644
--- a/fault-monitor/fru-fault-monitor.cpp
+++ b/fault-monitor/fru-fault-monitor.cpp
@@ -1,9 +1,11 @@
-#include <phosphor-logging/elog.hpp>
-#include <sdbusplus/exception.hpp>
+#include "fru-fault-monitor.hpp"
+
+#include "elog-errors.hpp"
 #include "xyz/openbmc_project/Led/Fru/Monitor/error.hpp"
 #include "xyz/openbmc_project/Led/Mapper/error.hpp"
-#include "elog-errors.hpp"
-#include "fru-fault-monitor.hpp"
+
+#include <phosphor-logging/elog.hpp>
+#include <sdbusplus/exception.hpp>
 
 namespace phosphor
 {
@@ -18,17 +20,17 @@
 
 using namespace phosphor::logging;
 
-constexpr auto MAPPER_BUSNAME   = "xyz.openbmc_project.ObjectMapper";
-constexpr auto MAPPER_OBJ_PATH  = "/xyz/openbmc_project/object_mapper";
-constexpr auto MAPPER_IFACE     = "xyz.openbmc_project.ObjectMapper";
-constexpr auto OBJMGR_IFACE     = "org.freedesktop.DBus.ObjectManager";
-constexpr auto LED_GROUPS       = "/xyz/openbmc_project/led/groups/";
-constexpr auto LOG_PATH         = "/xyz/openbmc_project/logging";
-constexpr auto LOG_IFACE        = "xyz.openbmc_project.Logging.Entry";
+constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
+constexpr auto MAPPER_OBJ_PATH = "/xyz/openbmc_project/object_mapper";
+constexpr auto MAPPER_IFACE = "xyz.openbmc_project.ObjectMapper";
+constexpr auto OBJMGR_IFACE = "org.freedesktop.DBus.ObjectManager";
+constexpr auto LED_GROUPS = "/xyz/openbmc_project/led/groups/";
+constexpr auto LOG_PATH = "/xyz/openbmc_project/logging";
+constexpr auto LOG_IFACE = "xyz.openbmc_project.Logging.Entry";
 
-using AssociationList = std::vector<std::tuple<
-                        std::string, std::string, std::string>>;
-using Attributes = sdbusplus::message::variant<bool,AssociationList>;
+using AssociationList =
+    std::vector<std::tuple<std::string, std::string, std::string>>;
+using Attributes = sdbusplus::message::variant<bool, AssociationList>;
 using PropertyName = std::string;
 using PropertyMap = std::map<PropertyName, Attributes>;
 using InterfaceName = std::string;
@@ -40,30 +42,25 @@
 using Interfaces = std::vector<Interface>;
 using MapperResponseType = std::map<Path, std::map<Service, Interfaces>>;
 
-using MethodErr  =
+using MethodErr =
     sdbusplus::xyz::openbmc_project::Led::Mapper::Error::MethodError;
 using ObjectNotFoundErr =
     sdbusplus::xyz::openbmc_project::Led::Mapper::Error::ObjectNotFoundError;
-using InventoryPathErr =
-    sdbusplus::xyz::openbmc_project::
-    Led::Fru::Monitor::Error::InventoryPathError;
+using InventoryPathErr = sdbusplus::xyz::openbmc_project::Led::Fru::Monitor::
+    Error::InventoryPathError;
 
-std::string getService(sdbusplus::bus::bus& bus,
-                       const std::string& path)
+std::string getService(sdbusplus::bus::bus& bus, const std::string& path)
 {
-    auto mapper = bus.new_method_call(MAPPER_BUSNAME,
-                                      MAPPER_OBJ_PATH,
+    auto mapper = bus.new_method_call(MAPPER_BUSNAME, MAPPER_OBJ_PATH,
                                       MAPPER_IFACE, "GetObject");
     mapper.append(path.c_str(), std::vector<std::string>({OBJMGR_IFACE}));
     auto mapperResponseMsg = bus.call(mapper);
     if (mapperResponseMsg.is_method_error())
     {
         using namespace xyz::openbmc_project::Led::Mapper;
-        elog<MethodErr>(
-            MethodError::METHOD_NAME("GetObject"),
-            MethodError::PATH(path.c_str()),
-            MethodError::INTERFACE(
-                OBJMGR_IFACE));
+        elog<MethodErr>(MethodError::METHOD_NAME("GetObject"),
+                        MethodError::PATH(path.c_str()),
+                        MethodError::INTERFACE(OBJMGR_IFACE));
     }
 
     std::map<std::string, std::vector<std::string>> mapperResponse;
@@ -73,32 +70,27 @@
     }
     catch (const sdbusplus::exception::SdBusError& e)
     {
-        log<level::ERR>("Failed to parse getService mapper response",
-                        entry("ERROR=%s", e.what()),
-                        entry("REPLY_SIG=%s", mapperResponseMsg.get_signature()));
+        log<level::ERR>(
+            "Failed to parse getService mapper response",
+            entry("ERROR=%s", e.what()),
+            entry("REPLY_SIG=%s", mapperResponseMsg.get_signature()));
         using namespace xyz::openbmc_project::Led::Mapper;
-        elog<ObjectNotFoundErr>(
-            ObjectNotFoundError::METHOD_NAME("GetObject"),
-            ObjectNotFoundError::PATH(path.c_str()),
-            ObjectNotFoundError::INTERFACE(
-                OBJMGR_IFACE));
+        elog<ObjectNotFoundErr>(ObjectNotFoundError::METHOD_NAME("GetObject"),
+                                ObjectNotFoundError::PATH(path.c_str()),
+                                ObjectNotFoundError::INTERFACE(OBJMGR_IFACE));
     }
     if (mapperResponse.empty())
     {
         using namespace xyz::openbmc_project::Led::Mapper;
-        elog<ObjectNotFoundErr>(
-            ObjectNotFoundError::METHOD_NAME("GetObject"),
-            ObjectNotFoundError::PATH(path.c_str()),
-            ObjectNotFoundError::INTERFACE(
-                OBJMGR_IFACE));
+        elog<ObjectNotFoundErr>(ObjectNotFoundError::METHOD_NAME("GetObject"),
+                                ObjectNotFoundError::PATH(path.c_str()),
+                                ObjectNotFoundError::INTERFACE(OBJMGR_IFACE));
     }
 
     return mapperResponse.cbegin()->first;
 }
 
-void action(sdbusplus::bus::bus& bus,
-            const std::string& path,
-            bool assert)
+void action(sdbusplus::bus::bus& bus, const std::string& path, bool assert)
 {
     std::string service;
     try
@@ -122,20 +114,15 @@
     if (pos == std::string::npos)
     {
         using namespace xyz::openbmc_project::Led::Fru::Monitor;
-        report<InventoryPathErr>(
-            InventoryPathError::PATH(
-                path.c_str()));
+        report<InventoryPathErr>(InventoryPathError::PATH(path.c_str()));
         return;
     }
     auto unit = path.substr(pos + 1);
 
-    std::string ledPath = LED_GROUPS +
-                          unit + '_' + LED_FAULT;
+    std::string ledPath = LED_GROUPS + unit + '_' + LED_FAULT;
 
-    auto method =  bus.new_method_call(service.c_str(),
-                                       ledPath.c_str(),
-                                       "org.freedesktop.DBus.Properties",
-                                       "Set");
+    auto method = bus.new_method_call(service.c_str(), ledPath.c_str(),
+                                      "org.freedesktop.DBus.Properties", "Set");
     method.append("xyz.openbmc_project.Led.Group");
     method.append("Asserted");
 
@@ -176,7 +163,7 @@
     std::size_t found = objectPath.str.find(ELOG_ENTRY);
     if (found == std::string::npos)
     {
-        //Not a new error entry skip
+        // Not a new error entry skip
         return;
     }
     auto iter = interfaces.find("org.openbmc.Associations");
@@ -185,8 +172,8 @@
         return;
     }
 
-    //Nothing else shows when a specific error log
-    //has been created. Do it here.
+    // Nothing else shows when a specific error log
+    // has been created. Do it here.
     std::string message{objectPath.str + " created"};
     log<level::INFO>(message.c_str());
 
@@ -200,7 +187,7 @@
         sdbusplus::message::variant_ns::get<AssociationList>(attr->second);
     if (assocs.empty())
     {
-        //No associations skip
+        // No associations skip
         return;
     }
 
@@ -220,10 +207,8 @@
 void getLoggingSubTree(sdbusplus::bus::bus& bus, MapperResponseType& subtree)
 {
     auto depth = 0;
-    auto mapperCall = bus.new_method_call(MAPPER_BUSNAME,
-                                          MAPPER_OBJ_PATH,
-                                          MAPPER_IFACE,
-                                          "GetSubTree");
+    auto mapperCall = bus.new_method_call(MAPPER_BUSNAME, MAPPER_OBJ_PATH,
+                                          MAPPER_IFACE, "GetSubTree");
     mapperCall.append("/");
     mapperCall.append(depth);
     mapperCall.append(std::vector<Interface>({LOG_IFACE}));
@@ -234,10 +219,9 @@
         if (mapperResponseMsg.is_method_error())
         {
             using namespace xyz::openbmc_project::Led::Mapper;
-            report<MethodErr>(
-                    MethodError::METHOD_NAME("GetSubTree"),
-                    MethodError::PATH(MAPPER_OBJ_PATH),
-                    MethodError::INTERFACE(OBJMGR_IFACE));
+            report<MethodErr>(MethodError::METHOD_NAME("GetSubTree"),
+                              MethodError::PATH(MAPPER_OBJ_PATH),
+                              MethodError::INTERFACE(OBJMGR_IFACE));
             return;
         }
 
@@ -247,9 +231,10 @@
         }
         catch (const sdbusplus::exception::SdBusError& e)
         {
-            log<level::ERR>("Failed to parse existing callouts subtree message",
-                    entry("ERROR=%s", e.what()),
-                    entry("REPLY_SIG=%s", mapperResponseMsg.get_signature()));
+            log<level::ERR>(
+                "Failed to parse existing callouts subtree message",
+                entry("ERROR=%s", e.what()),
+                entry("REPLY_SIG=%s", mapperResponseMsg.get_signature()));
         }
     }
     catch (const sdbusplus::exception::SdBusError& e)
@@ -260,27 +245,26 @@
 
 void Add::processExistingCallouts(sdbusplus::bus::bus& bus)
 {
-    MapperResponseType  mapperResponse;
+    MapperResponseType mapperResponse;
 
     getLoggingSubTree(bus, mapperResponse);
     if (mapperResponse.empty())
     {
-        //No errors to process.
+        // No errors to process.
         return;
     }
 
     for (const auto& elem : mapperResponse)
     {
-        auto method =  bus.new_method_call(elem.second.begin()->first.c_str(),
-                                           elem.first.c_str(),
-                                           "org.freedesktop.DBus.Properties",
-                                           "Get");
+        auto method = bus.new_method_call(
+            elem.second.begin()->first.c_str(), elem.first.c_str(),
+            "org.freedesktop.DBus.Properties", "Get");
         method.append("org.openbmc.Associations");
         method.append("associations");
         auto reply = bus.call(method);
         if (reply.is_method_error())
         {
-            //do not stop, continue with next elog
+            // do not stop, continue with next elog
             log<level::ERR>("Error in getting associations");
             continue;
         }
@@ -292,15 +276,16 @@
         }
         catch (const sdbusplus::exception::SdBusError& e)
         {
-            log<level::ERR>("Failed to parse existing callouts associations message",
-                            entry("ERROR=%s", e.what()),
-                            entry("REPLY_SIG=%s", reply.get_signature()));
+            log<level::ERR>(
+                "Failed to parse existing callouts associations message",
+                entry("ERROR=%s", e.what()),
+                entry("REPLY_SIG=%s", reply.get_signature()));
             continue;
         }
         auto& assocs = assoc.get<AssociationList>();
         if (assocs.empty())
         {
-            //no associations, skip
+            // no associations, skip
             continue;
         }
 
@@ -324,8 +309,8 @@
     return;
 }
 
-}//namespace monitor
-}//namespace fault
-}//namespace fru
-}//namespace led
-}//namespace phosphor
+} // namespace monitor
+} // namespace fault
+} // namespace fru
+} // namespace led
+} // namespace phosphor
diff --git a/fault-monitor/fru-fault-monitor.hpp b/fault-monitor/fru-fault-monitor.hpp
index 77d3be2..54eb655 100644
--- a/fault-monitor/fru-fault-monitor.hpp
+++ b/fault-monitor/fru-fault-monitor.hpp
@@ -1,8 +1,9 @@
 #pragma once
 
+#include "config.h"
+
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server.hpp>
-#include "config.h"
 
 namespace phosphor
 {
@@ -16,13 +17,11 @@
 {
 
 /** @brief Assert or deassert an LED based on the input FRU
-  *  @param[in] bus       -  The Dbus bus object
-  *  @param[in] path      -  Inventory path of the FRU
-  *  @param[in] assert    -  Assert if true deassert if false
-  */
-void action(sdbusplus::bus::bus& bus,
-            const std::string& path,
-            bool assert);
+ *  @param[in] bus       -  The Dbus bus object
+ *  @param[in] path      -  Inventory path of the FRU
+ *  @param[in] assert    -  Assert if true deassert if false
+ */
+void action(sdbusplus::bus::bus& bus, const std::string& path, bool assert);
 
 class Remove;
 
@@ -33,44 +32,43 @@
  */
 class Add
 {
-    public:
-        Add() = delete;
-        ~Add() = default;
-        Add(const Add&) = delete;
-        Add& operator=(const Add&) = delete;
-        Add(Add&&) = default;
-        Add& operator=(Add&&) = default;
+  public:
+    Add() = delete;
+    ~Add() = default;
+    Add(const Add&) = delete;
+    Add& operator=(const Add&) = delete;
+    Add(Add&&) = default;
+    Add& operator=(Add&&) = default;
 
-        /** @brief constructs Add a watch for FRU faults.
-         *  @param[in] bus -  The Dbus bus object
-         */
-        Add(sdbusplus::bus::bus& bus):
-            matchCreated(
-                bus,
-                sdbusplus::bus::match::rules::interfacesAdded() +
+    /** @brief constructs Add a watch for FRU faults.
+     *  @param[in] bus -  The Dbus bus object
+     */
+    Add(sdbusplus::bus::bus& bus) :
+        matchCreated(
+            bus,
+            sdbusplus::bus::match::rules::interfacesAdded() +
                 sdbusplus::bus::match::rules::path_namespace(
-                        "/xyz/openbmc_project/logging"),
-                std::bind(std::mem_fn(&Add::created),
-                          this, std::placeholders::_1))
-        {
-            processExistingCallouts(bus);
-        }
-    private:
+                    "/xyz/openbmc_project/logging"),
+            std::bind(std::mem_fn(&Add::created), this, std::placeholders::_1))
+    {
+        processExistingCallouts(bus);
+    }
 
-        /** @brief sdbusplus signal match for fault created */
-        sdbusplus::bus::match_t matchCreated;
+  private:
+    /** @brief sdbusplus signal match for fault created */
+    sdbusplus::bus::match_t matchCreated;
 
-        std::vector<std::unique_ptr<Remove>> removeWatches;
+    std::vector<std::unique_ptr<Remove>> removeWatches;
 
-        /** @brief Callback function for fru fault created
-         *  @param[in] msg       - Data associated with subscribed signal
-         */
-        void created(sdbusplus::message::message& msg);
+    /** @brief Callback function for fru fault created
+     *  @param[in] msg       - Data associated with subscribed signal
+     */
+    void created(sdbusplus::message::message& msg);
 
-        /** @brief This function process all callouts at application start
-         *  @param[in] bus - The Dbus bus object
-         */
-        void processExistingCallouts(sdbusplus::bus::bus& bus);
+    /** @brief This function process all callouts at application start
+     *  @param[in] bus - The Dbus bus object
+     */
+    void processExistingCallouts(sdbusplus::bus::bus& bus);
 };
 
 /** @class Remove
@@ -80,59 +78,55 @@
  */
 class Remove
 {
-    public:
-        Remove() = delete;
-        ~Remove() = default;
-        Remove(const Remove&) = delete;
-        Remove& operator=(const Remove&) = delete;
-        Remove(Remove&&) = default;
-        Remove& operator=(Remove&&) = default;
+  public:
+    Remove() = delete;
+    ~Remove() = default;
+    Remove(const Remove&) = delete;
+    Remove& operator=(const Remove&) = delete;
+    Remove(Remove&&) = default;
+    Remove& operator=(Remove&&) = default;
 
-        /** @brief constructs Remove
-         *  @param[in] bus  -  The Dbus bus object
-         *  @param[in] path -  Inventory path to fru
-         */
-        Remove(sdbusplus::bus::bus& bus, const std::string& path):
-            inventoryPath(path),
-            matchRemoved(
-                bus,
-                match(path),
-                std::bind(std::mem_fn(&Remove::removed),
-                          this, std::placeholders::_1))
-        {
-            //Do nothing
-        }
+    /** @brief constructs Remove
+     *  @param[in] bus  -  The Dbus bus object
+     *  @param[in] path -  Inventory path to fru
+     */
+    Remove(sdbusplus::bus::bus& bus, const std::string& path) :
+        inventoryPath(path),
+        matchRemoved(bus, match(path),
+                     std::bind(std::mem_fn(&Remove::removed), this,
+                               std::placeholders::_1))
+    {
+        // Do nothing
+    }
 
-    private:
+  private:
+    /** @brief inventory path of the FRU */
+    std::string inventoryPath;
 
-        /** @brief inventory path of the FRU */
-        std::string inventoryPath;
+    /** @brief sdbusplus signal matches for fault removed */
+    sdbusplus::bus::match_t matchRemoved;
 
-        /** @brief sdbusplus signal matches for fault removed */
-        sdbusplus::bus::match_t matchRemoved;
+    /** @brief Callback function for fru fault created
+     *  @param[in] msg       - Data associated with subscribed signal
+     */
+    void removed(sdbusplus::message::message& msg);
 
-        /** @brief Callback function for fru fault created
-         *  @param[in] msg       - Data associated with subscribed signal
-         */
-        void removed(sdbusplus::message::message& msg);
+    /** @brief function to create fault remove match for a fru
+     *  @param[in] path  - Inventory path of the faulty unit.
+     */
+    std::string match(const std::string& path)
+    {
+        namespace MatchRules = sdbusplus::bus::match::rules;
 
-        /** @brief function to create fault remove match for a fru
-         *  @param[in] path  - Inventory path of the faulty unit.
-         */
-        std::string match(const std::string& path)
-        {
-            namespace MatchRules = sdbusplus::bus::match::rules;
+        std::string matchStmt =
+            MatchRules::interfacesRemoved() +
+            MatchRules::argNpath(0, path + "/" + CALLOUT_REV_ASSOCIATION);
 
-            std::string matchStmt =
-                    MatchRules::interfacesRemoved() +
-                    MatchRules::argNpath(
-                            0, path + "/" + CALLOUT_REV_ASSOCIATION);
-
-            return matchStmt;
-        }
+        return matchStmt;
+    }
 };
-}//namespace monitor
-}//namespace fault
-}//namespace fru
-}//namespace led
-}//namespace phosphor
+} // namespace monitor
+} // namespace fault
+} // namespace fru
+} // namespace led
+} // namespace phosphor