@@ -794,7 +794,8 @@ void swift::ide::api::SDKNodeDeclType::diagnose(SDKNode *Right) {
794794 return ;
795795 auto Loc = R->getLoc ();
796796 if (getDeclKind () != R->getDeclKind ()) {
797- emitDiag (Loc, diag::decl_kind_changed, getDeclKindStr (R->getDeclKind ()));
797+ emitDiag (Loc, diag::decl_kind_changed, getDeclKindStr (R->getDeclKind (),
798+ getSDKContext ().getOpts ().CompilerStyle ));
798799 return ;
799800 }
800801
@@ -986,7 +987,8 @@ void swift::ide::api::SDKNodeDeclOperator::diagnose(SDKNode *Right) {
986987 return ;
987988 auto Loc = RO->getLoc ();
988989 if (getDeclKind () != RO->getDeclKind ()) {
989- emitDiag (Loc, diag::decl_kind_changed, getDeclKindStr (RO->getDeclKind ()));
990+ emitDiag (Loc, diag::decl_kind_changed, getDeclKindStr (RO->getDeclKind (),
991+ getSDKContext ().getOpts ().CompilerStyle ));
990992 }
991993}
992994
@@ -2121,7 +2123,8 @@ void DiagnosisEmitter::handle(const SDKNodeDecl *Node, NodeAnnotation Anno) {
21212123 if (auto *Added = findAddedDecl (Node)) {
21222124 if (Node->getDeclKind () != DeclKind::Constructor) {
21232125 Node->emitDiag (Added->getLoc (), diag::moved_decl,
2124- Ctx.buffer ((Twine (getDeclKindStr (Added->getDeclKind ())) + " " +
2126+ Ctx.buffer ((Twine (getDeclKindStr (Added->getDeclKind (),
2127+ Ctx.getOpts ().CompilerStyle )) + " " +
21252128 Added->getFullyQualifiedName ()).str ()));
21262129 return ;
21272130 }
@@ -2133,7 +2136,8 @@ void DiagnosisEmitter::handle(const SDKNodeDecl *Node, NodeAnnotation Anno) {
21332136 [&](TypeMemberDiffItem &Item) { return Item.usr == Node->getUsr (); });
21342137 if (It != MemberChanges.end ()) {
21352138 Node->emitDiag (SourceLoc (), diag::renamed_decl,
2136- Ctx.buffer ((Twine (getDeclKindStr (Node->getDeclKind ())) + " " +
2139+ Ctx.buffer ((Twine (getDeclKindStr (Node->getDeclKind (),
2140+ Ctx.getOpts ().CompilerStyle )) + " " +
21372141 It->newTypeName + " ." + It->newPrintedName ).str ()));
21382142 return ;
21392143 }
@@ -2190,7 +2194,8 @@ void DiagnosisEmitter::handle(const SDKNodeDecl *Node, NodeAnnotation Anno) {
21902194 DiagLoc = CD->getLoc ();
21912195 }
21922196 Node->emitDiag (DiagLoc, diag::renamed_decl,
2193- Ctx.buffer ((Twine (getDeclKindStr (Node->getDeclKind ())) + " " +
2197+ Ctx.buffer ((Twine (getDeclKindStr (Node->getDeclKind (),
2198+ Ctx.getOpts ().CompilerStyle )) + " " +
21942199 Node->getAnnotateComment (NodeAnnotation::RenameNewName)).str ()));
21952200 return ;
21962201 }
@@ -2701,6 +2706,8 @@ static CheckerOptions getCheckOpts(int argc, char *argv[]) {
27012706 // the checking logics are language-specific.
27022707 Opts.SwiftOnly = options::Abi || options::SwiftOnly;
27032708 Opts.SkipOSCheck = options::DisableOSChecks;
2709+ Opts.CompilerStyle = options::CompilerStyleDiags ||
2710+ !options::SerializedDiagPath.empty ();
27042711 for (int i = 1 ; i < argc; ++i)
27052712 Opts.ToolArgs .push_back (argv[i]);
27062713
0 commit comments