Skip to content

Commit 3d488f6

Browse files
authored
Spelling clangimporter (#42464)
* spelling: enumerators Signed-off-by: Josh Soref <[email protected]> * spelling: handler Signed-off-by: Josh Soref <[email protected]> * spelling: heuristic Signed-off-by: Josh Soref <[email protected]> * spelling: implicitly Signed-off-by: Josh Soref <[email protected]> * spelling: included Signed-off-by: Josh Soref <[email protected]> * spelling: instantiate Signed-off-by: Josh Soref <[email protected]> * spelling: integer Signed-off-by: Josh Soref <[email protected]> * spelling: nested Signed-off-by: Josh Soref <[email protected]> * spelling: otherthing Signed-off-by: Josh Soref <[email protected]> * spelling: overridden Signed-off-by: Josh Soref <[email protected]> * spelling: simultaneously Signed-off-by: Josh Soref <[email protected]> * spelling: special Signed-off-by: Josh Soref <[email protected]> * spelling: typecheck Signed-off-by: Josh Soref <[email protected]> * spelling: unfortunately Signed-off-by: Josh Soref <[email protected]> * spelling: unknown Signed-off-by: Josh Soref <[email protected]> * spelling: version Signed-off-by: Josh Soref <[email protected]> Co-authored-by: Josh Soref <[email protected]>
1 parent 09bcbfd commit 3d488f6

17 files changed

+32
-32
lines changed

include/swift/ClangImporter/CXXMethodBridging.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,67 +8,67 @@
88
#include <string>
99
namespace swift {
1010
struct CXXMethodBridging {
11-
enum class Kind { unkown, getter, setter, subscript };
11+
enum class Kind { unknown, getter, setter, subscript };
1212

13-
enum class NameKind { unkown, snake, lower, camel, title };
13+
enum class NameKind { unknown, snake, lower, camel, title };
1414

1515
CXXMethodBridging(const clang::CXXMethodDecl *method) : method(method) {}
1616

1717
Kind classify() {
1818
if (nameIsBlacklist())
19-
return Kind::unkown;
19+
return Kind::unknown;
2020

2121
// this should be handled as snake case. See: rdar://89453010
2222
// case. In the future we could
2323
// import these too, though.
2424
auto nameKind = classifyNameKind();
2525
if (nameKind != NameKind::title && nameKind != NameKind::camel &&
2626
nameKind != NameKind::lower)
27-
return Kind::unkown;
27+
return Kind::unknown;
2828

2929
if (getClangName().startswith_insensitive("set")) {
3030
// Setters only have one parameter.
3131
if (method->getNumParams() != 1)
32-
return Kind::unkown;
32+
return Kind::unknown;
3333

3434
// rdar://89453106 (We need to handle imported properties that return a
3535
// reference)
3636
if (method->getParamDecl(0)->getType()->isReferenceType())
37-
return Kind::unkown;
37+
return Kind::unknown;
3838

3939
return Kind::setter;
4040
}
4141

4242
// Getters and subscripts cannot return void.
4343
if (method->getReturnType()->isVoidType())
44-
return Kind::unkown;
44+
return Kind::unknown;
4545

4646
if (getClangName().startswith_insensitive("get")) {
4747
// Getters cannot take arguments.
4848
if (method->getNumParams() != 0)
49-
return Kind::unkown;
49+
return Kind::unknown;
5050

5151
// rdar://89453106 (We need to handle imported properties that return a
5252
// reference)
5353
if (method->getReturnType()->isReferenceType())
54-
return Kind::unkown;
54+
return Kind::unknown;
5555

5656
return Kind::getter;
5757
}
5858

5959
// rdar://89453187 (Add subscripts clarification to CXXMethod Bridging to
6060
// clean up importDecl)
61-
return Kind::unkown;
61+
return Kind::unknown;
6262
}
6363

6464
NameKind classifyNameKind() {
6565
bool allLower = llvm::all_of(getClangName(), islower);
6666

6767
if (getClangName().empty())
68-
return NameKind::unkown;
68+
return NameKind::unknown;
6969

7070
if (getClangName().contains('_'))
71-
return allLower ? NameKind::snake : NameKind::unkown;
71+
return allLower ? NameKind::snake : NameKind::unknown;
7272

7373
if (allLower)
7474
return NameKind::lower;

lib/ClangImporter/ClangImporter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4393,7 +4393,7 @@ DeclRefExpr *getInteropStaticCastDeclRefExpr(ASTContext &ctx,
43934393
"Did you forget to define a __swift_interopStaticCast helper function?");
43944394
FuncDecl *staticCastFn = cast<FuncDecl>(results.back());
43954395

4396-
// Now we have to force instanciate this. We can't let the type checker do
4396+
// Now we have to force instantiate this. We can't let the type checker do
43974397
// this yet because it can't infer the "To" type.
43984398
auto subst =
43994399
SubstitutionMap::get(staticCastFn->getGenericSignature(), {derived, base},
@@ -5207,7 +5207,7 @@ clang::FunctionDecl *ClangImporter::instantiateCXXFunctionTemplate(
52075207
return nullptr;
52085208
}
52095209

5210-
// Instanciate a specialization of this template using the substitution map.
5210+
// Instantiate a specialization of this template using the substitution map.
52115211
auto *templateArgList = clang::TemplateArgumentList::CreateCopy(
52125212
func->getASTContext(), templateSubst);
52135213
auto &sema = getClangInstance().getSema();

lib/ClangImporter/ImportDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7379,7 +7379,7 @@ ConstructorDecl *SwiftDeclConverter::importConstructor(
73797379
}
73807380

73817381
void SwiftDeclConverter::recordObjCOverride(AbstractFunctionDecl *decl) {
7382-
// Make sure that we always set the overriden declarations.
7382+
// Make sure that we always set the overridden declarations.
73837383
SWIFT_DEFER {
73847384
if (!decl->overriddenDeclsComputed())
73857385
decl->setOverriddenDecls({ });

lib/ClangImporter/ImportEnumInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ void EnumInfo::determineConstantNamePrefix(const clang::EnumDecl *decl) {
258258
return;
259259
}
260260

261-
// If there are no enumers, there is no prefix to compute.
261+
// If there are no enumerators, there is no prefix to compute.
262262
auto ec = decl->enumerator_begin(), ecEnd = decl->enumerator_end();
263263
if (ec == ecEnd)
264264
return;

lib/ClangImporter/ImportName.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ NameImporter::considerAsyncImport(
12631263
}
12641264

12651265
// Check whether the parameter itself has a name that indicates that
1266-
// it is a completion handelr.
1266+
// it is a completion handler.
12671267
if (isCompletionHandlerParamName(
12681268
params[completionHandlerParamIndex]->getName()))
12691269
break;
@@ -1678,7 +1678,7 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,
16781678
}
16791679
}
16801680

1681-
// Spcial case: unnamed/anonymous fields.
1681+
// Special case: unnamed/anonymous fields.
16821682
if (auto field = dyn_cast<clang::FieldDecl>(D)) {
16831683
static_assert((clang::Decl::lastField - clang::Decl::firstField) == 2,
16841684
"update logic for new FieldDecl subclasses");

lib/ClangImporter/ImportName.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ class NameImporter {
412412
/// If \p action returns false, the current name will \e not be added to the
413413
/// set of seen names.
414414
///
415-
/// The active name for \p activeVerion is always first, followed by the
415+
/// The active name for \p activeVersion is always first, followed by the
416416
/// other names in the order of
417417
/// ImportNameVersion::forEachOtherImportNameVersion.
418418
///

lib/ClangImporter/ImportType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2121,7 +2121,7 @@ ImportedType ClangImporter::Implementation::importFunctionParamsAndReturnType(
21212121
shouldAllowNSUIntegerAsInt(isFromSystemModule, clangDecl);
21222122

21232123
// Only eagerly import the return type if it's not too expensive (the current
2124-
// huristic for that is if it's not a record type).
2124+
// heuristic for that is if it's not a record type).
21252125
ImportedType importedType;
21262126
ImportDiagnosticAdder addDiag(*this, clangDecl,
21272127
clangDecl->getSourceRange().getBegin());

lib/ClangImporter/ImporterImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ struct PlatformAvailability {
316316
bool isPlatformRelevant(StringRef platform) const;
317317

318318
/// Returns true when the given declaration with the given deprecation
319-
/// should be inlucded in the cutoff of imported deprecated APIs marked
319+
/// should be included in the cutoff of imported deprecated APIs marked
320320
/// unavailable.
321321
bool treatDeprecatedAsUnavailable(const clang::Decl *clangDecl,
322322
const llvm::VersionTuple &version,

test/ClangImporter/SceneKit_test.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import SceneKit
77
import Foundation
88

99
// Test out some explicit renames of typedefs and globals, which are now new
10-
// wrapper types with nestest values.
10+
// wrapper types with nested values.
1111
@available(macOS 10.11, *)
1212
func testNestingRenames() {
1313
let _ = SCNGeometrySourceSemantic.self

test/ClangImporter/experimental_diagnostics_cmacros.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ _ = INVALID_ARITHMETIC_1
3434
// CHECK-NEXT: _ = INVALID_ARITHMETIC_1
3535
// CHECK-NEXT: ^~~~~~~~~~~~~~~~~~~~
3636
// CHECK-NEXT: macros.h:{{[0-9]+}}:9: note: macro 'INVALID_ARITHMETIC_1' not imported: structure not supported
37-
// CHECK-NEXT: #define INVALID_ARITHMETIC_1 5 + INVALID_INTERGER_LITERAL_1
37+
// CHECK-NEXT: #define INVALID_ARITHMETIC_1 5 + INVALID_INTEGER_LITERAL_1
3838
// CHECK-NEXT: {{^}} ^
3939

4040
_ = INVALID_ARITHMETIC_2

test/ClangImporter/experimental_eager_diagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ import macros
185185
// CHECK-NEXT: {{^}} ^
186186

187187
// CHECK: macros.h:{{[0-9]+}}:9: note: macro 'INVALID_ARITHMETIC_1' not imported: structure not supported
188-
// CHECK-NEXT: #define INVALID_ARITHMETIC_1 5 + INVALID_INTERGER_LITERAL_1
188+
// CHECK-NEXT: #define INVALID_ARITHMETIC_1 5 + INVALID_INTEGER_LITERAL_1
189189
// CHECK-NEXT: {{^}} ^
190190

191191
// CHECK: macros.h:{{[0-9]+}}:9: note: macro 'INVALID_ARITHMETIC_2' not imported: structure not supported

test/ClangImporter/objc_async_conformance.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ConformsToSync : NSObject, Club {
4343
///////
4444
// selector conflicts
4545

46-
// attempting to satisfy the ObjC async requirement in two ways simultaenously
46+
// attempting to satisfy the ObjC async requirement in two ways simultaneously
4747
// is problematic due to a clash in selector names on this ObjC-compatible type
4848
class SelectorConflict : NSObject, RequiredObserverOnlyCompletion {
4949
func hello() async -> Bool { true } // expected-note {{method 'hello()' declared here}}

test/ClangImporter/objc_direct.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Foo {
2323
}
2424
}
2525

26-
var otherthing = Foo() as AnyObject
26+
var otherThing = Foo() as AnyObject
2727

2828
// We expect no error.
29-
let _ = otherthing.directProtocolMethod()
29+
let _ = otherThing.directProtocolMethod()

test/ClangImporter/pch-bridging-header-vs-modular-interface-defn.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
// ~~~~~~~~~~~~~~
6464
//
6565
// One might hope that this can be fixed by having the merge-modules step take a
66-
// PCH as well as other steps in the compilation. That unfortuantely only
66+
// PCH as well as other steps in the compilation. That unfortunately only
6767
// inverts the problem, which resurfaces in the definition-order of Bar itself:
6868
// an XRef to __ObjC.Bar gets serialized, and then _it_ can't be found during
6969
// merge-modules, because the *last-read* defn of Bar -- the modular one, M.Bar

test/ClangImporter/pch-bridging-header.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
// RUN: llvm-objdump --raw-clang-ast %t/pch3/*.pch | llvm-bcanalyzer -dump | %FileCheck %s -check-prefix=PERSISTENT
4343
// PERSISTENT: ORIGINAL_FILE{{.*}}Inputs/sdk-bridging-header.h
4444

45-
// Test that -pch-disable-validation works in that it won't implicitely create a PCH
45+
// Test that -pch-disable-validation works in that it won't implicitly create a PCH
4646
// RUN: not %target-swift-frontend -typecheck %s -import-objc-header %S/Inputs/sdk-bridging-header.h -pch-output-dir %t/no-pch -pch-disable-validation 2>&1 | %FileCheck %s -check-prefix=NO-VALIDATION
4747
// NO-VALIDATION: PCH file {{.*}} not found
4848

test/Inputs/clang-importer-sdk/usr/include/macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ typedef unsigned okay_t;
169169
#define FUNC_LIKE_MACRO_2(PARAM) PARAM
170170

171171
// Unsupported binary arithmetic
172-
#define INVALID_ARITHMETIC_1 5 + INVALID_INTERGER_LITERAL_1
172+
#define INVALID_ARITHMETIC_1 5 + INVALID_INTEGER_LITERAL_1
173173
#define INVALID_ARITHMETIC_2 INVALID_INTEGER_LITERAL_1 + ADD_TWO
174174
#define INVALID_ARITHMETIC_3 ADD_TWO + INVALID_INTEGER_LITERAL_1
175175
#define INVALID_ARITHMETIC_4 \

unittests/ClangImporter/ClangImporterTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ TEST(ClangImporterTest, emitPCHInMemory) {
7171
swift::LangOptions langOpts;
7272
langOpts.Target = llvm::Triple("x86_64", "apple", "darwin");
7373
swift::SILOptions silOpts;
74-
swift::TypeCheckerOptions typeckOpts;
74+
swift::TypeCheckerOptions typecheckOpts;
7575
INITIALIZE_LLVM();
7676
swift::SearchPathOptions searchPathOpts;
7777
swift::symbolgraphgen::SymbolGraphOptions symbolGraphOpts;
7878
swift::SourceManager sourceMgr;
7979
swift::DiagnosticEngine diags(sourceMgr);
8080
std::unique_ptr<ASTContext> context(
81-
ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts, options,
81+
ASTContext::get(langOpts, typecheckOpts, silOpts, searchPathOpts, options,
8282
symbolGraphOpts, sourceMgr, diags));
8383
auto importer = ClangImporter::create(*context);
8484

0 commit comments

Comments
 (0)