@@ -553,6 +553,7 @@ bool swift::isRepresentableInObjC(
553
553
554
554
// If you change this function, you must add or modify a test in PrintAsObjC.
555
555
ASTContext &ctx = AFD->getASTContext ();
556
+ DiagnosticStateRAII diagState (ctx.Diags );
556
557
557
558
bool Diagnose = shouldDiagnoseObjCReason (Reason, ctx);
558
559
@@ -985,6 +986,8 @@ bool swift::isRepresentableInObjC(const VarDecl *VD, ObjCReason Reason) {
985
986
T = RST->getReferentType ();
986
987
}
987
988
ASTContext &ctx = VD->getASTContext ();
989
+ DiagnosticStateRAII diagState (ctx.Diags );
990
+
988
991
bool Result = T->isRepresentableIn (ForeignLanguage::ObjectiveC,
989
992
VD->getDeclContext ());
990
993
bool Diagnose = shouldDiagnoseObjCReason (Reason, ctx);
@@ -1018,6 +1021,7 @@ bool swift::isRepresentableInObjC(const VarDecl *VD, ObjCReason Reason) {
1018
1021
bool swift::isRepresentableInObjC (const SubscriptDecl *SD, ObjCReason Reason) {
1019
1022
// If you change this function, you must add or modify a test in PrintAsObjC.
1020
1023
ASTContext &ctx = SD->getASTContext ();
1024
+ DiagnosticStateRAII diagState (ctx.Diags );
1021
1025
bool Diagnose = shouldDiagnoseObjCReason (Reason, ctx);
1022
1026
1023
1027
if (checkObjCInForeignClassContext (SD, Reason))
@@ -1219,6 +1223,7 @@ static Optional<ObjCReason> shouldMarkClassAsObjC(const ClassDecl *CD) {
1219
1223
}
1220
1224
1221
1225
// / Figure out if a declaration should be exported to Objective-C.
1226
+ static
1222
1227
Optional<ObjCReason> shouldMarkAsObjC (const ValueDecl *VD, bool allowImplicit) {
1223
1228
// If Objective-C interoperability is disabled, nothing gets marked as @objc.
1224
1229
if (!VD->getASTContext ().LangOpts .EnableObjCInterop )
@@ -1472,6 +1477,8 @@ static void markAsObjC(ValueDecl *D, ObjCReason reason,
1472
1477
1473
1478
1474
1479
bool IsObjCRequest::evaluate (Evaluator &evaluator, ValueDecl *VD) const {
1480
+ DiagnosticStateRAII diagState (VD->getASTContext ().Diags );
1481
+
1475
1482
// Access notes may add attributes that affect this calculus.
1476
1483
(void )evaluateOrDefault (evaluator, ApplyAccessNoteRequest{VD}, {});
1477
1484
@@ -2180,6 +2187,7 @@ lookupOverridenObjCMethod(ClassDecl *classDecl, AbstractFunctionDecl *method,
2180
2187
2181
2188
bool swift::diagnoseUnintendedObjCMethodOverrides (SourceFile &sf) {
2182
2189
auto &Ctx = sf.getASTContext ();
2190
+ DiagnosticStateRAII diagState (Ctx.Diags );
2183
2191
auto &methods = sf.ObjCMethodList ;
2184
2192
2185
2193
// If no Objective-C methods were defined in this file, we're done.
@@ -2284,6 +2292,7 @@ bool swift::diagnoseObjCMethodConflicts(SourceFile &sf) {
2284
2292
return false ;
2285
2293
2286
2294
auto &Ctx = sf.getASTContext ();
2295
+ DiagnosticStateRAII diagState (Ctx.Diags );
2287
2296
OrderDeclarations ordering;
2288
2297
2289
2298
// Sort the set of conflicts so we get a deterministic order for
@@ -2389,6 +2398,7 @@ bool swift::diagnoseObjCUnsatisfiedOptReqConflicts(SourceFile &sf) {
2389
2398
return false ;
2390
2399
2391
2400
auto &Ctx = sf.getASTContext ();
2401
+ DiagnosticStateRAII diagState (Ctx.Diags );
2392
2402
2393
2403
// Sort the set of local unsatisfied requirements, so we get a
2394
2404
// deterministic order for diagnostics.
0 commit comments