@@ -358,9 +358,10 @@ static void outputXML(const Replacements &Replaces,
358
358
if (!Status.FormatComplete )
359
359
outs () << " line='" << Status.Line << " '" ;
360
360
outs () << " >\n " ;
361
- if (Cursor.getNumOccurrences () != 0 )
361
+ if (Cursor.getNumOccurrences () != 0 ) {
362
362
outs () << " <cursor>" << FormatChanges.getShiftedCodePosition (CursorPosition)
363
363
<< " </cursor>\n " ;
364
+ }
364
365
365
366
outputReplacementsXML (Replaces);
366
367
outs () << " </replacements>\n " ;
@@ -436,11 +437,11 @@ static bool format(StringRef FileName) {
436
437
.Case (" left" , FormatStyle::QAS_Left)
437
438
.Default (FormatStyle->QualifierAlignment );
438
439
439
- if (FormatStyle->QualifierAlignment == FormatStyle::QAS_Left)
440
+ if (FormatStyle->QualifierAlignment == FormatStyle::QAS_Left) {
440
441
FormatStyle->QualifierOrder = {" const" , " volatile" , " type" };
441
- else if (FormatStyle->QualifierAlignment == FormatStyle::QAS_Right)
442
+ } else if (FormatStyle->QualifierAlignment == FormatStyle::QAS_Right) {
442
443
FormatStyle->QualifierOrder = {" type" , " const" , " volatile" };
443
- else if (QualifierAlignmentOrder.contains (" type" )) {
444
+ } else if (QualifierAlignmentOrder.contains (" type" )) {
444
445
FormatStyle->QualifierAlignment = FormatStyle::QAS_Custom;
445
446
SmallVector<StringRef> Qualifiers;
446
447
QualifierAlignmentOrder.split (Qualifiers, " " , /* MaxSplit=*/ -1 ,
@@ -463,9 +464,8 @@ static bool format(StringRef FileName) {
463
464
if (FormatStyle->isJson () && !FormatStyle->DisableFormat ) {
464
465
auto Err = Replaces.add (tooling::Replacement (
465
466
tooling::Replacement (AssumedFileName, 0 , 0 , " x = " )));
466
- if (Err) {
467
+ if (Err)
467
468
llvm::errs () << " Bad Json variable insertion\n " ;
468
- }
469
469
}
470
470
471
471
auto ChangedCode = tooling::applyAllReplacements (Code->getBuffer (), Replaces);
@@ -480,11 +480,10 @@ static bool format(StringRef FileName) {
480
480
reformat (*FormatStyle, *ChangedCode, Ranges, AssumedFileName, &Status);
481
481
Replaces = Replaces.merge (FormatChanges);
482
482
if (OutputXML || DryRun) {
483
- if (DryRun) {
483
+ if (DryRun)
484
484
return emitReplacementWarnings (Replaces, AssumedFileName, Code);
485
- } else {
485
+ else
486
486
outputXML (Replaces, FormatChanges, Status, Cursor, CursorPosition);
487
- }
488
487
} else {
489
488
IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem (
490
489
new llvm::vfs::InMemoryFileSystem);
@@ -579,9 +578,8 @@ int main(int argc, const char **argv) {
579
578
return 0 ;
580
579
}
581
580
582
- if (DumpConfig) {
581
+ if (DumpConfig)
583
582
return dumpConfig ();
584
- }
585
583
586
584
if (!Files.empty ()) {
587
585
std::ifstream ExternalFileOfFiles{std::string (Files)};
@@ -608,9 +606,10 @@ int main(int argc, const char **argv) {
608
606
609
607
unsigned FileNo = 1 ;
610
608
for (const auto &FileName : FileNames) {
611
- if (Verbose)
609
+ if (Verbose) {
612
610
errs () << " Formatting [" << FileNo++ << " /" << FileNames.size () << " ] "
613
611
<< FileName << " \n " ;
612
+ }
614
613
Error |= clang::format::format (FileName);
615
614
}
616
615
return Error ? 1 : 0 ;
0 commit comments