formatter: update clang-format and fix-up file(s)

clang-format-6.0 introduced new changes, also then updates to
.clang-format introduce more new changes.

Change-Id: Iec9f84e3a7a5bf254d66eee46cdc9b3070e06687
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/.clang-format b/.clang-format
index bbc1bb1..ea71ad6 100644
--- a/.clang-format
+++ b/.clang-format
@@ -17,7 +17,7 @@
 AlwaysBreakAfterDefinitionReturnType: None
 AlwaysBreakAfterReturnType: None
 AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: false
+AlwaysBreakTemplateDeclarations: true
 BinPackArguments: true
 BinPackParameters: true
 BraceWrapping:
@@ -42,12 +42,26 @@
 ConstructorInitializerIndentWidth: 4
 ContinuationIndentWidth: 4
 Cpp11BracedListStyle: true
-DerivePointerAlignment: true
+DerivePointerAlignment: false
 PointerAlignment: Left
 DisableFormat:   false
 ExperimentalAutoDetectBinPacking: false
 FixNamespaceComments: true
 ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IncludeBlocks: Regroup
+IncludeCategories:
+  - Regex:           '^[<"](gtest|gmock)'
+    Priority:        5
+  - Regex:           '^"config.h"'
+    Priority:        -1
+  - Regex:           '^".*\.hpp"'
+    Priority:        1
+  - Regex:           '^<.*\.h>'
+    Priority:        2
+  - Regex:           '^<.*'
+    Priority:        3
+  - Regex:           '.*'
+    Priority:        4
 IndentCaseLabels: true
 IndentWidth:     4
 IndentWrappedFunctionNames: true
@@ -65,9 +79,9 @@
 PenaltyBreakString: 1000
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Right
 ReflowComments:  true
-SortIncludes:    false
+SortIncludes:    true
+SortUsingDeclarations: true
 SpaceAfterCStyleCast: false
 SpaceBeforeAssignmentOperators: true
 SpaceBeforeParens: ControlStatements
diff --git a/app.cpp b/app.cpp
index 874df67..1ec886c 100644
--- a/app.cpp
+++ b/app.cpp
@@ -14,11 +14,13 @@
  * limitations under the License.
  */
 #include "config.h"
+
 #include "manager.hpp"
-#include <sdbusplus/bus.hpp>
+
 #include <cstdlib>
-#include <iostream>
 #include <exception>
+#include <iostream>
+#include <sdbusplus/bus.hpp>
 
 int main(int argc, char* argv[])
 {
diff --git a/errors.cpp b/errors.cpp
index ed23ffe..b751107 100644
--- a/errors.cpp
+++ b/errors.cpp
@@ -13,9 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <phosphor-logging/log.hpp>
 #include "errors.hpp"
 
+#include <phosphor-logging/log.hpp>
+
 namespace phosphor
 {
 namespace inventory
diff --git a/functor.cpp b/functor.cpp
index b9e2521..90d713a 100644
--- a/functor.cpp
+++ b/functor.cpp
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 #include "functor.hpp"
+
 #include <sdbusplus/bus.hpp>
 
 namespace phosphor
diff --git a/functor.hpp b/functor.hpp
index fc763e5..3a3077d 100644
--- a/functor.hpp
+++ b/functor.hpp
@@ -1,10 +1,11 @@
 #pragma once
 
-#include <utility>
+#include "types.hpp"
+#include "utils.hpp"
+
 #include <memory>
 #include <sdbusplus/bus.hpp>
-#include "utils.hpp"
-#include "types.hpp"
+#include <utility>
 
 namespace phosphor
 {
@@ -24,7 +25,8 @@
  *
  *  @tparam T - The type of the action being adapted.
  */
-template <typename T> auto make_action(T&& action)
+template <typename T>
+auto make_action(T&& action)
 {
     return Action(std::forward<T>(action));
 }
@@ -38,7 +40,8 @@
  *
  *  @tparam T - The type of the filter being adapted.
  */
-template <typename T> auto make_filter(T&& filter)
+template <typename T>
+auto make_filter(T&& filter)
 {
     return Filter(std::forward<T>(filter));
 }
@@ -52,7 +55,8 @@
  *
  *  @tparam T - The type of the functor being adapted.
  */
-template <typename T> auto make_path_condition(T&& condition)
+template <typename T>
+auto make_path_condition(T&& condition)
 {
     return PathCondition(std::forward<T>(condition));
 }
@@ -123,11 +127,8 @@
     // Bind the path, interface, interface member function pointer,
     // and value to a lambda.  When it is called, forward the
     // path, interface and value on to the manager member function.
-    return [
-        paths, conditions = conditions, iface, member,
-        value = std::forward<V>(value)
-    ](auto& b, auto& m)
-    {
+    return [paths, conditions = conditions, iface, member,
+            value = std::forward<V>(value)](auto& b, auto& m) {
         for (auto p : paths)
         {
             if (callArrayWithStatus(conditions, p, b, m))
@@ -144,7 +145,8 @@
  *  @tparam T - The type of the property being tested.
  *  @tparam U - The type of the condition checking functor.
  */
-template <typename T, typename U> struct PropertyChangedCondition
+template <typename T, typename U>
+struct PropertyChangedCondition
 {
     PropertyChangedCondition() = delete;
     ~PropertyChangedCondition() = default;
@@ -309,8 +311,7 @@
 template <typename T>
 auto propertyChangedTo(const char* iface, const char* property, T&& val)
 {
-    auto condition = [val = std::forward<T>(val)](T && arg)
-    {
+    auto condition = [val = std::forward<T>(val)](T&& arg) {
         return arg == val;
     };
     using U = decltype(condition);
@@ -323,8 +324,7 @@
 auto propertyIs(const char* path, const char* iface, const char* property,
                 T&& val, const char* service = nullptr)
 {
-    auto condition = [val = std::forward<T>(val)](T && arg)
-    {
+    auto condition = [val = std::forward<T>(val)](T&& arg) {
         return arg == val;
     };
     using U = decltype(condition);
diff --git a/manager.cpp b/manager.cpp
index 8b35a0a..c138d40 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -13,15 +13,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <iostream>
-#include <exception>
-#include <chrono>
-#include <algorithm>
-#include <phosphor-logging/log.hpp>
-#include <experimental/filesystem>
 #include "manager.hpp"
+
 #include "errors.hpp"
 
+#include <algorithm>
+#include <chrono>
+#include <exception>
+#include <experimental/filesystem>
+#include <iostream>
+#include <phosphor-logging/log.hpp>
+
 using namespace std::literals::chrono_literals;
 
 namespace phosphor
diff --git a/manager.hpp b/manager.hpp
index 9bbd3c7..1213267 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -1,15 +1,16 @@
 #pragma once
 
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-#include <sdbusplus/server.hpp>
-#include <xyz/openbmc_project/Inventory/Manager/server.hpp>
 #include "events.hpp"
 #include "functor.hpp"
-#include "types.hpp"
 #include "serialize.hpp"
+#include "types.hpp"
+
+#include <map>
+#include <memory>
+#include <sdbusplus/server.hpp>
+#include <string>
+#include <vector>
+#include <xyz/openbmc_project/Inventory/Manager/server.hpp>
 
 namespace phosphor
 {
@@ -18,7 +19,8 @@
 namespace manager
 {
 
-template <typename T> using ServerObject = T;
+template <typename T>
+using ServerObject = T;
 
 using ManagerIface =
     sdbusplus::xyz::openbmc_project::Inventory::server::Manager;
@@ -32,7 +34,8 @@
  *
  *  @tparam T - The sdbusplus server binding type.
  */
-template <typename T, typename Enable = void> struct PropertiesVariant
+template <typename T, typename Enable = void>
+struct PropertiesVariant
 {
 };
 
@@ -46,7 +49,8 @@
 template <typename T>
 using PropertiesVariantType = typename PropertiesVariant<T>::Type;
 
-template <typename T, typename U = int> struct HasProperties : std::false_type
+template <typename T, typename U = int>
+struct HasProperties : std::false_type
 {
 };
 
@@ -133,7 +137,8 @@
  *  @tparam T - The type of the interface being adapted.
  */
 
-template <typename T> struct MakeInterface
+template <typename T>
+struct MakeInterface
 {
     static any_ns::any make(sdbusplus::bus::bus& bus, const char* path,
                             const Interface& props)
diff --git a/serialize.hpp b/serialize.hpp
index 132df58..e0fc89a 100644
--- a/serialize.hpp
+++ b/serialize.hpp
@@ -1,10 +1,10 @@
 #pragma once
 
+#include "config.h"
+
 #include <cereal/archives/json.hpp>
 #include <experimental/filesystem>
 #include <fstream>
-#include "config.h"
-
 #include <phosphor-logging/log.hpp>
 
 namespace cereal
diff --git a/test/test.cpp b/test/test.cpp
index 5cadbe0..2327239 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -13,16 +13,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include "manager.hpp"
 #include "config.h"
-#include <cassert>
-#include <iostream>
-#include <algorithm>
-#include <thread>
-#include <chrono>
+
+#include "manager.hpp"
 #include "xyz/openbmc_project/Example/Iface1/server.hpp"
 #include "xyz/openbmc_project/Example/Iface2/server.hpp"
 
+#include <algorithm>
+#include <cassert>
+#include <chrono>
+#include <iostream>
+#include <thread>
+
 using namespace std::literals::chrono_literals;
 using namespace std::literals::string_literals;
 
diff --git a/types.hpp b/types.hpp
index 5b65d5a..503847a 100644
--- a/types.hpp
+++ b/types.hpp
@@ -1,10 +1,10 @@
 #pragma once
 
-#include <map>
-#include <string>
-#include <sdbusplus/message.hpp>
 #include <experimental/any>
 #include <functional>
+#include <map>
+#include <sdbusplus/message.hpp>
+#include <string>
 
 namespace phosphor
 {
@@ -20,7 +20,8 @@
 using InterfaceVariantType =
     sdbusplus::message::variant<bool, int64_t, std::string>;
 
-template <typename T> using InterfaceType = std::map<std::string, T>;
+template <typename T>
+using InterfaceType = std::map<std::string, T>;
 
 template <typename T>
 using ObjectType = std::map<std::string, InterfaceType<T>>;
diff --git a/utils.hpp b/utils.hpp
index cf3b5cf..aacee5e 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -11,7 +11,8 @@
  *
  *  @tparam V - The desired variant type.
  */
-template <typename V> struct MakeVariantVisitor
+template <typename V>
+struct MakeVariantVisitor
 {
     /** @struct Make
      *  @brief Return variant visitor.
@@ -20,7 +21,8 @@
      *  @tparam Arg - The type being visited in the source variant.
      *  @tparam Enable - Overload resolution removal.
      */
-    template <typename T, typename Arg, typename Enable = void> struct Make
+    template <typename T, typename Arg, typename Enable = void>
+    struct Make
     {
         static auto make(Arg&& arg)
         {
@@ -47,7 +49,8 @@
     };
 
     /** @brief Make variant visitor.  */
-    template <typename Arg> auto operator()(Arg&& arg) const
+    template <typename Arg>
+    auto operator()(Arg&& arg) const
     {
         return Make<V, Arg>::make(arg);
     }
@@ -61,7 +64,8 @@
  *  @param[in] v - The source variant.
  *  @returns - The converted variant.
  */
-template <typename V, typename Arg> auto convertVariant(Arg&& v)
+template <typename V, typename Arg>
+auto convertVariant(Arg&& v)
 {
     return sdbusplus::message::variant_ns::apply_visitor(
         MakeVariantVisitor<V>(), v);
@@ -75,7 +79,8 @@
  *
  *  @tparam Compare - The function object type being adapted.
  */
-template <typename Compare> struct CompareFirst
+template <typename Compare>
+struct CompareFirst
 {
     /** @brief Construct a CompareFirst adapter.
      *
@@ -143,7 +148,8 @@
 };
 
 /* @brief Implicit template instantation wrapper for CompareFirst. */
-template <typename Compare> CompareFirst<Compare> compareFirst(Compare&& c)
+template <typename Compare>
+CompareFirst<Compare> compareFirst(Compare&& c)
 {
     return CompareFirst<Compare>(std::forward<Compare>(c));
 }