Skip to content

Commit 7dd61bd

Browse files
committed
[gardening] Put white spaces in between if/while clauses and braces where it is missing.
For instance: 'if (foo){' => 'if (foo) {'
1 parent 90f0744 commit 7dd61bd

13 files changed

+16
-16
lines changed

Diff for: docs/toc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
// Listen to the load event for the document.
7-
if (window.addEventListener){
7+
if (window.addEventListener) {
88
window.addEventListener('load', onload_handler, false);
99
} else if (window.attachEvent) {
1010
window.attachEvent('onload', onload_handler);

Diff for: include/swift/AST/AvailabilitySpec.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class VersionConstraintAvailabilitySpec : public AvailabilitySpec {
9292

9393
void *
9494
operator new(size_t Bytes, ASTContext &C,
95-
unsigned Alignment = alignof(VersionConstraintAvailabilitySpec)){
95+
unsigned Alignment = alignof(VersionConstraintAvailabilitySpec)) {
9696
return AvailabilitySpec::operator new(Bytes, C, Alignment);
9797
}
9898
};

Diff for: lib/SILOptimizer/LoopTransforms/ArrayBoundsCheckOpts.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ static bool hoistBoundsChecks(SILLoop *Loop, DominanceInfo *DT, SILLoopInfo *LI,
11151115
// Find canonical induction variables.
11161116
InductionAnalysis IndVars(DT, IVs, Preheader, Header, ExitingBlk, ExitBlk);
11171117
bool IVarsFound = IndVars.analyse();
1118-
if (!IVarsFound){
1118+
if (!IVarsFound) {
11191119
DEBUG(llvm::dbgs() << "No induction variables found\n");
11201120
}
11211121

Diff for: lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ bool DIMemoryUse::
311311
onlyTouchesTrivialElements(const DIMemoryObjectInfo &MI) const {
312312
auto &Module = Inst->getModule();
313313

314-
for (unsigned i = FirstElement, e = i+NumElements; i != e; ++i){
314+
for (unsigned i = FirstElement, e = i+NumElements; i != e; ++i) {
315315
// Skip 'super.init' bit
316316
if (i == MI.getNumMemoryElements())
317317
return false;

Diff for: lib/SILOptimizer/Mandatory/DataflowDiagnostics.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static void diagnoseMissingReturn(const UnreachableInst *UI,
6464

6565
static void diagnoseUnreachable(const SILInstruction *I,
6666
ASTContext &Context) {
67-
if (auto *UI = dyn_cast<UnreachableInst>(I)){
67+
if (auto *UI = dyn_cast<UnreachableInst>(I)) {
6868
SILLocation L = UI->getLoc();
6969

7070
// Invalid location means that the instruction has been generated by SIL

Diff for: lib/SILOptimizer/Mandatory/DiagnoseUnreachable.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ static bool simplifyBlocksWithCallsToNoReturn(SILBasicBlock &BB,
530530

531531
// Record the diagnostic info.
532532
if (!DiagnosedUnreachableCode &&
533-
NoReturnCall->getLoc().is<RegularLocation>() && State){
533+
NoReturnCall->getLoc().is<RegularLocation>() && State) {
534534
for (auto SI = BB.succ_begin(), SE = BB.succ_end(); SI != SE; ++SI) {
535535
SILBasicBlock *UnreachableBlock = *SI;
536536
if (!State->PossiblyUnreachableBlocks.count(UnreachableBlock)) {

Diff for: lib/SILOptimizer/SILCombiner/SILCombinerApplyVisitors.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ getConformanceAndConcreteType(FullApplySite AI,
748748
Conformances = IER->getConformances();
749749
ConcreteType = IER->getFormalConcreteType();
750750
NewSelf = IER->getOperand();
751-
} else if (auto IEM = dyn_cast<InitExistentialMetatypeInst>(InitExistential)){
751+
} else if (auto IEM = dyn_cast<InitExistentialMetatypeInst>(InitExistential)) {
752752
Conformances = IEM->getConformances();
753753
NewSelf = IEM->getOperand();
754754
ConcreteType = NewSelf->getType().getSwiftRValueType();

Diff for: lib/SILOptimizer/Transforms/AllocBoxToStack.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static SILInstruction* findUnexpectedBoxUse(SILValue Box,
371371

372372
/// canPromoteAllocBox - Can we promote this alloc_box to an alloc_stack?
373373
static bool canPromoteAllocBox(AllocBoxInst *ABI,
374-
llvm::SmallVectorImpl<Operand *> &PromotedOperands){
374+
llvm::SmallVectorImpl<Operand *> &PromotedOperands) {
375375
// Scan all of the uses of the address of the box to see if any
376376
// disqualifies the box from being promoted to the stack.
377377
if (auto *User = findUnexpectedBoxUse(ABI,

Diff for: lib/Sema/CSApply.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -2324,7 +2324,7 @@ namespace {
23242324
case OverloadChoiceKind::DeclViaBridge: {
23252325
// Look through an implicitly unwrapped optional.
23262326
auto baseTy = base->getType()->getRValueType();
2327-
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)){
2327+
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)) {
23282328
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy,
23292329
cs.getConstraintLocator(base));
23302330

@@ -2370,7 +2370,7 @@ namespace {
23702370

23712371
case OverloadChoiceKind::TupleIndex: {
23722372
auto baseTy = base->getType()->getRValueType();
2373-
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)){
2373+
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)) {
23742374
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy,
23752375
cs.getConstraintLocator(base));
23762376
}
@@ -4658,7 +4658,7 @@ maybeDiagnoseUnsupportedFunctionConversion(TypeChecker &tc, Expr *expr,
46584658
// capture context. Look through ignored bases too.
46594659
// TODO: Look through static method applications to the type.
46604660
auto semanticExpr = expr->getSemanticsProvidingExpr();
4661-
while (auto ignoredBase = dyn_cast<DotSyntaxBaseIgnoredExpr>(semanticExpr)){
4661+
while (auto ignoredBase = dyn_cast<DotSyntaxBaseIgnoredExpr>(semanticExpr)) {
46624662
semanticExpr = ignoredBase->getRHS()->getSemanticsProvidingExpr();
46634663
}
46644664

Diff for: lib/Sema/CSGen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ namespace {
16141614
Type visitUnresolvedDotExpr(UnresolvedDotExpr *expr) {
16151615
// Open a member constraint for constructor delegations on the
16161616
// subexpr type.
1617-
if (CS.TC.getSelfForInitDelegationInConstructor(CS.DC, expr)){
1617+
if (CS.TC.getSelfForInitDelegationInConstructor(CS.DC, expr)) {
16181618
auto baseTy = expr->getBase()->getType()
16191619
->getLValueOrInOutObjectType();
16201620

Diff for: lib/Sema/MiscDiagnostics.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ static void diagSyntacticUseRestrictions(TypeChecker &TC, const Expr *E,
507507
return;
508508

509509
if (auto *parentExpr = Parent.getAsExpr()) {
510-
if (auto *ignoredBase = dyn_cast<DotSyntaxBaseIgnoredExpr>(parentExpr)){
510+
if (auto *ignoredBase = dyn_cast<DotSyntaxBaseIgnoredExpr>(parentExpr)) {
511511
if (!ignoredBase->isImplicit())
512512
return;
513513
}
@@ -2091,7 +2091,7 @@ class ObjCSelectorWalker : public ASTWalker {
20912091
if (auto ctorRefCall =
20922092
dyn_cast<ConstructorRefCallExpr>(argCall->getFn())) {
20932093
if (auto argCtor =
2094-
dyn_cast_or_null<ConstructorDecl>(ctorRefCall->getCalledValue())){
2094+
dyn_cast_or_null<ConstructorDecl>(ctorRefCall->getCalledValue())) {
20952095
auto argArgumentNames = argCtor->getFullName().getArgumentNames();
20962096
if (argArgumentNames.size() == 3 &&
20972097
argArgumentNames[0] == TC.Context.Id_builtinStringLiteral)

Diff for: lib/Sema/PlaygroundTransform.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ class Instrumenter {
762762
if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(*RE)) {
763763
VarDecl *VD = cast<VarDecl>(DRE->getDecl());
764764

765-
if (isa<ConstructorDecl>(TypeCheckDC) && VD->getNameStr().equals("self")){
765+
if (isa<ConstructorDecl>(TypeCheckDC) && VD->getNameStr().equals("self")) {
766766
// Don't log "self" in a constructor
767767
return nullptr;
768768
}

Diff for: lib/Sema/TypeCheckConstraints.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2708,7 +2708,7 @@ CheckedCastKind TypeChecker::typeCheckCheckedCast(Type fromType,
27082708
}
27092709

27102710
// If we can bridge through an Objective-C class, do so.
2711-
if (Type objCClass = getDynamicBridgedThroughObjCClass(dc, fromType, toType)){
2711+
if (Type objCClass = getDynamicBridgedThroughObjCClass(dc, fromType, toType)) {
27122712
if (isSubtypeOf(objCClass, fromType, dc))
27132713
return CheckedCastKind::BridgeFromObjectiveC;
27142714
}

0 commit comments

Comments
 (0)