Skip to content

Commit abacf7e

Browse files
Merge pull request #2243 from practicalswift/gardening-20160419
[gardening] Typos, PEP-8 and unused code.
2 parents 3844327 + 092007b commit abacf7e

File tree

8 files changed

+30
-26
lines changed

8 files changed

+30
-26
lines changed

lib/IRGen/GenExistential.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ class ErrorExistentialTypeInfo : public HeapTypeInfo<ErrorExistentialTypeInfo>
12671267
Refcounting(refcounting) {}
12681268

12691269
ReferenceCounting getReferenceCounting() const {
1270-
// ErrorProtocol uses its own rc entry points.
1270+
// ErrorProtocol uses its own RC entry points.
12711271
return Refcounting;
12721272
}
12731273

lib/SILOptimizer/ARC/RCStateTransition.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ConsumedArgToEpilogueReleaseMatcher;
3333

3434
namespace swift {
3535

36-
/// The kind of a RCStateTransition.
36+
/// The kind of an RCStateTransition.
3737
enum class RCStateTransitionKind : uint8_t {
3838
#define KIND(K) K,
3939
#define ABSTRACT_VALUE(Name, StartKind, EndKind) \

lib/SILOptimizer/Transforms/RetainReleaseCodeMotion.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
///
2323
/// This pass is more sophisticated than SILCodeMotion, as arc optimizations
2424
/// can be very beneficial, use an optimistic global data flow to achieve
25-
/// optimiality.
25+
/// optimality.
2626
///
2727
/// Proof of Correctness:
2828
/// -------------------
@@ -180,7 +180,7 @@ struct BlockState {
180180

181181
/// CodeMotionContext - This is the base class which retain code motion and
182182
/// release code motion inherits from. It defines an interface as to how the
183-
/// code motion precedure should be.
183+
/// code motion procedure should be.
184184
class CodeMotionContext {
185185
protected:
186186
/// Dataflow needs multiple iteration to converge. If this is false, then we
@@ -206,8 +206,8 @@ class CodeMotionContext {
206206
/// All the unique refcount roots retained or released in the function.
207207
llvm::SetVector<SILValue> RCRootVault;
208208

209-
/// Contains a map between rc roots to their index in the RCRootVault.
210-
/// used to facilitate fast rc roots to index lookup.
209+
/// Contains a map between RC roots to their index in the RCRootVault.
210+
/// used to facilitate fast RC roots to index lookup.
211211
llvm::DenseMap<SILValue, unsigned> RCRootIndex;
212212

213213
/// All the retains or releases originally in the function. Eventually
@@ -218,7 +218,7 @@ class CodeMotionContext {
218218
using InsertPointList = llvm::SmallVector<SILInstruction *, 2>;
219219
llvm::SmallDenseMap<SILValue, InsertPointList> InsertPoints;
220220

221-
/// These are the blocks that have a RC instruction to process or it blocks
221+
/// These are the blocks that have an RC instruction to process or it blocks
222222
/// some RC instructions. If the basic block has neither, we do not need to
223223
/// process the block again in the last iteration. We populate this set when
224224
/// we compute the genset and killset.
@@ -236,7 +236,7 @@ class CodeMotionContext {
236236
return RCCache[R] = RCFI->getRCIdentityRoot(R);
237237
}
238238

239-
/// Return the rc-identity root of the rc instruction, i.e.
239+
/// Return the rc-identity root of the RC instruction, i.e.
240240
/// retain or release.
241241
SILValue getRCRoot(SILInstruction *I) {
242242
assert(isRetainInstruction(I) || isReleaseInstruction(I) &&
@@ -257,7 +257,7 @@ class CodeMotionContext {
257257
/// Run the data flow to move retains and releases.
258258
bool run();
259259

260-
/// Check whether we need to run an optimitic iteration data flow.
260+
/// Check whether we need to run an optimistic iteration data flow.
261261
/// or a pessimistic would suffice.
262262
virtual bool requireIteration() = 0;
263263

@@ -349,7 +349,7 @@ class RetainCodeMotionContext : public CodeMotionContext {
349349
// These terminator instructions block.
350350
if (isa<ReturnInst>(II) || isa<ThrowInst>(II) || isa<UnreachableInst>(II))
351351
return true;
352-
// Identical rc root blocks code motion, we will be able to move this retain
352+
// Identical RC root blocks code motion, we will be able to move this retain
353353
// further once we move the blocking retain.
354354
if (isRetainInstruction(II) && getRCRoot(II) == Ptr)
355355
return true;
@@ -457,7 +457,7 @@ void RetainCodeMotionContext::initializeCodeMotionBBMaxSet() {
457457
}
458458

459459
// Process the instructions in the basic block to find what refcounted
460-
// roots are retained. If we know that a rc root cant be retained at a
460+
// roots are retained. If we know that an RC root cant be retained at a
461461
// basic block, then we know we do not need to consider it for the killset.
462462
// NOTE: this is a conservative approximation, because some retains may be
463463
// blocked before it reaches this block.
@@ -493,7 +493,8 @@ void RetainCodeMotionContext::computeCodeMotionGenKillSet() {
493493
}
494494
}
495495

496-
// Is this a block thats interesting to the last iteration of the data flow.
496+
// Is this a block that is interesting to the last iteration of the data
497+
// flow.
497498
if (!InterestBlock)
498499
continue;
499500
InterestBlocks.insert(BB);
@@ -657,7 +658,7 @@ class ReleaseBlockState : public BlockState {
657658
}
658659
};
659660

660-
/// ReleaseCodeMotionContext - Context to peroform release code motion.
661+
/// ReleaseCodeMotionContext - Context to perform release code motion.
661662
class ReleaseCodeMotionContext : public CodeMotionContext {
662663
/// All the release block state for all the basic blocks in the function.
663664
llvm::SmallDenseMap<SILBasicBlock *, ReleaseBlockState *> BlockStates;
@@ -677,7 +678,7 @@ class ReleaseCodeMotionContext : public CodeMotionContext {
677678
// released value.
678679
if (II == Ptr)
679680
return true;
680-
// Identical rc root blocks code motion, we will be able to move this release
681+
// Identical RC root blocks code motion, we will be able to move this release
681682
// further once we move the blocking release.
682683
if (isReleaseInstruction(II) && getRCRoot(II) == Ptr)
683684
return true;
@@ -795,7 +796,7 @@ void ReleaseCodeMotionContext::initializeCodeMotionBBMaxSet() {
795796
}
796797

797798
// Process the instructions in the basic block to find what refcounted
798-
// roots are released. If we know that a rc root cant be released at a
799+
// roots are released. If we know that an RC root cant be released at a
799800
// basic block, then we know we do not need to consider it for the killset.
800801
// NOTE: this is a conservative approximation, because some releases may be
801802
// blocked before it reaches this block.
@@ -816,7 +817,7 @@ void ReleaseCodeMotionContext::computeCodeMotionGenKillSet() {
816817
for (unsigned i = 0; i < RCRootVault.size(); ++i) {
817818
if (!State->BBMaxSet.test(i) || !mayBlockCodeMotion(&*I, RCRootVault[i]))
818819
continue;
819-
// This instruction blocks this rc root.
820+
// This instruction blocks this RC root.
820821
InterestBlock = true;
821822
State->BBKillSet.set(i);
822823
State->BBGenSet.reset(i);
@@ -932,7 +933,7 @@ void ReleaseCodeMotionContext::convergeCodeMotionDataFlow() {
932933

933934
void ReleaseCodeMotionContext::computeCodeMotionInsertPoints() {
934935
// The BBSetIns have converged, run last iteration and figure out insertion
935-
// point for each rc root.
936+
// point for each RC root.
936937
for (SILBasicBlock *BB : PO->getPostOrder()) {
937938
// Intersect in the successor BBSetIns.
938939
mergeBBDataFlowStates(BB);
@@ -958,7 +959,7 @@ void ReleaseCodeMotionContext::computeCodeMotionInsertPoints() {
958959
continue;
959960

960961
// Compute insertion point generated by MayUse terminator inst.
961-
// If terminator instruction can block the rc root. We will have no
962+
// If terminator instruction can block the RC root. We will have no
962963
// choice but to anchor the release instructions in the successor blocks.
963964
for (unsigned i = 0; i < RCRootVault.size(); ++i) {
964965
SILInstruction *Term = BB->getTerminator();

lib/Sema/ConstraintLocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ class ConstraintLocatorBuilder {
606606
/// Attempt to simplify this locator to a single expression.
607607
Expr *trySimplifyToExpr() const;
608608

609-
/// Retrive the last element in the path, if there is one.
609+
/// Retrieve the last element in the path, if there is one.
610610
Optional<LocatorPathElt> last() const {
611611
// If we stored a path element here, grab it.
612612
if (element) return *element;

lib/Sema/ConstraintSystem.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ Type ConstraintSystem::replaceSelfTypeInArchetype(ArchetypeType *archetype) {
10401040
}
10411041

10421042
/// Determine whether the given locator is for a witness or requirement.
1043-
static bool isRequirementOrWitnesss(const ConstraintLocatorBuilder &locator) {
1043+
static bool isRequirementOrWitness(const ConstraintLocatorBuilder &locator) {
10441044
if (auto last = locator.last()) {
10451045
return last->getKind() == ConstraintLocator::Requirement ||
10461046
last->getKind() == ConstraintLocator::Witness;
@@ -1247,7 +1247,7 @@ ConstraintSystem::getTypeOfMemberReference(
12471247
// optional/dynamic, is settable, or is not.
12481248
auto fnType = openedFnType->getResult()->castTo<FunctionType>();
12491249
auto elementTy = fnType->getResult();
1250-
if (!isRequirementOrWitnesss(locator)) {
1250+
if (!isRequirementOrWitness(locator)) {
12511251
if (subscript->getAttrs().hasAttribute<OptionalAttr>())
12521252
elementTy = OptionalType::get(elementTy->getRValueType());
12531253
else if (isDynamicResult) {
@@ -1387,7 +1387,7 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
13871387
choice.isSpecialized(), locator);
13881388
}
13891389

1390-
if (!isRequirementOrWitnesss(locator) &&
1390+
if (!isRequirementOrWitness(locator) &&
13911391
choice.getDecl()->getAttrs().hasAttribute<OptionalAttr>() &&
13921392
!isa<SubscriptDecl>(choice.getDecl())) {
13931393
// For a non-subscript declaration that is an optional

test/Prototypes/CollectionsMoveIndices.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@
330330
// current collections model), then an additional design is possible
331331
// -- let's call it (2)(c) for the purpose of discussion. This design
332332
// would be like (2)(b), but won't require extra storage that is used
333-
// only for safety checks. Instead, every index would pay a RC
333+
// only for safety checks. Instead, every index would pay an RC
334334
// penalty and carry a strong reference to the tree node.
335335
//
336336
// Note that (2)(c) is still technically possible to implement in the

utils/build-script

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ import swift_build_support.ninja # noqa (E402)
4747
import swift_build_support.tar # noqa (E402)
4848
import swift_build_support.targets # noqa (E402)
4949

50+
5051
# A strict parser for bools (unlike Python's `bool()`, where
5152
# `bool('False')` is `True`).
5253
#
53-
# This function can be pased as `type=` argument to argparse to parse values
54+
# This function can be passed as `type=` argument to argparse to parse values
5455
# passed to command line arguments.
5556
def argparse_bool(string):
5657
if string in ['0', 'false', 'False']:

utils/swift-api-dump.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,16 @@ def collect_frameworks(sdk):
203203
(exitcode, sdk_path, err) = run_command(
204204
["xcrun", "--show-sdk-path", "-sdk", sdk])
205205
if exitcode != 0:
206-
print('error: framework collection failed to find SDK path for %s with error %d' % (sdk, exitcode))
206+
print('error: framework collection failed to find SDK path for %s '
207+
'with error %d' % (sdk, exitcode))
207208
return ()
208209
sdk_path = sdk_path.rstrip()
209210

210211
(exitcode, sdk_version, err) = run_command(
211212
["xcrun", "--show-sdk-version", "-sdk", sdk])
212213
if exitcode != 0:
213-
print('error: framework collection failed to find SDK version for %s with error %d' % (sdk, exitcode))
214+
print('error: framework collection failed to find SDK version for %s '
215+
'with error %d' % (sdk, exitcode))
214216
return ()
215217
sdk_version = sdk_version.rstrip()
216218

0 commit comments

Comments
 (0)