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:
Allan Shortlidge
2025-03-12 18:50:10 -07:00
parent 275a6792d1
commit 017dae382e
12 changed files with 153 additions and 32 deletions

View File

@@ -970,6 +970,12 @@ public:
const ModuleDecl *importedModule,
llvm::SmallSetVector<Identifier, 4> &spiGroups) const;
/// Finds the custom availability domain defined by this module with the
/// given identifier and if one exists adds it to results.
void
lookupAvailabilityDomains(Identifier identifier,
SmallVectorImpl<AvailabilityDomain> &results) const;
// Is \p attr accessible as an explicitly imported SPI from this module?
bool isImportedAsSPI(const SpecializeAttr *attr,
const ValueDecl *targetDecl) const;
@@ -1234,11 +1240,6 @@ public:
/// An empty `Version` is returned if the information is not available.
version::Version getLanguageVersionBuiltWith() const;
/// Returns the custom availability domain defined by this module with the
/// given identifier, if one exists.
std::optional<AvailabilityDomain>
getAvailabilityDomainForIdentifier(Identifier identifier) const;
void setAvailabilityDomains(const AvailabilityDomainMap &&map) {
AvailabilityDomains = std::move(map);
}