Skip to content

Commit

Permalink
[clang-format] Elide unnecessary braces. NFC.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurdej committed Feb 2, 2022
1 parent b3af2ef commit 630c736
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
6 changes: 2 additions & 4 deletions clang/lib/Format/ContinuationIndenter.cpp
Expand Up @@ -197,12 +197,10 @@ RawStringFormatStyleManager::RawStringFormatStyleManager(
LanguageStyle = PredefinedStyle;
}
LanguageStyle->ColumnLimit = CodeStyle.ColumnLimit;
for (StringRef Delimiter : RawStringFormat.Delimiters) {
for (StringRef Delimiter : RawStringFormat.Delimiters)
DelimiterStyle.insert({Delimiter, *LanguageStyle});
}
for (StringRef EnclosingFunction : RawStringFormat.EnclosingFunctions) {
for (StringRef EnclosingFunction : RawStringFormat.EnclosingFunctions)
EnclosingFunctionStyle.insert({EnclosingFunction, *LanguageStyle});
}
}
}

Expand Down
9 changes: 3 additions & 6 deletions clang/lib/Format/Format.cpp
Expand Up @@ -2092,9 +2092,8 @@ class Cleaner : public TokenAnalyzer {

private:
void cleanupLine(AnnotatedLine *Line) {
for (auto *Child : Line->Children) {
for (auto *Child : Line->Children)
cleanupLine(Child);
}

if (Line->Affected) {
cleanupRight(Line->First, tok::comma, tok::comma);
Expand All @@ -2120,9 +2119,8 @@ class Cleaner : public TokenAnalyzer {
std::set<unsigned> DeletedLines;
for (unsigned i = 0, e = AnnotatedLines.size(); i != e; ++i) {
auto &Line = *AnnotatedLines[i];
if (Line.startsWithNamespace()) {
if (Line.startsWithNamespace())
checkEmptyNamespace(AnnotatedLines, i, i, DeletedLines);
}
}

for (auto Line : DeletedLines) {
Expand Down Expand Up @@ -2184,9 +2182,8 @@ class Cleaner : public TokenAnalyzer {
AnnotatedLines[CurrentLine]->Last->Tok.getEndLoc())))
return false;

for (unsigned i = InitLine; i <= CurrentLine; ++i) {
for (unsigned i = InitLine; i <= CurrentLine; ++i)
DeletedLines.insert(i);
}

return true;
}
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Format/MacroExpander.cpp
Expand Up @@ -125,9 +125,8 @@ MacroExpander::MacroExpander(
IdentifierTable &IdentTable)
: SourceMgr(SourceMgr), Style(Style), Allocator(Allocator),
IdentTable(IdentTable) {
for (const std::string &Macro : Macros) {
for (const std::string &Macro : Macros)
parseDefinition(Macro);
}
}

MacroExpander::~MacroExpander() = default;
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Format/TokenAnnotator.cpp
Expand Up @@ -1388,9 +1388,8 @@ class AnnotatingParser {
}

for (const auto &ctx : Contexts) {
if (ctx.InStructArrayInitializer) {
if (ctx.InStructArrayInitializer)
return LT_ArrayOfStructInitializer;
}
}

return LT_Other;
Expand Down

0 comments on commit 630c736

Please sign in to comment.