Skip to content

Commit 078a9a0

Browse files
committed
Remove hackery introduced for Swift 3 migration that should be in the 2.2 compiler.
1 parent 634acb4 commit 078a9a0

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5018,6 +5018,8 @@ canSkipOverTypedef(ClangImporter::Implementation &Impl,
50185018

50195019
bool ClangImporter::Implementation::shouldTrySwift3Migration(
50205020
Decl *swiftDecl, const clang::NamedDecl *clangDecl) {
5021+
if (!SwiftContext.LangOpts.Swift3Migration) return false;
5022+
50215023
// Never map subscript declarations.
50225024
if (isa<SubscriptDecl>(swiftDecl)) return false;
50235025

lib/Serialization/Deserialization.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,47 +1051,11 @@ Decl *ModuleFile::resolveCrossReference(Module *M, uint32_t pathLen) {
10511051
if (!isType)
10521052
pathTrace.addType(filterTy);
10531053

1054-
bool retrying = false;
1055-
retry:
1056-
10571054
M->lookupQualified(ModuleType::get(M), name,
10581055
NL_QualifiedDefault | NL_KnownNoDependency,
10591056
/*typeResolver=*/nullptr, values);
10601057
filterValues(filterTy, nullptr, nullptr, isType, inProtocolExt, None,
10611058
values);
1062-
1063-
// HACK HACK HACK: Omit-needless-words hack to try to cope with
1064-
// the "NS" prefix being added/removed. No "real" compiler mode
1065-
// has to go through this path: a Swift 2 compiler will have the
1066-
// prefix, while a Swift 3 compiler will not have the
1067-
// prefix. However, one can set OmitNeedlessWords in a Swift 2
1068-
// compiler to get API dumps and perform basic testing; this hack
1069-
// keeps that working.
1070-
if (values.empty() && !retrying &&
1071-
getContext().LangOpts.OmitNeedlessWords &&
1072-
(M->getName().str() == "ObjectiveC" ||
1073-
M->getName().str() == "Foundation")) {
1074-
if (name.str().startswith("NS")) {
1075-
if (name.str().size() > 2 && name.str() != "NSCocoaError") {
1076-
auto known = getKnownFoundationEntity(name.str());
1077-
if (!known || !nameConflictsWithStandardLibrary(*known)) {
1078-
// FIXME: lowercasing magic for non-types.
1079-
name = getContext().getIdentifier(name.str().substr(2));
1080-
retrying = true;
1081-
goto retry;
1082-
}
1083-
}
1084-
} else {
1085-
SmallString<16> buffer;
1086-
buffer += "NS";
1087-
buffer += name.str();
1088-
// FIXME: Try uppercasing for non-types.
1089-
name = getContext().getIdentifier(buffer);
1090-
retrying = true;
1091-
goto retry;
1092-
}
1093-
}
1094-
10951059
break;
10961060
}
10971061

0 commit comments

Comments
 (0)