Skip to content

Commit 268fc50

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 1a09f8f commit 268fc50

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
@@ -840,6 +840,15 @@ class ASTContext : public RefCountedBase<ASTContext> {
840840

841841
bool hasFeatureAvailabilityAttr(const Decl *D) const;
842842

843+
/// Retrieve the \c VarDecl that represents the feature availability domain
844+
/// with the given name.
845+
VarDecl *getFeatureAvailDecl(StringRef Name) const {
846+
auto It = AvailabilityDomainMap.find(Name);
847+
if (It != AvailabilityDomainMap.end())
848+
return It->second;
849+
return nullptr;
850+
}
851+
843852
// Retrieve availability domain information for a feature.
844853
AvailabilityDomainInfo getFeatureAvailInfo(StringRef FeatureName) const;
845854

0 commit comments

Comments
 (0)