Skip to content

Commit 99ceb78

Browse files
Merge pull request #7723 from practicalswift/gardening-20170223
[gardening] Shell fixes. Consistent headers. a-vs-an typos. Python fixes. Unused variables and methods.
2 parents 20d7126 + 8590e2c commit 99ceb78

32 files changed

+33
-44
lines changed

.pep8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[flake8]
2-
filename = *.py,80+-check,backtrace-check,Benchmark_Driver,Benchmark_DTrace.in,Benchmark_GuardMalloc.in,Benchmark_RuntimeLeaksRunner.in,build-script,check-incremental,clang++,coverage-build-db,coverage-generate-data,coverage-query-db,coverage-touch-tests,gyb,ld,line-directive,mock-distcc,ns-html2rst,PathSanitizingFileCheck,recursive-lipo,rth,run-test,scale-test,submit-benchmark-results,update-checkout,viewcfg,symbolicate-linux-fatal
2+
filename = *.py,80+-check,backtrace-check,Benchmark_Driver,Benchmark_DTrace.in,Benchmark_GuardMalloc.in,Benchmark_RuntimeLeaksRunner.in,build-script,check-incremental,clang++,coverage-build-db,coverage-generate-data,coverage-query-db,coverage-touch-tests,gyb,ld,line-directive,mock-distcc,ns-html2rst,PathSanitizingFileCheck,python-lint,recursive-lipo,round-trip-syntax-test,rth,run-test,scale-test,submit-benchmark-results,update-checkout,viewcfg,symbolicate-linux-fatal

include/swift/AST/GenericSignatureBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ class RequirementSource : public llvm::FoldingSetNode {
264264
GenericSignatureBuilder &builder,
265265
ProtocolDecl *protocol);
266266

267-
/// Retrieve an requirement source for nested type name matches.
267+
/// Retrieve a requirement source for nested type name matches.
268268
static const RequirementSource *forNestedTypeNameMatch(
269269
GenericSignatureBuilder &builder);
270270

include/swift/Basic/OwnedString.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

include/swift/IDE/Utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ class DeclNameViewer {
307307
unsigned commonPartsCount(DeclNameViewer &Other) const;
308308
};
309309

310-
/// This provide a utility for writing to a underlying string buffer multiple
310+
/// This provide a utility for writing to an underlying string buffer mulitiple
311311
/// string pieces and retrieve them later when the underlying buffer is stable.
312312
class DelayedStringRetriever : public raw_ostream {
313313
SmallVectorImpl<char> &OS;

include/swift/Sema/Semantics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- Semantics.h - Swift Container for Semantic Info ----*- C++ -*-===//
1+
//===--- Semantics.h - Swift Container for Semantic Info --------*- C++ -*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

include/swift/Syntax/DeclSyntax.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- DeclSyntax.cpp - Declaration Syntax Interface ----------*- C++ -*-===//
1+
//===--- DeclSyntax.h - Declaration Syntax Interface ------------*- C++ -*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

include/swift/Syntax/ExprSyntax.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- ExprSyntax.h - Swift Expression Syntax Interface --------*- C++ -*-===//
1+
//===--- ExprSyntax.h - Swift Expression Syntax Interface -------*- C++ -*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

include/swift/Syntax/Format.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- Format.cpp - Declaration Syntax Formatting Interface ---*- C++ -*-===//
1+
//===--- Format.h - Declaration Syntax Formatting Interface -----*- C++ -*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

include/swift/Syntax/GenericSyntax.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- GenericSyntax.cpp - Swift Generic Syntax Interface -----*- C++ -*-===//
1+
//===--- GenericSyntax.h - Swift Generic Syntax Interface -------*- C++ -*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

include/swift/Syntax/SyntaxFactory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ struct SyntaxFactory {
353353
/// Make a metatype type with all elements marked as missing.
354354
static MetatypeTypeSyntax makeBlankMetatypeType();
355355

356-
/// Make an sugared Array type, as in `[MyType]`.
356+
/// Make a sugared Array type, as in `[MyType]`.
357357
static ArrayTypeSyntax makeArrayType(RC<TokenSyntax> LeftSquareBracket,
358358
TypeSyntax ElementType,
359359
RC<TokenSyntax> RightSquareBracket);

include/swift/Syntax/SyntaxKinds.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- SyntaxKinds.def - Swift Syntax Node Metaprogramming -------------===//
1+
//===--- SyntaxKinds.def - Swift Syntax Node Metaprogramming --------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,15 +2321,6 @@ class GenericSignatureBuilder::InferRequirementsWalker : public TypeWalker {
23212321
unsigned MinDepth;
23222322
unsigned MaxDepth;
23232323

2324-
/// We cannot add requirements to archetypes from outer generic parameter
2325-
/// lists.
2326-
bool isOuterArchetype(PotentialArchetype *PA) {
2327-
unsigned ParamDepth = PA->getRootGenericParamKey().Depth;
2328-
assert(ParamDepth <= MaxDepth);
2329-
(void) MaxDepth;
2330-
return ParamDepth < MinDepth;
2331-
}
2332-
23332324
public:
23342325
InferRequirementsWalker(GenericSignatureBuilder &builder,
23352326
TypeRepr *typeRepr,

lib/Index/Index.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ bool IndexSwiftASTWalker::startEntityDecl(ValueDecl *D) {
605605
return false;
606606

607607
} else if (auto ParentED = dyn_cast<ExtensionDecl>(Parent)) {
608-
if (NominalTypeDecl *NTD = ParentED->getExtendedType()->getAnyNominal()) {
608+
if (ParentED->getExtendedType()->getAnyNominal()) {
609609
if (addRelation(Info, (SymbolRoleSet) SymbolRole::RelationChildOf, ParentED))
610610
return false;
611611
}

lib/SILGen/SILGenPoly.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ namespace {
10971097
SGF.B.createInitExistentialAddr(Loc, existentialBuf,
10981098
inputTupleType,
10991099
concreteTL.getLoweredType(),
1100-
/*Conformances=*/{});
1100+
/*conformances=*/{});
11011101

11021102
auto tupleTemp = SGF.useBufferAsTemporary(tupleBuf, concreteTL);
11031103
translateAndImplodeInto(inputOrigType, inputTupleType,
@@ -1911,7 +1911,7 @@ ResultPlanner::planTupleIntoIndirectResult(AbstractionPattern innerOrigType,
19111911
SILValue outerConcreteResultAddr
19121912
= Gen.B.createInitExistentialAddr(Loc, outerResultAddr, innerSubstType,
19131913
Gen.getLoweredType(opaque, innerSubstType),
1914-
/*Conformances=*/{});
1914+
/*conformances=*/{});
19151915

19161916
// Emit into that address.
19171917
planTupleIntoIndirectResult(innerOrigType, innerSubstType,

lib/Syntax/DeclSyntax.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- DeclSyntax.cpp - Declaration Syntax Implementation -----*- C++ -*-===//
1+
//===--- DeclSyntax.cpp - Declaration Syntax Implementation ---------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/Syntax/Format.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- Format.cpp - Declaration Syntax Formatting Impl. -------*- C++ -*-===//
1+
//===--- Format.cpp - Declaration Syntax Formatting Impl. -----------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/Syntax/GenericSyntax.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- GenericSyntax.cpp - Swift Generic Syntax Implementation *- C++ -*-===//
1+
//===--- GenericSyntax.cpp - Swift Generic Syntax Implementation ----------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/Syntax/LegacyASTTransformer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- LegacyASTTransformer.cpp - Swift lib/AST -> lib/Syntax -*- C++ -*-===//
1+
//===--- LegacyASTTransformer.cpp - Swift lib/AST -> lib/Syntax -----------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/Syntax/RawSyntax.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- RawSyntax.cpp - Swift Raw Syntax Implementation --------*- C++ -*-===//
1+
//===--- RawSyntax.cpp - Swift Raw Syntax Implementation ------------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/Syntax/StmtSyntax.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- StmtSyntax.cpp - Swift Statement Syntax Implementation -*- C++ -*-===//
1+
//===--- StmtSyntax.cpp - Swift Statement Syntax Implementation -----------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/Syntax/Syntax.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- Syntax.cpp - Swift Syntax Implementation ---------------*- C++ -*-===//
1+
//===--- Syntax.cpp - Swift Syntax Implementation -------------------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/Syntax/SyntaxData.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- SyntaxData.cpp - Swift Syntax Data Implementation ------*- C++ -*-===//
1+
//===--- SyntaxData.cpp - Swift Syntax Data Implementation ----------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/Syntax/SyntaxFactory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- SyntaxFactory.cpp - Swift Syntax Builder Implementation *- C++ -*-===//
1+
//===--- SyntaxFactory.cpp - Swift Syntax Builder Implementation ----------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/Syntax/TokenSyntax.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- TokenSyntax.cpp - Swift Token Syntax Implementation ----*- C++ -*-===//
1+
//===--- TokenSyntax.cpp - Swift Token Syntax Implementation --------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/Syntax/Trivia.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- Syntax.cpp - Swift Syntax Trivia Implementation --------*- C++ -*-===//
1+
//===--- Trivia.cpp - Swift Syntax Trivia Implementation ------------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/Syntax/TypeSyntax.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- TypeSyntax.cpp - Swift Type Syntax Implementation ------*- C++ -*-===//
1+
//===--- TypeSyntax.cpp - Swift Type Syntax Implementation ----------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

stdlib/public/runtime/Metadata.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2819,7 +2819,7 @@ namespace {
28192819
/// The number of bytes remaining.
28202820
size_t Remaining;
28212821
};
2822-
}
2822+
} // end anonymous namespace
28232823

28242824
// A statically-allocated pool. It's zero-initialized, so this
28252825
// doesn't cost us anything in binary size.

tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,8 +724,6 @@ static bool passCursorInfoForDecl(const ValueDecl *VD,
724724

725725
DelayedStringRetriever OverUSRsStream(SS);
726726

727-
SmallVector<std::pair<unsigned, unsigned>, 4> OverUSROffs;
728-
729727
ide::walkOverriddenDecls(VD,
730728
[&](llvm::PointerUnion<const ValueDecl*, const clang::NamedDecl*> D) {
731729
OverUSRsStream.startPiece();

tools/swift-syntax-format/swift-syntax-format.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- swift-syntax-test.cpp - Reflection Syntax testing application ----===//
1+
//===--- swift-syntax-format.cpp - Reflection Syntax testing application --===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

utils/rusage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __call__(self, parser, namespace, v, option_string=None):
9191
args = parser.parse_args()
9292
if len(args.remainder) == 0:
9393
parser.print_help()
94-
exit(1)
94+
sys.exit(1)
9595

9696
if args.enforce:
9797
if args.time is not None:

validation-test/BuildSystem/LTO/object-files-do-have-bitcode.test-sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ set -u
1313
# REQUIRES: OS=macosx
1414
# RUN: %s %swift_obj_root
1515

16-
if [[ -n "$(find $1/lib -iname '*.cpp.o' -type f -exec file {} \; | grep -v -e bitcode -e bit-code)" ]]; then
16+
if find $1/lib -iname '*.cpp.o' -type f -exec file {} \; | grep -q -v -e bitcode -e bit-code; then
1717
echo "Found a ./lib non-bitcode object file!"
1818
exit 1
1919
else
2020
echo "All ./lib object files are bit-code files!"
2121
fi
2222

23-
if [[ -n "$(find $1/unittests -iname '*.cpp.o' -type f -exec file {} \; | grep -v -e bitcode -e bit-code)" ]]; then
23+
if find $1/unittests -iname '*.cpp.o' -type f -exec file {} \; | grep -q -v -e bitcode -e bit-code; then
2424
echo "Found a ./unittests non-bitcode object file!"
2525
exit 1
2626
else

validation-test/BuildSystem/LTO/target-libraries-do-not-have-bitcode.test-sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function check_thin_archive_for_bitcode() {
3434
mkdir -p "${LIB_TEMP_DIR}"
3535
cd "${LIB_TEMP_DIR}"
3636
ar -x ${ARCHIVE}
37-
if [[ -n "$(find ./ -iname '*.o' -exec file {} \; | grep -e bitcode -e bit-code)" ]]; then
37+
if find ./ -iname '*.o' -exec file {} \; | grep -q -v -e bitcode -e bit-code; then
3838
echo "Found bitcode file in thin archive: ${ARCHIVE}"
3939
exit 1
4040
else
@@ -78,7 +78,7 @@ function check_thick_archive_for_bitcode() {
7878
cd ${arch}
7979
ar -x "${LIB_ARCHIVE_DIR}/${THIN_ARCHIVE}"
8080

81-
if [[ -n "$(find ./ -iname '*.o' -exec file {} \; | grep -e bitcode -e bit-code)" ]]; then
81+
if find ./ -iname '*.o' -exec file {} \; | grep -q -e bitcode -e bit-code; then
8282
echo "Found bitcode file in thin archive: ${THIN_ARCHIVE}. Taken from thick archive: ${ARCHIVE}"
8383
exit 1
8484
else

0 commit comments

Comments
 (0)