From 1a217b0c5e41f26f08d99239e99c308f8d9a8914 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:28:01 -0400 Subject: [PATCH 01/16] spelling: enumerators Signed-off-by: Josh Soref --- lib/ClangImporter/ImportEnumInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ClangImporter/ImportEnumInfo.cpp b/lib/ClangImporter/ImportEnumInfo.cpp index 3020eeb99c4d4..ac64cf7ef8e41 100644 --- a/lib/ClangImporter/ImportEnumInfo.cpp +++ b/lib/ClangImporter/ImportEnumInfo.cpp @@ -258,7 +258,7 @@ void EnumInfo::determineConstantNamePrefix(const clang::EnumDecl *decl) { return; } - // If there are no enumers, there is no prefix to compute. + // If there are no enumerators, there is no prefix to compute. auto ec = decl->enumerator_begin(), ecEnd = decl->enumerator_end(); if (ec == ecEnd) return; From 85eeaec387223ff0698763cf95caa477e90fcf9a Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:31:52 -0400 Subject: [PATCH 02/16] spelling: handler Signed-off-by: Josh Soref --- lib/ClangImporter/ImportName.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ClangImporter/ImportName.cpp b/lib/ClangImporter/ImportName.cpp index 8726ac45938fd..55ecc2c94da59 100644 --- a/lib/ClangImporter/ImportName.cpp +++ b/lib/ClangImporter/ImportName.cpp @@ -1263,7 +1263,7 @@ NameImporter::considerAsyncImport( } // Check whether the parameter itself has a name that indicates that - // it is a completion handelr. + // it is a completion handler. if (isCompletionHandlerParamName( params[completionHandlerParamIndex]->getName())) break; From 8f0b17c989b05d75d8de09df450c85509f7a0e39 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:32:01 -0400 Subject: [PATCH 03/16] spelling: heuristic Signed-off-by: Josh Soref --- lib/ClangImporter/ImportType.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index 4c1bb6ec62faf..c60da5e4337cc 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -2121,7 +2121,7 @@ ImportedType ClangImporter::Implementation::importFunctionParamsAndReturnType( shouldAllowNSUIntegerAsInt(isFromSystemModule, clangDecl); // Only eagerly import the return type if it's not too expensive (the current - // huristic for that is if it's not a record type). + // heuristic for that is if it's not a record type). ImportedType importedType; ImportDiagnosticAdder addDiag(*this, clangDecl, clangDecl->getSourceRange().getBegin()); From 6f3cc4b8d6d5bf71b7bd423f3f37ad05083769ca Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:32:49 -0400 Subject: [PATCH 04/16] spelling: implicitly Signed-off-by: Josh Soref --- test/ClangImporter/pch-bridging-header.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ClangImporter/pch-bridging-header.swift b/test/ClangImporter/pch-bridging-header.swift index 2e81379b2ae7b..5948c42fc8d22 100644 --- a/test/ClangImporter/pch-bridging-header.swift +++ b/test/ClangImporter/pch-bridging-header.swift @@ -42,7 +42,7 @@ // RUN: llvm-objdump --raw-clang-ast %t/pch3/*.pch | llvm-bcanalyzer -dump | %FileCheck %s -check-prefix=PERSISTENT // PERSISTENT: ORIGINAL_FILE{{.*}}Inputs/sdk-bridging-header.h -// Test that -pch-disable-validation works in that it won't implicitely create a PCH +// Test that -pch-disable-validation works in that it won't implicitly create a PCH // 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 // NO-VALIDATION: PCH file {{.*}} not found From bd7a693ddf82db054754ad8592276cd57bc094fd Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:33:05 -0400 Subject: [PATCH 05/16] spelling: included Signed-off-by: Josh Soref --- lib/ClangImporter/ImporterImpl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ClangImporter/ImporterImpl.h b/lib/ClangImporter/ImporterImpl.h index c9be99cf719e9..201e14e0b172b 100644 --- a/lib/ClangImporter/ImporterImpl.h +++ b/lib/ClangImporter/ImporterImpl.h @@ -316,7 +316,7 @@ struct PlatformAvailability { bool isPlatformRelevant(StringRef platform) const; /// Returns true when the given declaration with the given deprecation - /// should be inlucded in the cutoff of imported deprecated APIs marked + /// should be included in the cutoff of imported deprecated APIs marked /// unavailable. bool treatDeprecatedAsUnavailable(const clang::Decl *clangDecl, const llvm::VersionTuple &version, From 242eeeaa3fb092cbf1ba9b9ae90771e2dc69abce Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:34:58 -0400 Subject: [PATCH 06/16] spelling: instantiate Signed-off-by: Josh Soref --- lib/ClangImporter/ClangImporter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index bad622b161305..55306c7d0c1dc 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -4393,7 +4393,7 @@ DeclRefExpr *getInteropStaticCastDeclRefExpr(ASTContext &ctx, "Did you forget to define a __swift_interopStaticCast helper function?"); FuncDecl *staticCastFn = cast(results.back()); - // Now we have to force instanciate this. We can't let the type checker do + // Now we have to force instantiate this. We can't let the type checker do // this yet because it can't infer the "To" type. auto subst = SubstitutionMap::get(staticCastFn->getGenericSignature(), {derived, base}, @@ -5207,7 +5207,7 @@ clang::FunctionDecl *ClangImporter::instantiateCXXFunctionTemplate( return nullptr; } - // Instanciate a specialization of this template using the substitution map. + // Instantiate a specialization of this template using the substitution map. auto *templateArgList = clang::TemplateArgumentList::CreateCopy( func->getASTContext(), templateSubst); auto &sema = getClangInstance().getSema(); From 96ecef41aeb469c65f28f23b3db5f78481774705 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:35:21 -0400 Subject: [PATCH 07/16] spelling: integer Signed-off-by: Josh Soref --- test/ClangImporter/experimental_diagnostics_cmacros.swift | 2 +- test/ClangImporter/experimental_eager_diagnostics.swift | 2 +- test/Inputs/clang-importer-sdk/usr/include/macros.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/ClangImporter/experimental_diagnostics_cmacros.swift b/test/ClangImporter/experimental_diagnostics_cmacros.swift index cbe436d09bba9..a95a2c76e6da5 100644 --- a/test/ClangImporter/experimental_diagnostics_cmacros.swift +++ b/test/ClangImporter/experimental_diagnostics_cmacros.swift @@ -34,7 +34,7 @@ _ = INVALID_ARITHMETIC_1 // CHECK-NEXT: _ = INVALID_ARITHMETIC_1 // CHECK-NEXT: ^~~~~~~~~~~~~~~~~~~~ // CHECK-NEXT: macros.h:{{[0-9]+}}:9: note: macro 'INVALID_ARITHMETIC_1' not imported: structure not supported -// CHECK-NEXT: #define INVALID_ARITHMETIC_1 5 + INVALID_INTERGER_LITERAL_1 +// CHECK-NEXT: #define INVALID_ARITHMETIC_1 5 + INVALID_INTEGER_LITERAL_1 // CHECK-NEXT: {{^}} ^ _ = INVALID_ARITHMETIC_2 diff --git a/test/ClangImporter/experimental_eager_diagnostics.swift b/test/ClangImporter/experimental_eager_diagnostics.swift index 4939fd92e998c..e3993ef37ddd3 100644 --- a/test/ClangImporter/experimental_eager_diagnostics.swift +++ b/test/ClangImporter/experimental_eager_diagnostics.swift @@ -185,7 +185,7 @@ import macros // CHECK-NEXT: {{^}} ^ // CHECK: macros.h:{{[0-9]+}}:9: note: macro 'INVALID_ARITHMETIC_1' not imported: structure not supported -// CHECK-NEXT: #define INVALID_ARITHMETIC_1 5 + INVALID_INTERGER_LITERAL_1 +// CHECK-NEXT: #define INVALID_ARITHMETIC_1 5 + INVALID_INTEGER_LITERAL_1 // CHECK-NEXT: {{^}} ^ // CHECK: macros.h:{{[0-9]+}}:9: note: macro 'INVALID_ARITHMETIC_2' not imported: structure not supported diff --git a/test/Inputs/clang-importer-sdk/usr/include/macros.h b/test/Inputs/clang-importer-sdk/usr/include/macros.h index 73ecaf510ddd2..3174848046826 100644 --- a/test/Inputs/clang-importer-sdk/usr/include/macros.h +++ b/test/Inputs/clang-importer-sdk/usr/include/macros.h @@ -169,7 +169,7 @@ typedef unsigned okay_t; #define FUNC_LIKE_MACRO_2(PARAM) PARAM // Unsupported binary arithmetic -#define INVALID_ARITHMETIC_1 5 + INVALID_INTERGER_LITERAL_1 +#define INVALID_ARITHMETIC_1 5 + INVALID_INTEGER_LITERAL_1 #define INVALID_ARITHMETIC_2 INVALID_INTEGER_LITERAL_1 + ADD_TWO #define INVALID_ARITHMETIC_3 ADD_TWO + INVALID_INTEGER_LITERAL_1 #define INVALID_ARITHMETIC_4 \ From 4887d22049f623708ba48f7ce5a8ec8f56a71526 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:38:50 -0400 Subject: [PATCH 08/16] spelling: nested Signed-off-by: Josh Soref --- test/ClangImporter/SceneKit_test.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ClangImporter/SceneKit_test.swift b/test/ClangImporter/SceneKit_test.swift index 316f4ff09b3fb..7347175ecc160 100644 --- a/test/ClangImporter/SceneKit_test.swift +++ b/test/ClangImporter/SceneKit_test.swift @@ -7,7 +7,7 @@ import SceneKit import Foundation // Test out some explicit renames of typedefs and globals, which are now new -// wrapper types with nestest values. +// wrapper types with nested values. @available(macOS 10.11, *) func testNestingRenames() { let _ = SCNGeometrySourceSemantic.self From 26b0b656455d8d5b500f6025cbb0296f7b85c5a1 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:40:24 -0400 Subject: [PATCH 09/16] spelling: otherthing Signed-off-by: Josh Soref --- test/ClangImporter/objc_direct.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/ClangImporter/objc_direct.swift b/test/ClangImporter/objc_direct.swift index ff2cb3ff08596..dc2b50207609f 100644 --- a/test/ClangImporter/objc_direct.swift +++ b/test/ClangImporter/objc_direct.swift @@ -23,7 +23,7 @@ class Foo { } } -var otherthing = Foo() as AnyObject +var otherThing = Foo() as AnyObject // We expect no error. -let _ = otherthing.directProtocolMethod() +let _ = otherThing.directProtocolMethod() From 9aef79ea473ece4659eddbed69850e24688a3ed6 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:41:02 -0400 Subject: [PATCH 10/16] spelling: overridden Signed-off-by: Josh Soref --- lib/ClangImporter/ImportDecl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index 870600e1019b7..33f5330fc8e9e 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -7377,7 +7377,7 @@ ConstructorDecl *SwiftDeclConverter::importConstructor( } void SwiftDeclConverter::recordObjCOverride(AbstractFunctionDecl *decl) { - // Make sure that we always set the overriden declarations. + // Make sure that we always set the overridden declarations. SWIFT_DEFER { if (!decl->overriddenDeclsComputed()) decl->setOverriddenDecls({ }); From f50a55c02821612266e57950b0b4e8061d5261fe Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:49:07 -0400 Subject: [PATCH 11/16] spelling: simultaneously Signed-off-by: Josh Soref --- test/ClangImporter/objc_async_conformance.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ClangImporter/objc_async_conformance.swift b/test/ClangImporter/objc_async_conformance.swift index c413dfd2332dc..bca7262e5e172 100644 --- a/test/ClangImporter/objc_async_conformance.swift +++ b/test/ClangImporter/objc_async_conformance.swift @@ -43,7 +43,7 @@ class ConformsToSync : NSObject, Club { /////// // selector conflicts -// attempting to satisfy the ObjC async requirement in two ways simultaenously +// attempting to satisfy the ObjC async requirement in two ways simultaneously // is problematic due to a clash in selector names on this ObjC-compatible type class SelectorConflict : NSObject, RequiredObserverOnlyCompletion { func hello() async -> Bool { true } // expected-note {{method 'hello()' declared here}} From 65fc731a3a4c14a611055bb04726bf1b1da90579 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:49:28 -0400 Subject: [PATCH 12/16] spelling: special Signed-off-by: Josh Soref --- lib/ClangImporter/ImportName.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ClangImporter/ImportName.cpp b/lib/ClangImporter/ImportName.cpp index 55ecc2c94da59..0f8fff55cc8ee 100644 --- a/lib/ClangImporter/ImportName.cpp +++ b/lib/ClangImporter/ImportName.cpp @@ -1678,7 +1678,7 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D, } } - // Spcial case: unnamed/anonymous fields. + // Special case: unnamed/anonymous fields. if (auto field = dyn_cast(D)) { static_assert((clang::Decl::lastField - clang::Decl::firstField) == 2, "update logic for new FieldDecl subclasses"); From 3dbf5190c77478c60b5b929d70e5df296f497e1e Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:53:21 -0400 Subject: [PATCH 13/16] spelling: typecheck Signed-off-by: Josh Soref --- unittests/ClangImporter/ClangImporterTests.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unittests/ClangImporter/ClangImporterTests.cpp b/unittests/ClangImporter/ClangImporterTests.cpp index a302231e03c40..75a80afc4d4c7 100644 --- a/unittests/ClangImporter/ClangImporterTests.cpp +++ b/unittests/ClangImporter/ClangImporterTests.cpp @@ -71,14 +71,14 @@ TEST(ClangImporterTest, emitPCHInMemory) { swift::LangOptions langOpts; langOpts.Target = llvm::Triple("x86_64", "apple", "darwin"); swift::SILOptions silOpts; - swift::TypeCheckerOptions typeckOpts; + swift::TypeCheckerOptions typecheckOpts; INITIALIZE_LLVM(); swift::SearchPathOptions searchPathOpts; swift::symbolgraphgen::SymbolGraphOptions symbolGraphOpts; swift::SourceManager sourceMgr; swift::DiagnosticEngine diags(sourceMgr); std::unique_ptr context( - ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts, options, + ASTContext::get(langOpts, typecheckOpts, silOpts, searchPathOpts, options, symbolGraphOpts, sourceMgr, diags)); auto importer = ClangImporter::create(*context); From 73093613be71746942cf1c04a28e605bea5844b9 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:53:53 -0400 Subject: [PATCH 14/16] spelling: unfortunately Signed-off-by: Josh Soref --- .../pch-bridging-header-vs-modular-interface-defn.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ClangImporter/pch-bridging-header-vs-modular-interface-defn.swift b/test/ClangImporter/pch-bridging-header-vs-modular-interface-defn.swift index 70241e23006ee..064c0758a7f4c 100644 --- a/test/ClangImporter/pch-bridging-header-vs-modular-interface-defn.swift +++ b/test/ClangImporter/pch-bridging-header-vs-modular-interface-defn.swift @@ -63,7 +63,7 @@ // ~~~~~~~~~~~~~~ // // One might hope that this can be fixed by having the merge-modules step take a -// PCH as well as other steps in the compilation. That unfortuantely only +// PCH as well as other steps in the compilation. That unfortunately only // inverts the problem, which resurfaces in the definition-order of Bar itself: // an XRef to __ObjC.Bar gets serialized, and then _it_ can't be found during // merge-modules, because the *last-read* defn of Bar -- the modular one, M.Bar From d6cf6f928b7f9937cc5431fd014368ee4b06d49b Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:54:10 -0400 Subject: [PATCH 15/16] spelling: unknown Signed-off-by: Josh Soref --- .../swift/ClangImporter/CXXMethodBridging.h | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/swift/ClangImporter/CXXMethodBridging.h b/include/swift/ClangImporter/CXXMethodBridging.h index 90cbbe7f2b4c8..5b7a92a8d9237 100644 --- a/include/swift/ClangImporter/CXXMethodBridging.h +++ b/include/swift/ClangImporter/CXXMethodBridging.h @@ -8,15 +8,15 @@ #include namespace swift { struct CXXMethodBridging { - enum class Kind { unkown, getter, setter, subscript }; + enum class Kind { unknown, getter, setter, subscript }; - enum class NameKind { unkown, snake, lower, camel, title }; + enum class NameKind { unknown, snake, lower, camel, title }; CXXMethodBridging(const clang::CXXMethodDecl *method) : method(method) {} Kind classify() { if (nameIsBlacklist()) - return Kind::unkown; + return Kind::unknown; // this should be handled as snake case. See: rdar://89453010 // case. In the future we could @@ -24,51 +24,51 @@ struct CXXMethodBridging { auto nameKind = classifyNameKind(); if (nameKind != NameKind::title && nameKind != NameKind::camel && nameKind != NameKind::lower) - return Kind::unkown; + return Kind::unknown; if (getClangName().startswith_insensitive("set")) { // Setters only have one parameter. if (method->getNumParams() != 1) - return Kind::unkown; + return Kind::unknown; // rdar://89453106 (We need to handle imported properties that return a // reference) if (method->getParamDecl(0)->getType()->isReferenceType()) - return Kind::unkown; + return Kind::unknown; return Kind::setter; } // Getters and subscripts cannot return void. if (method->getReturnType()->isVoidType()) - return Kind::unkown; + return Kind::unknown; if (getClangName().startswith_insensitive("get")) { // Getters cannot take arguments. if (method->getNumParams() != 0) - return Kind::unkown; + return Kind::unknown; // rdar://89453106 (We need to handle imported properties that return a // reference) if (method->getReturnType()->isReferenceType()) - return Kind::unkown; + return Kind::unknown; return Kind::getter; } // rdar://89453187 (Add subscripts clarification to CXXMethod Bridging to // clean up importDecl) - return Kind::unkown; + return Kind::unknown; } NameKind classifyNameKind() { bool allLower = llvm::all_of(getClangName(), islower); if (getClangName().empty()) - return NameKind::unkown; + return NameKind::unknown; if (getClangName().contains('_')) - return allLower ? NameKind::snake : NameKind::unkown; + return allLower ? NameKind::snake : NameKind::unknown; if (allLower) return NameKind::lower; From 15f44813d773616a92cad45c1448a03216958ba9 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 17 Apr 2022 15:55:26 -0400 Subject: [PATCH 16/16] spelling: version Signed-off-by: Josh Soref --- lib/ClangImporter/ImportName.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ClangImporter/ImportName.h b/lib/ClangImporter/ImportName.h index 7a89f268ed0e7..36623b8898b7e 100644 --- a/lib/ClangImporter/ImportName.h +++ b/lib/ClangImporter/ImportName.h @@ -412,7 +412,7 @@ class NameImporter { /// If \p action returns false, the current name will \e not be added to the /// set of seen names. /// - /// The active name for \p activeVerion is always first, followed by the + /// The active name for \p activeVersion is always first, followed by the /// other names in the order of /// ImportNameVersion::forEachOtherImportNameVersion. ///