File tree Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -808,10 +808,10 @@ class ASTContext : public RefCountedBase<ASTContext> {
808808 bool isInvalid () const { return Kind == FeatureAvailKind::None; }
809809 };
810810
811- std::map<StringRef, AvailabilityDomainInfo > AvailabilityDomainMap;
811+ std::map<StringRef, VarDecl * > AvailabilityDomainMap;
812812
813- void addAvailabilityDomainMap (StringRef Name, AvailabilityDomainInfo Info ) {
814- AvailabilityDomainMap[Name] = Info ;
813+ void addAvailabilityDomainMap (StringRef Name, VarDecl *VD ) {
814+ AvailabilityDomainMap[Name] = VD ;
815815 }
816816
817817 std::pair<DomainAvailabilityAttr *, bool >
Original file line number Diff line number Diff line change @@ -910,7 +910,7 @@ ASTContext::getFeatureAvailInfo(StringRef FeatureName) const {
910910
911911 auto I = AvailabilityDomainMap.find(FeatureName);
912912 if (I != AvailabilityDomainMap.end())
913- return I->second;
913+ return getFeatureAvailInfo( I->second). second;
914914
915915 return {};
916916}
@@ -13214,6 +13214,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
1321413214 const auto *VD = cast<VarDecl>(D);
1321513215 assert(VD->isFileVarDecl() && "Expected file scoped var");
1321613216
13217+ // Variables annotated with availability_domain need to be deserialized.
13218+ if (VD->hasAttr<AvailabilityDomainAttr>())
13219+ return true;
13220+
1321713221 // If the decl is marked as `declare target to`, it should be emitted for the
1321813222 // host and for the device.
1321913223 if (LangOpts.OpenMP &&
Original file line number Diff line number Diff line change @@ -15649,11 +15649,8 @@ void Sema::FinalizeDeclaration(Decl *ThisDecl) {
1564915649 }
1565015650 }
1565115651
15652- std::pair<StringRef, ASTContext::AvailabilityDomainInfo> ADInfo =
15653- getASTContext().getFeatureAvailInfo(VD);
15654-
15655- if (!ADInfo.first.empty())
15656- getASTContext().addAvailabilityDomainMap(ADInfo.first, ADInfo.second);
15652+ if (auto *Attr = VD->getAttr<AvailabilityDomainAttr>())
15653+ getASTContext().addAvailabilityDomainMap(Attr->getName()->getName(), VD);
1565715654
1565815655 const DeclContext *DC = VD->getDeclContext();
1565915656 // If there's a #pragma GCC visibility in scope, and this isn't a class
Original file line number Diff line number Diff line change @@ -1683,6 +1683,10 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitVarDeclImpl(VarDecl *VD) {
16831683 }
16841684 }
16851685
1686+ if (auto *Attr = VD->getAttr <AvailabilityDomainAttr>())
1687+ Reader.getContext ().addAvailabilityDomainMap (Attr->getName ()->getName (),
1688+ VD);
1689+
16861690 return Redecl;
16871691}
16881692
You can’t perform that action at this time.
0 commit comments