@@ -553,6 +553,7 @@ bool swift::isRepresentableInObjC(
553553
554554 // If you change this function, you must add or modify a test in PrintAsObjC.
555555 ASTContext &ctx = AFD->getASTContext ();
556+ DiagnosticStateRAII diagState (ctx.Diags );
556557
557558 bool Diagnose = shouldDiagnoseObjCReason (Reason, ctx);
558559
@@ -985,6 +986,8 @@ bool swift::isRepresentableInObjC(const VarDecl *VD, ObjCReason Reason) {
985986 T = RST->getReferentType ();
986987 }
987988 ASTContext &ctx = VD->getASTContext ();
989+ DiagnosticStateRAII diagState (ctx.Diags );
990+
988991 bool Result = T->isRepresentableIn (ForeignLanguage::ObjectiveC,
989992 VD->getDeclContext ());
990993 bool Diagnose = shouldDiagnoseObjCReason (Reason, ctx);
@@ -1018,6 +1021,7 @@ bool swift::isRepresentableInObjC(const VarDecl *VD, ObjCReason Reason) {
10181021bool swift::isRepresentableInObjC (const SubscriptDecl *SD, ObjCReason Reason) {
10191022 // If you change this function, you must add or modify a test in PrintAsObjC.
10201023 ASTContext &ctx = SD->getASTContext ();
1024+ DiagnosticStateRAII diagState (ctx.Diags );
10211025 bool Diagnose = shouldDiagnoseObjCReason (Reason, ctx);
10221026
10231027 if (checkObjCInForeignClassContext (SD, Reason))
@@ -1219,6 +1223,7 @@ static Optional<ObjCReason> shouldMarkClassAsObjC(const ClassDecl *CD) {
12191223}
12201224
12211225// / Figure out if a declaration should be exported to Objective-C.
1226+ static
12221227Optional<ObjCReason> shouldMarkAsObjC (const ValueDecl *VD, bool allowImplicit) {
12231228 // If Objective-C interoperability is disabled, nothing gets marked as @objc.
12241229 if (!VD->getASTContext ().LangOpts .EnableObjCInterop )
@@ -1472,6 +1477,8 @@ static void markAsObjC(ValueDecl *D, ObjCReason reason,
14721477
14731478
14741479bool IsObjCRequest::evaluate (Evaluator &evaluator, ValueDecl *VD) const {
1480+ DiagnosticStateRAII diagState (VD->getASTContext ().Diags );
1481+
14751482 // Access notes may add attributes that affect this calculus.
14761483 (void )evaluateOrDefault (evaluator, ApplyAccessNoteRequest{VD}, {});
14771484
@@ -2180,6 +2187,7 @@ lookupOverridenObjCMethod(ClassDecl *classDecl, AbstractFunctionDecl *method,
21802187
21812188bool swift::diagnoseUnintendedObjCMethodOverrides (SourceFile &sf) {
21822189 auto &Ctx = sf.getASTContext ();
2190+ DiagnosticStateRAII diagState (Ctx.Diags );
21832191 auto &methods = sf.ObjCMethodList ;
21842192
21852193 // If no Objective-C methods were defined in this file, we're done.
@@ -2284,6 +2292,7 @@ bool swift::diagnoseObjCMethodConflicts(SourceFile &sf) {
22842292 return false ;
22852293
22862294 auto &Ctx = sf.getASTContext ();
2295+ DiagnosticStateRAII diagState (Ctx.Diags );
22872296 OrderDeclarations ordering;
22882297
22892298 // Sort the set of conflicts so we get a deterministic order for
@@ -2389,6 +2398,7 @@ bool swift::diagnoseObjCUnsatisfiedOptReqConflicts(SourceFile &sf) {
23892398 return false ;
23902399
23912400 auto &Ctx = sf.getASTContext ();
2401+ DiagnosticStateRAII diagState (Ctx.Diags );
23922402
23932403 // Sort the set of local unsatisfied requirements, so we get a
23942404 // deterministic order for diagnostics.
0 commit comments