Skip to content

Commit 4c6c395

Browse files
committed
Add braces around if/for bodies
1 parent 23aad32 commit 4c6c395

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

flang/include/flang/Semantics/dump-expr.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,21 @@ class DumpEvaluateExpr {
6767
}
6868
template <typename A> void Show(const std::vector<A> &x) {
6969
Indent("vector");
70-
for (const auto &v : x)
70+
for (const auto &v : x) {
7171
Show(v);
72+
}
7273
Outdent();
7374
}
7475
void Show(const evaluate::BOZLiteralConstant &);
7576
void Show(const evaluate::NullPointer &);
7677
template <typename T> void Show(const evaluate::Constant<T> &x) {
7778
if constexpr (T::category == common::TypeCategory::Derived) {
7879
Indent("derived constant");
79-
for (const auto &map : x.values())
80-
for (const auto &pair : map)
80+
for (const auto &map : x.values()) {
81+
for (const auto &pair : map) {
8182
Show(pair.second.value());
83+
}
84+
}
8285
Outdent();
8386
} else {
8487
Print("constant");
@@ -130,8 +133,9 @@ class DumpEvaluateExpr {
130133
template <typename T>
131134
void Show(const evaluate::ArrayConstructorValues<T> &x) {
132135
Indent("array constructor value");
133-
for (auto &v : x)
136+
for (auto &v : x) {
134137
Show(v);
138+
}
135139
Outdent();
136140
}
137141
template <typename T> void Show(const evaluate::ImpliedDo<T> &x) {

flang/lib/Semantics/dump-expr.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ void DumpEvaluateExpr::Show(const evaluate::Component &x) {
6969

7070
void DumpEvaluateExpr::Show(const evaluate::NamedEntity &x) {
7171
Indent("named entity");
72-
if (const auto *component{x.UnwrapComponent()})
72+
if (const auto *component{x.UnwrapComponent()}) {
7373
Show(*component);
74-
else
74+
} else {
7575
Show(x.GetFirstSymbol());
76+
}
7677
Outdent();
7778
}
7879

@@ -130,8 +131,9 @@ void DumpEvaluateExpr::Show(
130131

131132
void DumpEvaluateExpr::Show(const DerivedTypeSpec &x) {
132133
Indent("derived type spec");
133-
for (auto &v : x.parameters())
134+
for (auto &v : x.parameters()) {
134135
Show(v);
136+
}
135137
Outdent();
136138
}
137139

@@ -143,8 +145,9 @@ void DumpEvaluateExpr::Show(
143145
void DumpEvaluateExpr::Show(const evaluate::StructureConstructor &x) {
144146
Indent("structure constructor");
145147
Show(x.derivedTypeSpec());
146-
for (auto &v : x)
148+
for (auto &v : x) {
147149
Show(v);
150+
}
148151
Outdent();
149152
}
150153

@@ -162,21 +165,23 @@ void DumpEvaluateExpr::Show(const evaluate::ComplexPart &x) {
162165

163166
void DumpEvaluateExpr::Show(const evaluate::ActualArgument &x) {
164167
Indent("actual argument");
165-
if (const auto *symbol{x.GetAssumedTypeDummy()})
168+
if (const auto *symbol{x.GetAssumedTypeDummy()}) {
166169
Show(*symbol);
167-
else
170+
} else {
168171
Show(x.UnwrapExpr());
172+
}
169173
Outdent();
170174
}
171175

172176
void DumpEvaluateExpr::Show(const evaluate::ProcedureDesignator &x) {
173177
Indent("procedure designator");
174-
if (const auto *component{x.GetComponent()})
178+
if (const auto *component{x.GetComponent()}) {
175179
Show(*component);
176-
else if (const auto *symbol{x.GetSymbol()})
180+
} else if (const auto *symbol{x.GetSymbol()}) {
177181
Show(*symbol);
178-
else
182+
} else {
179183
Show(DEREF(x.GetSpecificIntrinsic()));
184+
}
180185
Outdent();
181186
}
182187

@@ -200,8 +205,9 @@ void DumpEvaluateExpr::Indent(llvm::StringRef s) {
200205
}
201206

202207
void DumpEvaluateExpr::Outdent() {
203-
if (level_)
208+
if (level_) {
204209
level_--;
210+
}
205211
Print("}");
206212
}
207213

0 commit comments

Comments
 (0)