@@ -1112,6 +1112,28 @@ class PrunePass : public MatchedNodeListener, public SDKTreeDiffPass {
1112
1112
UpdateMap (Ctx.getNodeUpdateMap()),
1113
1113
ProtocolReqWhitelist (std::move(prWhitelist)) {}
1114
1114
1115
+ void diagnoseMissingAvailable (SDKNodeDecl *D) {
1116
+ // For extensions of external types, we diagnose individual member's missing
1117
+ // available attribute instead of the extension itself.
1118
+ // The reason is we may merge several extensions into a single one; some
1119
+ // attributes are missing.
1120
+ if (auto *DT = dyn_cast<SDKNodeDeclType>(D)) {
1121
+ if (DT->isExtension ()) {
1122
+ for (auto MD: DT->getChildren ()) {
1123
+ diagnoseMissingAvailable (cast<SDKNodeDecl>(MD));
1124
+ }
1125
+ return ;
1126
+ }
1127
+ }
1128
+ // Diagnose the missing of @available attributes.
1129
+ // Decls with @_alwaysEmitIntoClient aren't required to have an
1130
+ // @available attribute.
1131
+ if (!Ctx.getOpts ().SkipOSCheck &&
1132
+ !D->getIntroducingVersion ().hasOSAvailability () &&
1133
+ !D->hasDeclAttribute (DeclAttrKind::DAK_AlwaysEmitIntoClient)) {
1134
+ D->emitDiag (D->getLoc (), diag::new_decl_without_intro);
1135
+ }
1136
+ }
1115
1137
void foundMatch (NodePtr Left, NodePtr Right, NodeMatchReason Reason) override {
1116
1138
if (options::DebugMapping)
1117
1139
debugMatch (Left, Right, Reason, llvm::errs ());
@@ -1125,14 +1147,7 @@ class PrunePass : public MatchedNodeListener, public SDKTreeDiffPass {
1125
1147
if (D->hasFixedBinaryOrder ()) {
1126
1148
D->emitDiag (D->getLoc (), diag::decl_added);
1127
1149
}
1128
- // Diagnose the missing of @available attributes.
1129
- // Decls with @_alwaysEmitIntoClient aren't required to have an
1130
- // @available attribute.
1131
- if (!Ctx.getOpts ().SkipOSCheck &&
1132
- !D->getIntroducingVersion ().hasOSAvailability () &&
1133
- !D->hasDeclAttribute (DeclAttrKind::DAK_AlwaysEmitIntoClient)) {
1134
- D->emitDiag (D->getLoc (), diag::new_decl_without_intro);
1135
- }
1150
+ diagnoseMissingAvailable (D);
1136
1151
}
1137
1152
}
1138
1153
// Complain about added protocol requirements
0 commit comments