Skip to content

Commit 39a038a

Browse files
committed
Expose lookup for feature-availability decl on ASTContext.
Swift needs to be able to look up the `VarDecl` that defines a given feature availability domain.
1 parent 886d8cc commit 39a038a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

clang/include/clang/AST/ASTContext.h

+9
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,15 @@ class ASTContext : public RefCountedBase<ASTContext> {
819819

820820
bool hasFeatureAvailabilityAttr(const Decl *D) const;
821821

822+
/// Retrieve the \c VarDecl that represents the feature availability domain
823+
/// with the given name.
824+
VarDecl *getFeatureAvailDecl(StringRef Name) const {
825+
auto It = AvailabilityDomainMap.find(Name);
826+
if (It != AvailabilityDomainMap.end())
827+
return It->second;
828+
return nullptr;
829+
}
830+
822831
// Retrieve availability domain information for a feature.
823832
AvailabilityDomainInfo getFeatureAvailInfo(StringRef FeatureName) const;
824833

0 commit comments

Comments
 (0)