Skip to content

Commit 1f2a0d6

Browse files
committed
---
yaml --- r: 344475 b: refs/heads/swift-5.1-branch-08-28-2019 c: aac9b64 h: refs/heads/master i: 344473: bfbe369 344471: 645196d
1 parent 624da97 commit 1f2a0d6

File tree

57 files changed

+38565
-40882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+38565
-40882
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,4 +1508,4 @@ refs/heads/revert-27301-syntaxparse-associatedtype: 859f90afc1557bf5600de108927b
15081508
refs/heads/shahmishal/pr-test-swift: 868c7a884713b910757f2f3d4c413e395aeba76c
15091509
refs/heads/shahmishal/pr-test-swift-2: fa33242bb6401b5206e2e3ce50624febfc469625
15101510
refs/heads/swift-5.1-branch-07-24-2019: 0450b7d81e75701c325138e6af52d470bb3dafdd
1511-
refs/heads/swift-5.1-branch-08-28-2019: c370c4d0c04414b57a0a9e7fcbcdcef8e4e393ad
1511+
refs/heads/swift-5.1-branch-08-28-2019: aac9b6443cc7fd3dc7b6af8796d1dd7000429996

branches/swift-5.1-branch-08-28-2019/include/swift/AST/DiagnosticsModuleDiffer.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ ERROR(decl_new_witness_table_entry,none,"%0 now requires %select{|no}1 new witne
9696

9797
ERROR(new_decl_without_intro,none,"%0 is a new API without @available attribute", (StringRef))
9898

99-
ERROR(objc_name_change,none,"%0 has ObjC name change from %1 to %2", (StringRef, StringRef, StringRef))
100-
10199
#ifndef DIAG_NO_UNDEF
102100
# if defined(DIAG)
103101
# undef DIAG

branches/swift-5.1-branch-08-28-2019/include/swift/Frontend/FrontendOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ class FrontendOptions {
7676
/// binary module has already been built for use by the compiler.
7777
std::string PrebuiltModuleCachePath;
7878

79-
/// For these modules, we should prefer using Swift interface when importing them.
80-
std::vector<std::string> PreferInterfaceForModules;
81-
8279
/// Emit index data for imported serialized swift system modules.
8380
bool IndexSystemModules = false;
8481

branches/swift-5.1-branch-08-28-2019/include/swift/Frontend/ParseableInterfaceModuleLoader.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,15 @@ class ParseableInterfaceModuleLoader : public SerializedModuleLoaderBase {
128128
explicit ParseableInterfaceModuleLoader(
129129
ASTContext &ctx, StringRef cacheDir, StringRef prebuiltCacheDir,
130130
DependencyTracker *tracker, ModuleLoadingMode loadMode,
131-
ArrayRef<std::string> PreferInterfaceForModules,
132131
bool RemarkOnRebuildFromInterface)
133132
: SerializedModuleLoaderBase(ctx, tracker, loadMode),
134133
CacheDir(cacheDir), PrebuiltCacheDir(prebuiltCacheDir),
135-
RemarkOnRebuildFromInterface(RemarkOnRebuildFromInterface),
136-
PreferInterfaceForModules(PreferInterfaceForModules)
134+
RemarkOnRebuildFromInterface(RemarkOnRebuildFromInterface)
137135
{}
138136

139137
std::string CacheDir;
140138
std::string PrebuiltCacheDir;
141139
bool RemarkOnRebuildFromInterface;
142-
ArrayRef<std::string> PreferInterfaceForModules;
143140

144141
std::error_code findModuleFilesInDirectory(
145142
AccessPathElem ModuleID, StringRef DirPath, StringRef ModuleFilename,
@@ -153,12 +150,10 @@ class ParseableInterfaceModuleLoader : public SerializedModuleLoaderBase {
153150
static std::unique_ptr<ParseableInterfaceModuleLoader>
154151
create(ASTContext &ctx, StringRef cacheDir, StringRef prebuiltCacheDir,
155152
DependencyTracker *tracker, ModuleLoadingMode loadMode,
156-
ArrayRef<std::string> PreferInterfaceForModules = {},
157153
bool RemarkOnRebuildFromInterface = false) {
158154
return std::unique_ptr<ParseableInterfaceModuleLoader>(
159155
new ParseableInterfaceModuleLoader(ctx, cacheDir, prebuiltCacheDir,
160156
tracker, loadMode,
161-
PreferInterfaceForModules,
162157
RemarkOnRebuildFromInterface));
163158
}
164159

branches/swift-5.1-branch-08-28-2019/include/swift/IDE/DigesterEnums.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,22 +143,18 @@ KEY_STRING(ModuleName, moduleName)
143143
KEY_STRING(SuperclassUsr, superclassUsr)
144144
KEY_STRING(EnumRawTypeName, enumRawTypeName)
145145
KEY_STRING(GenericSig, genericSig)
146-
KEY_STRING(SugaredGenericSig, sugared_genericSig)
147146
KEY_STRING(FuncSelfKind, funcSelfKind)
148147
KEY_STRING(ParamValueOwnership, paramValueOwnership)
149148
KEY_STRING(IntromacOS, intro_Macosx)
150149
KEY_STRING(IntroiOS, intro_iOS)
151150
KEY_STRING(IntrotvOS, intro_tvOS)
152151
KEY_STRING(IntrowatchOS, intro_watchOS)
153152
KEY_STRING(Introswift, intro_swift)
154-
KEY_STRING(ObjCName, objc_name)
155153

156154
KEY_STRING_ARR(SuperclassNames, superclassNames)
157-
KEY_STRING_ARR(ToolArgs, tool_arguments)
158155

159156
KEY_UINT(SelfIndex, selfIndex)
160157
KEY_UINT(FixedBinaryOrder, fixedbinaryorder)
161-
KEY_UINT(JsonFormatVer, json_format_version)
162158

163159
KEY(children)
164160
KEY(conformances)

branches/swift-5.1-branch-08-28-2019/lib/Frontend/Frontend.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,7 @@ bool CompilerInstance::setUpModuleLoaders() {
361361
StringRef PrebuiltModuleCachePath = FEOpts.PrebuiltModuleCachePath;
362362
auto PIML = ParseableInterfaceModuleLoader::create(
363363
*Context, ModuleCachePath, PrebuiltModuleCachePath,
364-
getDependencyTracker(), MLM, FEOpts.PreferInterfaceForModules,
365-
FEOpts.RemarkOnRebuildFromModuleInterface);
364+
getDependencyTracker(), MLM, FEOpts.RemarkOnRebuildFromModuleInterface);
366365
Context->addModuleLoader(std::move(PIML));
367366
}
368367
Context->addModuleLoader(std::move(SML));

branches/swift-5.1-branch-08-28-2019/lib/Frontend/ParseableInterfaceModuleLoader.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,14 +1425,11 @@ std::error_code ParseableInterfaceModuleLoader::findModuleFilesInDirectory(
14251425
}
14261426

14271427
// Create an instance of the Impl to do the heavy lifting.
1428-
auto ModuleName = ModuleID.first.str();
14291428
ParseableInterfaceModuleLoaderImpl Impl(
1430-
Ctx, ModPath, InPath, ModuleName,
1429+
Ctx, ModPath, InPath, ModuleID.first.str(),
14311430
CacheDir, PrebuiltCacheDir, ModuleID.second,
14321431
RemarkOnRebuildFromInterface, dependencyTracker,
1433-
llvm::is_contained(PreferInterfaceForModules,
1434-
ModuleName) ?
1435-
ModuleLoadingMode::PreferParseable : LoadMode);
1432+
LoadMode);
14361433

14371434
// Ask the impl to find us a module that we can load or give us an error
14381435
// telling us that we couldn't load it.

branches/swift-5.1-branch-08-28-2019/stdlib/toolchain/Compatibility50/Overrides.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,56 @@ __attribute__((used, section("__DATA,__swift_hooks"))) = {
3636
__attribute__((weak, visibility("hidden")))
3737
extern "C"
3838
char _swift_FORCE_LOAD_$_swiftCompatibility50 = 0;
39+
40+
// Put a getClass hook in front of the system Swift runtime's hook to prevent it
41+
// from trying to interpret symbolic references. rdar://problem/55036306
42+
43+
// FIXME: delete this #if and dlsym once we don't
44+
// need to build with older libobjc headers
45+
#if !OBJC_GETCLASSHOOK_DEFINED
46+
using objc_hook_getClass = BOOL(*)(const char * _Nonnull name,
47+
Class _Nullable * _Nonnull outClass);
48+
#endif
49+
static objc_hook_getClass OldGetClassHook;
50+
51+
static BOOL
52+
getObjCClassByMangledName_untrusted(const char * _Nonnull typeName,
53+
Class _Nullable * _Nonnull outClass) {
54+
// Scan the string for byte sequences that might be recognized as
55+
// symbolic references, and reject them.
56+
for (const char *c = typeName; *c != 0; ++c) {
57+
if (*c < 0x20) {
58+
*outClass = Nil;
59+
return NO;
60+
}
61+
}
62+
63+
if (OldGetClassHook) {
64+
return OldGetClassHook(typeName, outClass);
65+
}
66+
// In case the OS runtime for some reason didn't install a hook, fallback to
67+
// NO.
68+
return NO;
69+
}
70+
71+
__attribute__((constructor))
72+
static void installGetClassHook_untrusted() {
73+
// FIXME: delete this #if and dlsym once we don't
74+
// need to build with older libobjc headers
75+
#if !OBJC_GETCLASSHOOK_DEFINED
76+
using objc_hook_getClass = BOOL(*)(const char * _Nonnull name,
77+
Class _Nullable * _Nonnull outClass);
78+
auto objc_setHook_getClass =
79+
(void(*)(objc_hook_getClass _Nonnull,
80+
objc_hook_getClass _Nullable * _Nonnull))
81+
dlsym(RTLD_DEFAULT, "objc_setHook_getClass");
82+
#endif
83+
84+
#pragma clang diagnostic push
85+
#pragma clang diagnostic ignored "-Wunguarded-availability"
86+
if (objc_setHook_getClass) {
87+
objc_setHook_getClass(getObjCClassByMangledName_untrusted,
88+
&OldGetClassHook);
89+
}
90+
#pragma clang diagnostic pop
91+
}

branches/swift-5.1-branch-08-28-2019/test/api-digester/Inputs/cake.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
public protocol P1 {}
44
public protocol P2 {}
55
public protocol P3: P2, P1 {}
6-
76
@frozen
87
public struct S1: P1 {
98
public static func foo1() {}
@@ -124,18 +123,3 @@ public class PlatformIntroClass {}
124123

125124
@available(swift, introduced: 5)
126125
public class SwiftIntroClass {}
127-
128-
@objc(NewObjCClass)
129-
public class SwiftObjcClass {
130-
@objc(ObjCFool:ObjCA:ObjCB:)
131-
public func foo(a:Int, b:Int, c: Int) {}
132-
}
133-
134-
@available(iOS 10.2, tvOS 10.3, watchOS 3.4, *)
135-
@available(macOS, unavailable)
136-
public class UnavailableOnMac {}
137-
138-
@available(macOS, unavailable)
139-
extension SwiftObjcClass {
140-
public func functionUnavailableOnMac() {}
141-
}

branches/swift-5.1-branch-08-28-2019/test/api-digester/Inputs/cake_baseline/cake.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,3 @@ public class Zoo {
195195
}
196196

197197
public func returnFunctionTypeOwnershipChange() -> (C1) -> () { return { _ in } }
198-
199-
@objc(OldObjCClass)
200-
public class SwiftObjcClass {
201-
@objc(OldObjCFool:OldObjCA:OldObjCB:)
202-
public func foo(a:Int, b:Int, c: Int) {}
203-
}

branches/swift-5.1-branch-08-28-2019/test/api-digester/Inputs/cake_current/cake.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,3 @@ public class Zoo {
202202
}
203203

204204
public func returnFunctionTypeOwnershipChange() -> (__owned C1) -> () { return { _ in } }
205-
206-
@objc(NewObjCClass)
207-
public class SwiftObjcClass {
208-
@objc(NewObjCFool:NewObjCA:NewObjCB:)
209-
public func foo(a:Int, b:Int, c: Int) {}
210-
}

0 commit comments

Comments
 (0)