Skip to content

Commit 16ff6ab

Browse files
authored
Merge pull request #4847 from practicalswift/code-style-ii
2 parents 7e04161 + 8d6251d commit 16ff6ab

File tree

16 files changed

+493
-494
lines changed

16 files changed

+493
-494
lines changed

docs/ContinuousIntegration.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ We describe each in detail below:
3535

3636
Platform | Comment | Check Status
3737
------------ | ------- | ------------
38-
All supported platforms | @swift-ci Please smoke test | Swift Test Linux Platform (smoke test) <br> Swift Test OS X Platform (smoke test)
39-
All supported platforms | @swift-ci Please smoke test and merge | Swift Test Linux Platform (smoke test) <br> Swift Test OS X Platform (smoke test)
38+
All supported platforms | @swift-ci Please smoke test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
39+
All supported platforms | @swift-ci Please smoke test and mere | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
4040
OS X platform | @swift-ci Please smoke test OS X platform | Swift Test OS X Platform (smoke test)
4141
Linux platform | @swift-ci Please smoke test Linux platform | Swift Test Linux Platform (smoke test)
4242

@@ -66,14 +66,14 @@ A smoke test on Linux does the following:
6666

6767
Platform | Comment | Check Status
6868
------------ | ------- | ------------
69-
All supported platforms | @swift-ci Please test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br>Swift Test Linux Platform<br>Swift Test OS X Platform<br>
70-
All supported platforms | @swift-ci Please clean test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br>Swift Test Linux Platform<br>Swift Test OS X Platform<br>
71-
All supported platforms | @swift-ci Please test and merge | Swift Test Linux Platform (smoke test) <br> Swift Test OS X Platform (smoke test)<br> Swift Test Linux Platform <br>Swift Test OS X Platform
72-
OS X platform | @swift-ci Please test OS X platform | Swift Test OS X Platform (smoke test)<br>Swift Test OS X Platform
69+
All supported platforms | @swift-ci Please test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br>Swift Test Linux Platform<br>Swift Test OS X Platform<br>
70+
All supported platforms | @swift-ci Please clean test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br>Swift Test Linux Platform<br>Swift Test OS X Platform<br>
71+
All supported platforms | @swift-ci Please test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br> Swift Test Linux Platform <br>Swift Test OS X Platform
72+
OS X platform | @swift-ci Please test OS X platform | Swift Test OS X Platform (smoke test)<br>Swift Test OS X Platform
7373
OS X platform | @swift-ci Please clean test OS X platform | Swift Test OS X Platform (smoke test)<br>Swift Test OS X Platform
7474
OS X platform | @swift-ci Please benchmark | Swift Benchmark on OS X Platform
75-
Linux platform | @swift-ci Please test Linux platform | Swift Test Linux Platform (smoke test) <br> Swift Test Linux Platform
76-
Linux platform | @swift-ci Please clean test Linux platform | Swift Test Linux Platform (smoke test) <br> Swift Test Linux Platform
75+
Linux platform | @swift-ci Please test Linux platform | Swift Test Linux Platform (smoke test)<br>Swift Test Linux Platform
76+
Linux platform | @swift-ci Please clean test Linux platform | Swift Test Linux Platform (smoke test)<br>Swift Test Linux Platform
7777

7878
The core principles of validation testing is that:
7979

lib/SILGen/RValue.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -560,16 +560,15 @@ RValue RValue::extractElement(unsigned n) && {
560560
assert(isComplete() && "rvalue is not complete");
561561

562562
CanTupleType tupleTy = dyn_cast<TupleType>(type);
563-
if (!tupleTy) {
564-
assert(n == 0);
563+
if (!tupleTy) {
564+
assert(n == 0);
565565
unsigned to = getRValueSize(type);
566-
assert(to == values.size());
567-
RValue element({llvm::makeArrayRef(values).slice(0, to), type});
568-
makeUsed();
569-
return element;
566+
assert(to == values.size());
567+
RValue element({llvm::makeArrayRef(values).slice(0, to), type});
568+
makeUsed();
569+
return element;
570570
}
571571

572-
573572
auto range = getElementRange(tupleTy, n);
574573
unsigned from = range.first, to = range.second;
575574

@@ -583,12 +582,12 @@ void RValue::extractElements(SmallVectorImpl<RValue> &elements) && {
583582
assert(isComplete() && "rvalue is not complete");
584583

585584
CanTupleType tupleTy = dyn_cast<TupleType>(type);
586-
if (!tupleTy) {
585+
if (!tupleTy) {
587586
unsigned to = getRValueSize(type);
588-
assert(to == values.size());
589-
elements.push_back({llvm::makeArrayRef(values).slice(0, to), type});
590-
makeUsed();
591-
return;
587+
assert(to == values.size());
588+
elements.push_back({llvm::makeArrayRef(values).slice(0, to), type});
589+
makeUsed();
590+
return;
592591
}
593592

594593
unsigned from = 0;

lib/SILGen/SILGenApply.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2976,25 +2976,25 @@ namespace {
29762976
if (arg.isRValue()) {
29772977
if (CanTupleType substArgType =
29782978
dyn_cast<TupleType>(arg.getSubstType())) {
2979-
// The original type isn't necessarily a tuple.
2980-
assert(origParamType.matchesTuple(substArgType));
2981-
2982-
auto loc = arg.getKnownRValueLocation();
2983-
SmallVector<RValue, 4> elts;
2984-
std::move(arg).asKnownRValue().extractElements(elts);
2985-
for (auto i : indices(substArgType.getElementTypes())) {
2986-
emit({ loc, std::move(elts[i]) },
2987-
origParamType.getTupleElementType(i));
2988-
}
2989-
return;
2990-
}
2991-
2992-
auto loc = arg.getKnownRValueLocation();
2993-
SmallVector<RValue, 1> elts;
2994-
std::move(arg).asKnownRValue().extractElements(elts);
2995-
emit({ loc, std::move(elts[0]) },
2996-
origParamType.getTupleElementType(0));
2997-
return;
2979+
// The original type isn't necessarily a tuple.
2980+
assert(origParamType.matchesTuple(substArgType));
2981+
2982+
auto loc = arg.getKnownRValueLocation();
2983+
SmallVector<RValue, 4> elts;
2984+
std::move(arg).asKnownRValue().extractElements(elts);
2985+
for (auto i : indices(substArgType.getElementTypes())) {
2986+
emit({ loc, std::move(elts[i]) },
2987+
origParamType.getTupleElementType(i));
2988+
}
2989+
return;
2990+
}
2991+
2992+
auto loc = arg.getKnownRValueLocation();
2993+
SmallVector<RValue, 1> elts;
2994+
std::move(arg).asKnownRValue().extractElements(elts);
2995+
emit({ loc, std::move(elts[0]) },
2996+
origParamType.getTupleElementType(0));
2997+
return;
29982998
}
29992999

30003000
// Otherwise, we're working with an expression.

lib/SILOptimizer/Analysis/EpilogueARCAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ bool EpilogueARCContext::convergeDataflow() {
7272
BBSetOut = EpilogueARCBlockStates[*Iter]->BBSetIn;
7373
Iter = std::next(Iter);
7474
for (auto E = B->succ_end(); Iter != E; ++Iter) {
75-
BBSetOut &= EpilogueARCBlockStates[*Iter]->BBSetIn;
75+
BBSetOut &= EpilogueARCBlockStates[*Iter]->BBSetIn;
7676
}
7777
} else if (isExitBlock(B)) {
7878
// We set the BBSetOut for exit blocks.

lib/SILOptimizer/Utils/Local.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2685,7 +2685,7 @@ bool swift::calleesAreStaticallyKnowable(SILModule &M, SILDeclRef Decl) {
26852685
case Accessibility::Public:
26862686
if (auto ctor = dyn_cast<ConstructorDecl>(AFD)) {
26872687
if (ctor->isRequired())
2688-
return false;
2688+
return false;
26892689
}
26902690
SWIFT_FALLTHROUGH;
26912691
case Accessibility::Internal:

lib/Sema/DerivedConformanceRawRepresentable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static void deriveBodyRawRepresentable_raw(AbstractFunctionDecl *toRawDecl) {
8686

8787
for (auto elt : enumDecl->getAllElements()) {
8888
assert(elt->getTypeCheckedRawValueExpr() &&
89-
"Enum element has no literal - missing a call to checkEnumRawValues()");
89+
"Enum element has no literal - missing a call to checkEnumRawValues()");
9090
assert(elt->getTypeCheckedRawValueExpr()->getType()->isEqual(rawTy));
9191
}
9292

@@ -188,7 +188,7 @@ deriveBodyRawRepresentable_init(AbstractFunctionDecl *initDecl) {
188188

189189
for (auto elt : enumDecl->getAllElements()) {
190190
assert(elt->getTypeCheckedRawValueExpr() &&
191-
"Enum element has no literal - missing a call to checkEnumRawValues()");
191+
"Enum element has no literal - missing a call to checkEnumRawValues()");
192192
assert(elt->getTypeCheckedRawValueExpr()->getType()->isEqual(rawTy));
193193
}
194194

lib/Sema/ITCDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ void IterativeTypeChecker::processInheritedProtocols(
242242
if (inheritedProtocol == protocol ||
243243
inheritedProtocol->inheritsFrom(protocol)) {
244244
if (!diagnosedCircularity &&
245-
!protocol->isInheritedProtocolsValid()) {
245+
!protocol->isInheritedProtocolsValid()) {
246246
diagnose(protocol,
247247
diag::circular_protocol_def, protocol->getName().str())
248248
.fixItRemove(inherited.getSourceRange());

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4019,8 +4019,8 @@ static void diagnoseConformanceFailure(TypeChecker &TC, Type T,
40194019
// Special case: for enums with a raw type, explain that the failing
40204020
// conformance to RawRepresentable was inferred.
40214021
if (auto enumDecl = T->getEnumOrBoundGenericEnum()) {
4022-
if (Proto->isSpecificProtocol(KnownProtocolKind::RawRepresentable) &&
4023-
enumDecl->derivesProtocolConformance(Proto) && enumDecl->hasRawType()) {
4022+
if (Proto->isSpecificProtocol(KnownProtocolKind::RawRepresentable) &&
4023+
enumDecl->derivesProtocolConformance(Proto) && enumDecl->hasRawType()) {
40244024

40254025
TC.diagnose(enumDecl->getInherited()[0].getSourceRange().Start,
40264026
diag::enum_raw_type_nonconforming_and_nonsynthable,

stdlib/public/SDK/Foundation/DataThunks.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ void __NSDataInvokeDeallocatorFree(void *mem, NSUInteger length) {
3838
static int __NSFileProtectionClassForOptions(NSUInteger options) {
3939
int result;
4040
switch (options & NSDataWritingFileProtectionMask) {
41-
case NSDataWritingFileProtectionComplete: // Class A
41+
case NSDataWritingFileProtectionComplete: // Class A
4242
result = 1;
4343
break;
44-
case NSDataWritingFileProtectionCompleteUnlessOpen: // Class B
44+
case NSDataWritingFileProtectionCompleteUnlessOpen: // Class B
4545
result = 2;
4646
break;
47-
case NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication: // Class C
47+
case NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication: // Class C
4848
result = 3;
4949
break;
50-
case NSDataWritingFileProtectionNone: // Class D
50+
case NSDataWritingFileProtectionNone: // Class D
5151
result = 4;
5252
break;
5353
default:

0 commit comments

Comments
 (0)