mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ClangImporter] Retire the term "adapter" in favor of "overlay" (#24427)
Way back in Swift 1 I was trying to draw a distinction between "overlays", separate libraries that added Swift content to an existing Objective-C framework, and "the Swift part of a mixed-source framework", even though they're implemented in almost exactly the same way. "Adapter module" was the term that covered both of those. In practice, however, no one knew what "adapter" meant. Bring an end to this confusion by just using "overlay" within the compiler even for the mixed-source framework case. No intended functionality change.
This commit is contained in:
@@ -1397,7 +1397,7 @@ public:
|
||||
}
|
||||
|
||||
/// Returns the Swift module that overlays a Clang module.
|
||||
virtual ModuleDecl *getAdapterModule() const { return nullptr; }
|
||||
virtual ModuleDecl *getOverlayModule() const { return nullptr; }
|
||||
|
||||
virtual bool isSystemModule() const { return false; }
|
||||
|
||||
|
||||
@@ -94,8 +94,8 @@ public:
|
||||
/// and this is not set, clang will rebuild the module.
|
||||
bool DisableModulesValidateSystemHeaders = false;
|
||||
|
||||
/// When set, don't look for or load adapter modules.
|
||||
bool DisableAdapterModules = false;
|
||||
/// When set, don't look for or load overlays.
|
||||
bool DisableOverlayModules = false;
|
||||
|
||||
/// When set, don't enforce warnings with -Werror.
|
||||
bool DebuggerSupport = false;
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
Code = hash_combine(Code, InferImportAsMember);
|
||||
Code = hash_combine(Code, DisableSwiftBridgeAttr);
|
||||
Code = hash_combine(Code, DisableModulesValidateSystemHeaders);
|
||||
Code = hash_combine(Code, DisableAdapterModules);
|
||||
Code = hash_combine(Code, DisableOverlayModules);
|
||||
return Code;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ class ModuleLoader;
|
||||
class ClangModuleUnit final : public LoadedFile {
|
||||
ClangImporter::Implementation &owner;
|
||||
const clang::Module *clangModule;
|
||||
llvm::PointerIntPair<ModuleDecl *, 1, bool> adapterModule;
|
||||
llvm::PointerIntPair<ModuleDecl *, 1, bool> overlayModule;
|
||||
mutable ArrayRef<ModuleDecl::ImportedModule> importedModulesForLookup;
|
||||
/// The metadata of the underlying Clang module.
|
||||
clang::ExternalASTSource::ASTSourceDescriptor ASTSourceDescriptor;
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
bool isTopLevel() const;
|
||||
|
||||
/// Returns the Swift module that overlays this Clang module.
|
||||
ModuleDecl *getAdapterModule() const override;
|
||||
ModuleDecl *getOverlayModule() const override;
|
||||
|
||||
/// Retrieve the "exported" name of the module, which is usually the module
|
||||
/// name, but might be the name of the public module through which this
|
||||
|
||||
@@ -441,7 +441,7 @@ bool NormalProtocolConformance::isRetroactive() const {
|
||||
// defined in a Clang module.
|
||||
if (auto nominalLoadedModule =
|
||||
dyn_cast<LoadedFile>(nominal->getModuleScopeContext())) {
|
||||
if (auto overlayModule = nominalLoadedModule->getAdapterModule())
|
||||
if (auto overlayModule = nominalLoadedModule->getOverlayModule())
|
||||
nominalModule = overlayModule;
|
||||
}
|
||||
|
||||
|
||||
@@ -1627,13 +1627,12 @@ ModuleDecl *ClangImporter::loadModule(
|
||||
if (!clangModule)
|
||||
return nullptr;
|
||||
|
||||
return Impl.finishLoadingClangModule(clangModule,
|
||||
/*preferAdapter=*/false);
|
||||
return Impl.finishLoadingClangModule(clangModule, /*preferOverlay=*/false);
|
||||
}
|
||||
|
||||
ModuleDecl *ClangImporter::Implementation::finishLoadingClangModule(
|
||||
const clang::Module *clangModule,
|
||||
bool findAdapter) {
|
||||
bool findOverlay) {
|
||||
assert(clangModule);
|
||||
|
||||
// Bump the generation count.
|
||||
@@ -1645,7 +1644,7 @@ ModuleDecl *ClangImporter::Implementation::finishLoadingClangModule(
|
||||
if ((wrapperUnit = cacheEntry.getPointer())) {
|
||||
result = wrapperUnit->getParentModule();
|
||||
if (!cacheEntry.getInt()) {
|
||||
// Force load adapter modules for all imported modules.
|
||||
// Force load overlays for all imported modules.
|
||||
// FIXME: This forces the creation of wrapper modules for all imports as
|
||||
// well, and may do unnecessary work.
|
||||
cacheEntry.setInt(true);
|
||||
@@ -1666,7 +1665,7 @@ ModuleDecl *ClangImporter::Implementation::finishLoadingClangModule(
|
||||
result->addFile(*wrapperUnit);
|
||||
cacheEntry.setPointerAndInt(wrapperUnit, true);
|
||||
|
||||
// Force load adapter modules for all imported modules.
|
||||
// Force load overlays for all imported modules.
|
||||
// FIXME: This forces the creation of wrapper modules for all imports as
|
||||
// well, and may do unnecessary work.
|
||||
result->forAllVisibleModules({}, [](ModuleDecl::ImportedModule import) {});
|
||||
@@ -1680,9 +1679,9 @@ ModuleDecl *ClangImporter::Implementation::finishLoadingClangModule(
|
||||
loaded = result;
|
||||
}
|
||||
|
||||
if (findAdapter)
|
||||
if (ModuleDecl *adapter = wrapperUnit->getAdapterModule())
|
||||
result = adapter;
|
||||
if (findOverlay)
|
||||
if (ModuleDecl *overlay = wrapperUnit->getOverlayModule())
|
||||
result = overlay;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1702,7 +1701,7 @@ void ClangImporter::Implementation::handleDeferredImports()
|
||||
}
|
||||
PCHImportedSubmodules.clear();
|
||||
for (const clang::Module *M : ImportedHeaderExports)
|
||||
(void)finishLoadingClangModule(M, /*preferAdapter=*/true);
|
||||
(void)finishLoadingClangModule(M, /*preferOverlay=*/true);
|
||||
}
|
||||
|
||||
ModuleDecl *ClangImporter::getImportedHeaderModule() const {
|
||||
@@ -1801,7 +1800,7 @@ ClangImporter::Implementation::Implementation(ASTContext &ctx,
|
||||
InferImportAsMember(opts.InferImportAsMember),
|
||||
DisableSwiftBridgeAttr(opts.DisableSwiftBridgeAttr),
|
||||
BridgingHeaderExplicitlyRequested(!opts.BridgingHeader.empty()),
|
||||
DisableAdapterModules(opts.DisableAdapterModules),
|
||||
DisableOverlayModules(opts.DisableOverlayModules),
|
||||
IsReadingBridgingPCH(false),
|
||||
CurrentVersion(ImportNameVersion::fromOptions(ctx.LangOpts)),
|
||||
BridgingHeaderLookupTable(new SwiftLookupTable(nullptr)),
|
||||
@@ -3164,40 +3163,40 @@ StringRef ClangModuleUnit::getExportedModuleName() const {
|
||||
return getParentModule()->getName().str();
|
||||
}
|
||||
|
||||
ModuleDecl *ClangModuleUnit::getAdapterModule() const {
|
||||
ModuleDecl *ClangModuleUnit::getOverlayModule() const {
|
||||
if (!clangModule)
|
||||
return nullptr;
|
||||
|
||||
if (owner.DisableAdapterModules)
|
||||
if (owner.DisableOverlayModules)
|
||||
return nullptr;
|
||||
|
||||
if (!isTopLevel()) {
|
||||
// FIXME: Is this correct for submodules?
|
||||
auto topLevel = clangModule->getTopLevelModule();
|
||||
auto wrapper = owner.getWrapperForModule(topLevel);
|
||||
return wrapper->getAdapterModule();
|
||||
return wrapper->getOverlayModule();
|
||||
}
|
||||
|
||||
if (!adapterModule.getInt()) {
|
||||
if (!overlayModule.getInt()) {
|
||||
// FIXME: Include proper source location.
|
||||
ModuleDecl *M = getParentModule();
|
||||
ASTContext &Ctx = M->getASTContext();
|
||||
auto adapter = Ctx.getModule(ModuleDecl::AccessPathTy({M->getName(),
|
||||
SourceLoc()}));
|
||||
if (adapter == M) {
|
||||
adapter = nullptr;
|
||||
auto overlay = Ctx.getModule(ModuleDecl::AccessPathTy({M->getName(),
|
||||
SourceLoc()}));
|
||||
if (overlay == M) {
|
||||
overlay = nullptr;
|
||||
} else {
|
||||
auto &sharedModuleRef = Ctx.LoadedModules[M->getName()];
|
||||
assert(!sharedModuleRef || sharedModuleRef == adapter ||
|
||||
assert(!sharedModuleRef || sharedModuleRef == overlay ||
|
||||
sharedModuleRef == M);
|
||||
sharedModuleRef = adapter;
|
||||
sharedModuleRef = overlay;
|
||||
}
|
||||
|
||||
auto mutableThis = const_cast<ClangModuleUnit *>(this);
|
||||
mutableThis->adapterModule.setPointerAndInt(adapter, true);
|
||||
mutableThis->overlayModule.setPointerAndInt(overlay, true);
|
||||
}
|
||||
|
||||
return adapterModule.getPointer();
|
||||
return overlayModule.getPointer();
|
||||
}
|
||||
|
||||
void ClangModuleUnit::getImportedModules(
|
||||
@@ -3243,11 +3242,11 @@ void ClangModuleUnit::getImportedModules(
|
||||
}
|
||||
}
|
||||
|
||||
auto topLevelAdapter = getAdapterModule();
|
||||
auto topLevelOverlay = getOverlayModule();
|
||||
for (auto importMod : imported) {
|
||||
auto wrapper = owner.getWrapperForModule(importMod);
|
||||
|
||||
auto actualMod = wrapper->getAdapterModule();
|
||||
auto actualMod = wrapper->getOverlayModule();
|
||||
if (!actualMod) {
|
||||
// HACK: Deal with imports of submodules by importing the top-level module
|
||||
// as well.
|
||||
@@ -3260,11 +3259,11 @@ void ClangModuleUnit::getImportedModules(
|
||||
}
|
||||
}
|
||||
actualMod = wrapper->getParentModule();
|
||||
} else if (actualMod == topLevelAdapter) {
|
||||
} else if (actualMod == topLevelOverlay) {
|
||||
actualMod = wrapper->getParentModule();
|
||||
}
|
||||
|
||||
assert(actualMod && "Missing imported adapter module");
|
||||
assert(actualMod && "Missing imported overlay");
|
||||
imports.push_back({ModuleDecl::AccessPathTy(), actualMod});
|
||||
}
|
||||
}
|
||||
@@ -3283,7 +3282,7 @@ void ClangModuleUnit::getImportedModulesForLookup(
|
||||
|
||||
SmallVector<clang::Module *, 8> imported;
|
||||
const clang::Module *topLevel;
|
||||
ModuleDecl *topLevelAdapter = getAdapterModule();
|
||||
ModuleDecl *topLevelOverlay = getOverlayModule();
|
||||
if (!clangModule) {
|
||||
// This is the special "imported headers" module.
|
||||
imported.append(owner.ImportedHeaderExports.begin(),
|
||||
@@ -3315,7 +3314,7 @@ void ClangModuleUnit::getImportedModulesForLookup(
|
||||
// Don't continue looking through submodules of modules that have
|
||||
// overlays. The overlay might shadow things.
|
||||
auto wrapper = owner.getWrapperForModule(nextTopLevel);
|
||||
if (wrapper->getAdapterModule())
|
||||
if (wrapper->getOverlayModule())
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3334,11 +3333,11 @@ void ClangModuleUnit::getImportedModulesForLookup(
|
||||
for (auto importMod : topLevelImported) {
|
||||
auto wrapper = owner.getWrapperForModule(importMod);
|
||||
|
||||
auto actualMod = wrapper->getAdapterModule();
|
||||
if (!actualMod || actualMod == topLevelAdapter)
|
||||
auto actualMod = wrapper->getOverlayModule();
|
||||
if (!actualMod || actualMod == topLevelOverlay)
|
||||
actualMod = wrapper->getParentModule();
|
||||
|
||||
assert(actualMod && "Missing imported adapter module");
|
||||
assert(actualMod && "Missing imported overlay");
|
||||
imports.push_back({ModuleDecl::AccessPathTy(), actualMod});
|
||||
}
|
||||
|
||||
@@ -3725,7 +3724,7 @@ bool ClangImporter::isInOverlayModuleForImportedModule(
|
||||
return false;
|
||||
|
||||
auto overlayModule = overlayDC->getParentModule();
|
||||
if (overlayModule == importedClangModuleUnit->getAdapterModule())
|
||||
if (overlayModule == importedClangModuleUnit->getOverlayModule())
|
||||
return true;
|
||||
|
||||
// Is this a private module that's re-exported to the public (overlay) name?
|
||||
|
||||
@@ -4330,12 +4330,12 @@ namespace {
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
T *resolveSwiftDeclImpl(const U *decl, Identifier name, ModuleDecl *adapter) {
|
||||
T *resolveSwiftDeclImpl(const U *decl, Identifier name, ModuleDecl *overlay) {
|
||||
const auto &languageVersion =
|
||||
Impl.SwiftContext.LangOpts.EffectiveLanguageVersion;
|
||||
|
||||
SmallVector<ValueDecl *, 4> results;
|
||||
adapter->lookupValue({}, name, NLKind::QualifiedLookup, results);
|
||||
overlay->lookupValue({}, name, NLKind::QualifiedLookup, results);
|
||||
T *found = nullptr;
|
||||
for (auto result : results) {
|
||||
if (auto singleResult = dyn_cast<T>(result)) {
|
||||
@@ -4361,8 +4361,8 @@ namespace {
|
||||
template <typename T, typename U>
|
||||
T *resolveSwiftDecl(const U *decl, Identifier name,
|
||||
ClangModuleUnit *clangModule) {
|
||||
if (auto adapter = clangModule->getAdapterModule())
|
||||
return resolveSwiftDeclImpl<T>(decl, name, adapter);
|
||||
if (auto overlay = clangModule->getOverlayModule())
|
||||
return resolveSwiftDeclImpl<T>(decl, name, overlay);
|
||||
if (clangModule == Impl.ImportedHeaderUnit) {
|
||||
// Use an index-based loop because new owners can come in as we're
|
||||
// iterating.
|
||||
@@ -4414,7 +4414,7 @@ namespace {
|
||||
// FIXME: Figure out how to deal with incomplete protocols, since that
|
||||
// notion doesn't exist in Swift.
|
||||
if (!decl->hasDefinition()) {
|
||||
// Check if this protocol is implemented in its adapter.
|
||||
// Check if this protocol is implemented in its overlay.
|
||||
if (auto clangModule = Impl.getClangModuleForDecl(decl, true))
|
||||
if (auto native = resolveSwiftDecl<ProtocolDecl>(decl, name,
|
||||
clangModule))
|
||||
@@ -4545,7 +4545,7 @@ namespace {
|
||||
auto name = importedName.getDeclName().getBaseIdentifier();
|
||||
|
||||
if (!decl->hasDefinition()) {
|
||||
// Check if this class is implemented in its adapter.
|
||||
// Check if this class is implemented in its overlay.
|
||||
if (auto clangModule = Impl.getClangModuleForDecl(decl, true)) {
|
||||
if (auto native = resolveSwiftDecl<ClassDecl>(decl, name,
|
||||
clangModule)) {
|
||||
@@ -5199,13 +5199,13 @@ static bool conformsToProtocolInOriginalModule(NominalTypeDecl *nominal,
|
||||
const DeclContext *containingFile = nominal->getModuleScopeContext();
|
||||
ModuleDecl *originalModule = containingFile->getParentModule();
|
||||
|
||||
ModuleDecl *adapterModule = nullptr;
|
||||
ModuleDecl *overlayModule = nullptr;
|
||||
if (auto *clangUnit = dyn_cast<ClangModuleUnit>(containingFile))
|
||||
adapterModule = clangUnit->getAdapterModule();
|
||||
overlayModule = clangUnit->getOverlayModule();
|
||||
|
||||
for (ExtensionDecl *extension : nominal->getExtensions()) {
|
||||
ModuleDecl *extensionModule = extension->getParentModule();
|
||||
if (extensionModule != originalModule && extensionModule != adapterModule &&
|
||||
if (extensionModule != originalModule && extensionModule != overlayModule &&
|
||||
extensionModule != foundationModule) {
|
||||
continue;
|
||||
}
|
||||
@@ -5302,7 +5302,7 @@ SwiftDeclConverter::importSwiftNewtype(const clang::TypedefNameDecl *decl,
|
||||
return false;
|
||||
|
||||
// Break circularity by only looking for declared conformances in the
|
||||
// original module, or possibly its adapter.
|
||||
// original module, or possibly its overlay.
|
||||
if (conformsToProtocolInOriginalModule(computedNominal, proto,
|
||||
Impl.tryLoadFoundationModule(),
|
||||
Impl.getTypeResolver())) {
|
||||
|
||||
@@ -2354,7 +2354,7 @@ Type ClangImporter::Implementation::getNamedSwiftType(ModuleDecl *module,
|
||||
if (auto clangUnit = dyn_cast<ClangModuleUnit>(file)) {
|
||||
// If we have an overlay, look in the overlay. Otherwise, skip
|
||||
// the lookup to avoid infinite recursion.
|
||||
if (auto module = clangUnit->getAdapterModule())
|
||||
if (auto module = clangUnit->getOverlayModule())
|
||||
module->lookupValue({ }, identifier,
|
||||
NLKind::UnqualifiedLookup, results);
|
||||
} else {
|
||||
|
||||
@@ -334,7 +334,7 @@ public:
|
||||
const bool InferImportAsMember;
|
||||
const bool DisableSwiftBridgeAttr;
|
||||
const bool BridgingHeaderExplicitlyRequested;
|
||||
const bool DisableAdapterModules;
|
||||
const bool DisableOverlayModules;
|
||||
|
||||
bool IsReadingBridgingPCH;
|
||||
llvm::SmallVector<clang::serialization::SubmoduleID, 2> PCHImportedSubmodules;
|
||||
@@ -520,7 +520,7 @@ private:
|
||||
Type NSObjectTy;
|
||||
|
||||
/// A pair containing a ClangModuleUnit,
|
||||
/// and whether the adapters of its re-exported modules have all been forced
|
||||
/// and whether the overlays of its re-exported modules have all been forced
|
||||
/// to load already.
|
||||
using ModuleInitPair = llvm::PointerIntPair<ClangModuleUnit *, 1, bool>;
|
||||
|
||||
@@ -894,7 +894,7 @@ public:
|
||||
|
||||
/// Constructs a Swift module for the given Clang module.
|
||||
ModuleDecl *finishLoadingClangModule(const clang::Module *clangModule,
|
||||
bool preferAdapter);
|
||||
bool preferOverlay);
|
||||
|
||||
/// Call finishLoadingClangModule on each deferred import collected
|
||||
/// while scanning a bridging header or PCH.
|
||||
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
ModuleWrappers.insert({name, wrapperUnit});
|
||||
decl->addFile(*wrapperUnit);
|
||||
|
||||
// Force load adapter modules for all imported modules.
|
||||
// Force load overlay modules for all imported modules.
|
||||
decl->forAllVisibleModules({}, [](ModuleDecl::ImportedModule import) {});
|
||||
|
||||
return decl;
|
||||
|
||||
@@ -558,7 +558,7 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts,
|
||||
|
||||
Opts.DisableModulesValidateSystemHeaders |= Args.hasArg(OPT_disable_modules_validate_system_headers);
|
||||
|
||||
Opts.DisableAdapterModules |= Args.hasArg(OPT_emit_imported_modules);
|
||||
Opts.DisableOverlayModules |= Args.hasArg(OPT_emit_imported_modules);
|
||||
|
||||
if (const Arg *A = Args.getLastArg(OPT_pch_output_dir)) {
|
||||
Opts.PrecompiledHeaderOutputDir = A->getValue();
|
||||
|
||||
@@ -1128,7 +1128,7 @@ bool WitnessChecker::findBestWitness(
|
||||
if (!clangModule)
|
||||
continue;
|
||||
|
||||
DeclContext *overlay = clangModule->getAdapterModule();
|
||||
DeclContext *overlay = clangModule->getOverlayModule();
|
||||
if (!overlay)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
@_exported import ClangModuleWithAdapter
|
||||
|
||||
public func fromSwiftAdapter() {}
|
||||
@@ -1 +1 @@
|
||||
@import ClangModuleWithAdapter;
|
||||
@import ClangModuleWithOverlay;
|
||||
|
||||
@@ -22,7 +22,7 @@ module ClangModuleUser {
|
||||
export *
|
||||
}
|
||||
|
||||
module ClangModuleWithAdapter {
|
||||
module ClangModuleWithOverlay {
|
||||
link "UnderlyingClangLibrary"
|
||||
}
|
||||
|
||||
|
||||
3
test/ClangImporter/Inputs/overlay.swift
Normal file
3
test/ClangImporter/Inputs/overlay.swift
Normal file
@@ -0,0 +1,3 @@
|
||||
@_exported import ClangModuleWithOverlay
|
||||
|
||||
public func fromSwiftOverlay() {}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// RUN: %target-swift-frontend %s -sdk %S/Inputs -Fsystem %S/Inputs/System/Library/Frameworks -enable-objc-interop -I %S/Inputs/custom-modules -emit-ir -o - | %FileCheck %s
|
||||
|
||||
// RUN: %target-swift-frontend -emit-module %S/Inputs/adapter.swift -sdk %S/Inputs -module-link-name SwiftAdapter -module-name ClangModuleWithAdapter -I %S/Inputs/custom-modules -o %t
|
||||
// RUN: %target-swift-frontend -emit-module %S/Inputs/overlay.swift -sdk %S/Inputs -module-link-name SwiftOverlay -module-name ClangModuleWithOverlay -I %S/Inputs/custom-modules -o %t
|
||||
|
||||
// RUN: %target-swift-frontend %s -sdk %S/Inputs -Fsystem %S/Inputs/System/Library/Frameworks -enable-objc-interop -I %S/Inputs/custom-modules -I %t -emit-ir -o %t/with-adapter.ll
|
||||
// RUN: %FileCheck %s < %t/with-adapter.ll
|
||||
@@ -35,7 +35,7 @@ UsesSubmodule.useSomethingFromSubmodule()
|
||||
// CHECK-DAG: !{{[0-9]+}} = !{!"-framework", !"Indirect"}
|
||||
// CHECK-DAG: !{{[0-9]+}} = !{!"-framework", !"HasSubmodule"}
|
||||
|
||||
// CHECK-WITH-SWIFT: !{{[0-9]+}} = !{!{{"-lSwiftAdapter"|"/DEFAULTLIB:SwiftAdapter.lib"}}}
|
||||
// CHECK-WITH-SWIFT: !{{[0-9]+}} = !{!{{"-lSwiftOverlay"|"/DEFAULTLIB:SwiftOverlay.lib"}}}
|
||||
|
||||
// CHECK-WITH-DISABLED-DAG: !{!"-framework", !"Barrel"}
|
||||
// CHECK-WITH-DISABLED-DAG: !{!"-framework", !"Indirect"}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
|
||||
// RUN: %target-swift-frontend -emit-module -parse-as-library %S/Inputs/adapter.swift -sdk %S/Inputs -I %S/Inputs/custom-modules -module-name ClangModuleWithAdapter -o %t
|
||||
// RUN: %target-swift-frontend -emit-module -parse-as-library %S/Inputs/overlay.swift -sdk %S/Inputs -I %S/Inputs/custom-modules -module-name ClangModuleWithOverlay -o %t
|
||||
// RUN: %target-swift-frontend %s -sdk %S/Inputs -I %S/Inputs/custom-modules -I %t -typecheck
|
||||
// RUN: %target-swift-frontend %s -I %t -typecheck -show-diagnostics-after-fatal -verify
|
||||
|
||||
// When run without the underlying SDK, we should get an error here.
|
||||
import ClangModuleWithAdapter // expected-error{{cannot load underlying module for 'ClangModuleWithAdapter'}}
|
||||
import ClangModuleWithOverlay // expected-error{{cannot load underlying module for 'ClangModuleWithOverlay'}}
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import Cocoa
|
||||
|
||||
// Make sure the ObjectiveC adapter module gets imported, including ObjCSel.
|
||||
// Make sure the ObjectiveC overlay gets imported, including ObjCSel.
|
||||
func rdar14759044(obj: NSObject) -> Bool {
|
||||
return obj.responds(to: "abc") // no-warning
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user