@@ -427,7 +427,7 @@ namespace {
427
427
class InheritedProtocolCollector {
428
428
static const StringLiteral DummyProtocolName;
429
429
430
- using AvailableAttrList = TinyPtrVector< const AvailableAttr * >;
430
+ using AvailableAttrList = SmallVector<SemanticAvailableAttr >;
431
431
using OriginallyDefinedInAttrList =
432
432
TinyPtrVector<const OriginallyDefinedInAttr *>;
433
433
using ProtocolAndAvailability =
@@ -451,14 +451,13 @@ class InheritedProtocolCollector {
451
451
452
452
cache.emplace ();
453
453
while (D) {
454
- for (auto semanticAttr : D->getSemanticAvailableAttrs ()) {
455
- auto nextAttr = semanticAttr.getParsedAttr ();
456
-
454
+ for (auto nextAttr : D->getSemanticAvailableAttrs ()) {
457
455
// FIXME: This is just approximating the effects of nested availability
458
456
// attributes for the same platform; formally they'd need to be merged.
459
- bool alreadyHasMoreSpecificAttrForThisPlatform =
460
- llvm::any_of (*cache, [nextAttr](const AvailableAttr *existingAttr) {
461
- return existingAttr->getPlatform () == nextAttr->getPlatform ();
457
+ // FIXME: [availability] This should compare availability domains.
458
+ bool alreadyHasMoreSpecificAttrForThisPlatform = llvm::any_of (
459
+ *cache, [nextAttr](SemanticAvailableAttr existingAttr) {
460
+ return existingAttr.getPlatform () == nextAttr.getPlatform ();
462
461
});
463
462
if (alreadyHasMoreSpecificAttrForThisPlatform)
464
463
continue ;
@@ -785,8 +784,9 @@ class InheritedProtocolCollector {
785
784
786
785
// Build up synthesized DeclAttributes for the extension.
787
786
TinyPtrVector<const DeclAttribute *> clonedAttrs;
788
- for (auto *attr : availability) {
789
- clonedAttrs.push_back (attr->clone (ctx, /* implicit*/ true ));
787
+ for (auto attr : availability) {
788
+ clonedAttrs.push_back (
789
+ attr.getParsedAttr ()->clone (ctx, /* implicit*/ true ));
790
790
}
791
791
for (auto *attr : proto->getAttrs ().getAttributes <SPIAccessControlAttr>()) {
792
792
clonedAttrs.push_back (attr->clone (ctx, /* implicit*/ true ));
0 commit comments