mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ClangImporter: Look up availability domains defined in bridging headers.
This is very brittle in this first iteration. For now we require the declaration representing the availability domain be deserialized before it can be looked up by name since Clang does not have a lookup table for availabilty domains in its module representation. As a result, it only works for bridging headers that are not precompiled. Part of rdar://138441266.
This commit is contained in:
@@ -1090,6 +1090,18 @@ void ModuleDecl::lookupImportedSPIGroups(
|
||||
FORWARD(lookupImportedSPIGroups, (importedModule, spiGroups));
|
||||
}
|
||||
|
||||
void ModuleDecl::lookupAvailabilityDomains(
|
||||
Identifier identifier,
|
||||
llvm::SmallVectorImpl<AvailabilityDomain> &results) const {
|
||||
auto iter = AvailabilityDomains.find(identifier);
|
||||
if (iter != AvailabilityDomains.end()) {
|
||||
results.push_back(AvailabilityDomain::forCustom(iter->getSecond()));
|
||||
return;
|
||||
}
|
||||
|
||||
FORWARD(lookupAvailabilityDomains, (identifier, results));
|
||||
}
|
||||
|
||||
void BuiltinUnit::lookupValue(DeclName name, NLKind lookupKind,
|
||||
OptionSet<ModuleLookupFlags> Flags,
|
||||
SmallVectorImpl<ValueDecl*> &result) const {
|
||||
@@ -4172,15 +4184,6 @@ version::Version ModuleDecl::getLanguageVersionBuiltWith() const {
|
||||
return version::Version();
|
||||
}
|
||||
|
||||
std::optional<AvailabilityDomain>
|
||||
ModuleDecl::getAvailabilityDomainForIdentifier(Identifier identifier) const {
|
||||
auto iter = AvailabilityDomains.find(identifier);
|
||||
if (iter == AvailabilityDomains.end())
|
||||
return std::nullopt;
|
||||
|
||||
return AvailabilityDomain::forCustom(iter->getSecond());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// MARK: SwiftSettings
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user