clang-format: update with latest
Pick up the latest .clang-format from the docs repository.
Change-Id: I205c7f9abd502a02a480b489446f3db37f303e05
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 3652c56..82c0e2c 100644
--- a/.clang-format
+++ b/.clang-format
@@ -6,12 +6,12 @@
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
-AlignOperands: true
+AlignOperands: Align
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
@@ -41,7 +41,7 @@
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
-BreakStringLiterals: true
+BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
@@ -49,6 +49,7 @@
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
+DeriveLineEnding: false
DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
@@ -74,9 +75,11 @@
- Regex: '.*'
Priority: 6
IndentCaseLabels: true
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -84,13 +87,18 @@
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
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
@@ -110,4 +118,7 @@
SpacesInSquareBrackets: false
Standard: Latest
TabWidth: 4
+UseCRLF: false
UseTab: Never
+...
+
diff --git a/analyzer.cpp b/analyzer.cpp
index b26a53a..dbcb754 100644
--- a/analyzer.cpp
+++ b/analyzer.cpp
@@ -597,8 +597,8 @@
sd_bus_message_get_reply_cookie(m, &reply_serial);
if (in_flight_methodcalls.count(reply_serial) > 0)
{
- float dt_usec =
- Microseconds() - in_flight_methodcalls[reply_serial];
+ float dt_usec = Microseconds() -
+ in_flight_methodcalls[reply_serial];
in_flight_methodcalls.erase(reply_serial);
dbus_top_analyzer::g_mc_time_histogram.AddSample(dt_usec);
diff --git a/dbus_capture.cpp b/dbus_capture.cpp
index 50ed37f..38acfc4 100644
--- a/dbus_capture.cpp
+++ b/dbus_capture.cpp
@@ -34,8 +34,7 @@
extern Histogram<float> g_mc_time_histogram;
} // namespace dbus_top_analyzer
-static void TrackMessage([[maybe_unused]] sd_bus_message* m)
-{}
+static void TrackMessage([[maybe_unused]] sd_bus_message* m) {}
// Obtain a Monitoring DBus connection
int AcquireBus(sd_bus** ret)
{
diff --git a/histogram.hpp b/histogram.hpp
index a031127..0c314d5 100644
--- a/histogram.hpp
+++ b/histogram.hpp
@@ -116,8 +116,8 @@
else
{
buckets_[bucket_idx]++;
- max_bucket_height_ =
- std::max(max_bucket_height_, buckets_[bucket_idx]);
+ max_bucket_height_ = std::max(max_bucket_height_,
+ buckets_[bucket_idx]);
}
}
}
diff --git a/main.hpp b/main.hpp
index 91c07da..7debec3 100644
--- a/main.hpp
+++ b/main.hpp
@@ -24,10 +24,8 @@
struct Rect
{
int x, y, w, h; // X, Y, Width, Height
- Rect(int _x, int _y, int _w, int _h) : x(_x), y(_y), w(_w), h(_h)
- {}
- Rect() : x(0), y(0), w(1), h(1)
- {}
+ Rect(int _x, int _y, int _w, int _h) : x(_x), y(_y), w(_w), h(_h) {}
+ Rect() : x(0), y(0), w(1), h(1) {}
};
int DrawTextWithWidthLimit(WINDOW* win, std::string txt, int y, int x,
diff --git a/menu.cpp b/menu.cpp
index dcff459..a516c5f 100644
--- a/menu.cpp
+++ b/menu.cpp
@@ -202,8 +202,8 @@
}
return;
}
- const int nrows =
- (order == ColumnMajor) ? DispEntriesPerColumn() : DispEntriesPerRow();
+ const int nrows = (order == ColumnMajor) ? DispEntriesPerColumn()
+ : DispEntriesPerRow();
const int tot_columns = (N - 1) / nrows + 1;
const int num_rows_last_column = N - nrows * (tot_columns - 1);
int y = choice_ % nrows, x = choice_ / nrows;
diff --git a/rect.hpp b/rect.hpp
index aa7bf89..8106143 100644
--- a/rect.hpp
+++ b/rect.hpp
@@ -19,8 +19,6 @@
struct Rect
{
int x, y, w, h; // X, Y, Width, Height
- Rect(int _x, int _y, int _w, int _h) : x(_x), y(_y), w(_w), h(_h)
- {}
- Rect() : x(0), y(0), w(1), h(1)
- {}
+ Rect(int _x, int _y, int _w, int _h) : x(_x), y(_y), w(_w), h(_h) {}
+ Rect() : x(0), y(0), w(1), h(1) {}
};
\ No newline at end of file
diff --git a/sensorhelper.hpp b/sensorhelper.hpp
index 4c80ebb..3aa7c0f 100644
--- a/sensorhelper.hpp
+++ b/sensorhelper.hpp
@@ -116,8 +116,8 @@
const std::string& _cmd, const std::string& _unit,
int _pid)
{
- DBusConnection* cxn =
- new DBusConnection(_s, _connection, _cmd, _unit, _pid);
+ DBusConnection* cxn = new DBusConnection(_s, _connection, _cmd, _unit,
+ _pid);
connections_.push_back(cxn);
unique_name_to_cxn[_connection] = cxn;
}
diff --git a/views.cpp b/views.cpp
index b8de9ae..bb0ab84 100644
--- a/views.cpp
+++ b/views.cpp
@@ -112,9 +112,9 @@
snap = 1000;
}
const float eps = snap / 100.0f;
- int label_ymax =
- (static_cast<int>((ymax - eps) / snap) + 1) * snap; // round up
- int label_ymin = static_cast<int>(ymin / snap) * snap; // round down
+ int label_ymax = (static_cast<int>((ymax - eps) / snap) + 1) *
+ snap; // round up
+ int label_ymin = static_cast<int>(ymin / snap) * snap; // round down
float y_per_row = (label_ymax - label_ymin) * 1.0f / (h - 1);
int actual_ymax = label_ymax + static_cast<int>(y_per_row / 2);
int actual_ymin = label_ymin - static_cast<int>(y_per_row / 2);
@@ -1072,8 +1072,8 @@
}
else
{
- float avg_latency_usec =
- m.total_latency_usec / m.num_method_calls;
+ float avg_latency_usec = m.total_latency_usec /
+ m.num_method_calls;
row.push_back(FloatToString(avg_latency_usec));
sof.f = avg_latency_usec;
}
@@ -1096,7 +1096,7 @@
stats_snapshot_staged.begin(), stats_snapshot_staged.end(),
[](const std::pair<StringOrFloat, std::vector<std::string>>& a,
const std::pair<StringOrFloat, std::vector<std::string>>& b) {
- return a.first.f < b.first.f;
+ return a.first.f < b.first.f;
});
}
else
@@ -1105,7 +1105,7 @@
stats_snapshot_staged.begin(), stats_snapshot_staged.end(),
[](const std::pair<StringOrFloat, std::vector<std::string>>& a,
const std::pair<StringOrFloat, std::vector<std::string>>& b) {
- return a.first.s < b.first.s;
+ return a.first.s < b.first.s;
});
}
diff --git a/views.hpp b/views.hpp
index 203795d..149411a 100644
--- a/views.hpp
+++ b/views.hpp
@@ -38,8 +38,7 @@
maximize_ = false;
}
- virtual ~DBusTopWindow()
- {}
+ virtual ~DBusTopWindow() {}
virtual void OnKeyDown(const std::string& key) = 0;
virtual void Render() = 0;
virtual void OnResize(int win_w, int win_h) = 0;
@@ -82,8 +81,7 @@
class SummaryView : public DBusTopWindow
{
public:
- SummaryView() : DBusTopWindow()
- {}
+ SummaryView() : DBusTopWindow() {}
void Render() override;
void OnResize(int win_w, [[maybe_unused]] int win_h) override
{
@@ -95,8 +93,7 @@
}
void UpdateDBusTopStatistics(DBusTopStatistics* stat);
- void OnKeyDown([[maybe_unused]] const std::string& key) override
- {}
+ void OnKeyDown([[maybe_unused]] const std::string& key) override {}
std::string GetStatusString() override
{
return "Summary View";
@@ -520,8 +517,7 @@
selectable_ = false; // Cannot be selected by the tab key
}
- void OnKeyDown([[maybe_unused]] const std::string& key) override
- {}
+ void OnKeyDown([[maybe_unused]] const std::string& key) override {}
void OnResize(int win_w, int win_h) override
{
rect.h = 1;
diff --git a/xmlparse.hpp b/xmlparse.hpp
index 1ed836f..9f1ff84 100644
--- a/xmlparse.hpp
+++ b/xmlparse.hpp
@@ -25,8 +25,7 @@
std::map<std::string, std::string> fields;
std::vector<XMLNode*> children;
std::vector<XMLNode*> interfaces;
- XMLNode(const std::string& t) : tag(t)
- {}
+ XMLNode(const std::string& t) : tag(t) {}
void AddChild(XMLNode* x)
{