Skip to content

Commit 2d82c9c

Browse files
committed
[clang-format][NFC] Fix braces in ClangFormat.cpp
Differential Revision: https://reviews.llvm.org/D127827
1 parent b10579d commit 2d82c9c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

clang/tools/clang-format/ClangFormat.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,10 @@ static void outputXML(const Replacements &Replaces,
358358
if (!Status.FormatComplete)
359359
outs() << " line='" << Status.Line << "'";
360360
outs() << ">\n";
361-
if (Cursor.getNumOccurrences() != 0)
361+
if (Cursor.getNumOccurrences() != 0) {
362362
outs() << "<cursor>" << FormatChanges.getShiftedCodePosition(CursorPosition)
363363
<< "</cursor>\n";
364+
}
364365

365366
outputReplacementsXML(Replaces);
366367
outs() << "</replacements>\n";
@@ -436,11 +437,11 @@ static bool format(StringRef FileName) {
436437
.Case("left", FormatStyle::QAS_Left)
437438
.Default(FormatStyle->QualifierAlignment);
438439

439-
if (FormatStyle->QualifierAlignment == FormatStyle::QAS_Left)
440+
if (FormatStyle->QualifierAlignment == FormatStyle::QAS_Left) {
440441
FormatStyle->QualifierOrder = {"const", "volatile", "type"};
441-
else if (FormatStyle->QualifierAlignment == FormatStyle::QAS_Right)
442+
} else if (FormatStyle->QualifierAlignment == FormatStyle::QAS_Right) {
442443
FormatStyle->QualifierOrder = {"type", "const", "volatile"};
443-
else if (QualifierAlignmentOrder.contains("type")) {
444+
} else if (QualifierAlignmentOrder.contains("type")) {
444445
FormatStyle->QualifierAlignment = FormatStyle::QAS_Custom;
445446
SmallVector<StringRef> Qualifiers;
446447
QualifierAlignmentOrder.split(Qualifiers, " ", /*MaxSplit=*/-1,
@@ -463,9 +464,8 @@ static bool format(StringRef FileName) {
463464
if (FormatStyle->isJson() && !FormatStyle->DisableFormat) {
464465
auto Err = Replaces.add(tooling::Replacement(
465466
tooling::Replacement(AssumedFileName, 0, 0, "x = ")));
466-
if (Err) {
467+
if (Err)
467468
llvm::errs() << "Bad Json variable insertion\n";
468-
}
469469
}
470470

471471
auto ChangedCode = tooling::applyAllReplacements(Code->getBuffer(), Replaces);
@@ -480,11 +480,10 @@ static bool format(StringRef FileName) {
480480
reformat(*FormatStyle, *ChangedCode, Ranges, AssumedFileName, &Status);
481481
Replaces = Replaces.merge(FormatChanges);
482482
if (OutputXML || DryRun) {
483-
if (DryRun) {
483+
if (DryRun)
484484
return emitReplacementWarnings(Replaces, AssumedFileName, Code);
485-
} else {
485+
else
486486
outputXML(Replaces, FormatChanges, Status, Cursor, CursorPosition);
487-
}
488487
} else {
489488
IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
490489
new llvm::vfs::InMemoryFileSystem);
@@ -579,9 +578,8 @@ int main(int argc, const char **argv) {
579578
return 0;
580579
}
581580

582-
if (DumpConfig) {
581+
if (DumpConfig)
583582
return dumpConfig();
584-
}
585583

586584
if (!Files.empty()) {
587585
std::ifstream ExternalFileOfFiles{std::string(Files)};
@@ -608,9 +606,10 @@ int main(int argc, const char **argv) {
608606

609607
unsigned FileNo = 1;
610608
for (const auto &FileName : FileNames) {
611-
if (Verbose)
609+
if (Verbose) {
612610
errs() << "Formatting [" << FileNo++ << "/" << FileNames.size() << "] "
613611
<< FileName << "\n";
612+
}
614613
Error |= clang::format::format(FileName);
615614
}
616615
return Error ? 1 : 0;

0 commit comments

Comments
 (0)