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> {
808
808
bool isInvalid () const { return Kind == FeatureAvailKind::None; }
809
809
};
810
810
811
- std::map<StringRef, AvailabilityDomainInfo > AvailabilityDomainMap;
811
+ std::map<StringRef, VarDecl * > AvailabilityDomainMap;
812
812
813
- void addAvailabilityDomainMap (StringRef Name, AvailabilityDomainInfo Info ) {
814
- AvailabilityDomainMap[Name] = Info ;
813
+ void addAvailabilityDomainMap (StringRef Name, VarDecl *VD ) {
814
+ AvailabilityDomainMap[Name] = VD ;
815
815
}
816
816
817
817
std::pair<DomainAvailabilityAttr *, bool >
Original file line number Diff line number Diff line change @@ -910,7 +910,7 @@ ASTContext::getFeatureAvailInfo(StringRef FeatureName) const {
910
910
911
911
auto I = AvailabilityDomainMap.find(FeatureName);
912
912
if (I != AvailabilityDomainMap.end())
913
- return I->second;
913
+ return getFeatureAvailInfo( I->second). second;
914
914
915
915
return {};
916
916
}
@@ -13214,6 +13214,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
13214
13214
const auto *VD = cast<VarDecl>(D);
13215
13215
assert(VD->isFileVarDecl() && "Expected file scoped var");
13216
13216
13217
+ // Variables annotated with availability_domain need to be deserialized.
13218
+ if (VD->hasAttr<AvailabilityDomainAttr>())
13219
+ return true;
13220
+
13217
13221
// If the decl is marked as `declare target to`, it should be emitted for the
13218
13222
// host and for the device.
13219
13223
if (LangOpts.OpenMP &&
Original file line number Diff line number Diff line change @@ -15649,11 +15649,8 @@ void Sema::FinalizeDeclaration(Decl *ThisDecl) {
15649
15649
}
15650
15650
}
15651
15651
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);
15657
15654
15658
15655
const DeclContext *DC = VD->getDeclContext();
15659
15656
// 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) {
1683
1683
}
1684
1684
}
1685
1685
1686
+ if (auto *Attr = VD->getAttr <AvailabilityDomainAttr>())
1687
+ Reader.getContext ().addAvailabilityDomainMap (Attr->getName ()->getName (),
1688
+ VD);
1689
+
1686
1690
return Redecl;
1687
1691
}
1688
1692
You can’t perform that action at this time.
0 commit comments