clang-format: update to latest from docs repo
Since `Cpp11` is an alias for `Latest` and we should tend towards using the
latest C++ standard, udpate the C++ standard to Latest.
https://github.com/llvm/llvm-project/commit/e5032567903de19962333c4bf7d2edceaf4f9824#diff-b49a097415dff2837d9626d422c58ba8R82
https://github.com/openbmc/docs/blob/master/style/cpp/.clang-format
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Iaac09e3c11ead581114c4b7e45ff863ec56a63f6
diff --git a/.clang-format b/.clang-format
index ea71ad6..625a0a0 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,7 +5,7 @@
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: false
+AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
@@ -14,13 +14,13 @@
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: true
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
+ AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
@@ -29,15 +29,22 @@
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
+ AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
@@ -51,17 +58,21 @@
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"](gtest|gmock)'
- Priority: 5
+ Priority: 7
- Regex: '^"config.h"'
Priority: -1
- - Regex: '^".*\.hpp"'
+ - Regex: '^".*\.h"'
Priority: 1
- - Regex: '^<.*\.h>'
+ - Regex: '^".*\.hpp"'
Priority: 2
- - Regex: '^<.*'
+ - Regex: '^<.*\.h>'
Priority: 3
- - Regex: '.*'
+ - Regex: '^<.*\.hpp>'
Priority: 4
+ - Regex: '^<.*'
+ Priority: 5
+ - Regex: '.*'
+ Priority: 6
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
@@ -83,8 +94,13 @@
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
@@ -92,8 +108,7 @@
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
-
diff --git a/elog-errors.hpp b/elog-errors.hpp
index b9121c7..a2ad7c7 100644
--- a/elog-errors.hpp
+++ b/elog-errors.hpp
@@ -5,6 +5,7 @@
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/exception.hpp>
+
#include <string>
#include <tuple>
#include <type_traits>
diff --git a/fault-monitor/fru-fault-monitor.hpp b/fault-monitor/fru-fault-monitor.hpp
index d8ec721..5658218 100644
--- a/fault-monitor/fru-fault-monitor.hpp
+++ b/fault-monitor/fru-fault-monitor.hpp
@@ -4,6 +4,7 @@
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server.hpp>
+
#include <string>
namespace phosphor
diff --git a/group.hpp b/group.hpp
index fead647..fdfcf55 100644
--- a/group.hpp
+++ b/group.hpp
@@ -4,9 +4,10 @@
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/object.hpp>
-#include <string>
#include <xyz/openbmc_project/Led/Group/server.hpp>
+#include <string>
+
namespace phosphor
{
namespace led
@@ -15,8 +16,9 @@
/** @class Group
* @brief Manages group of LEDs and applies action on the elements of group
*/
-class Group : sdbusplus::server::object::object<
- sdbusplus::xyz::openbmc_project::Led::server::Group>
+class Group :
+ sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Led::server::Group>
{
public:
Group() = delete;
diff --git a/manager.cpp b/manager.cpp
index 04398e4..7741933 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -1,11 +1,12 @@
#include "manager.hpp"
-#include <algorithm>
-#include <iostream>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/exception.hpp>
-#include <string>
#include <xyz/openbmc_project/Led/Physical/server.hpp>
+
+#include <algorithm>
+#include <iostream>
+#include <string>
namespace phosphor
{
namespace led
diff --git a/manager.hpp b/manager.hpp
index 2c79a2f..0cc5cf6 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -2,8 +2,9 @@
#include "ledlayout.hpp"
-#include <map>
#include <sdbusplus/bus.hpp>
+
+#include <map>
#include <set>
#include <string>
diff --git a/test/utest.cpp b/test/utest.cpp
index 18a4341..787b345 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -1,8 +1,9 @@
#include "led-test-map.hpp"
#include "manager.hpp"
-#include <algorithm>
#include <sdbusplus/bus.hpp>
+
+#include <algorithm>
#include <set>
#include <gtest/gtest.h>