3838namespace clang {
3939namespace clangd {
4040
41- std::vector<Fix>
42- noLintFixes (const clang::tidy::ClangTidyContext &CTContext,
43- const clang::Diagnostic &Info, const Diag &Diag) {
41+ std::vector<Fix> noLintFixes (const clang::tidy::ClangTidyContext &CTContext,
42+ const clang::Diagnostic &Info, const Diag &Diag) {
4443 auto RuleName = CTContext.getCheckName (Diag.ID );
4544 if (
4645 // If this isn't a clang-tidy diag
@@ -53,15 +52,15 @@ noLintFixes(const clang::tidy::ClangTidyContext &CTContext,
5352 }
5453
5554 auto &SrcMgr = Info.getSourceManager ();
56- auto & DiagLoc = Info.getLocation ();
55+ auto DiagLoc = SrcMgr. getSpellingLoc ( Info.getLocation () );
5756
5857 auto F = Fix{};
5958 F.Message = llvm::formatv (" ignore [{0}] for this line" , RuleName);
6059 auto &E = F.Edits .emplace_back ();
6160
6261 auto File = SrcMgr.getFileID (DiagLoc);
63- auto CodeTilDiag = toSourceCode (
64- SrcMgr, SourceRange (SrcMgr. getLocForStartOfFile (File) , DiagLoc));
62+ auto FileLoc = SrcMgr. getLocForStartOfFile (File);
63+ auto CodeTilDiag = toSourceCode ( SrcMgr, SourceRange (FileLoc , DiagLoc));
6564
6665 auto StartCurLine = CodeTilDiag.find_last_of (' \n ' ) + 1 ;
6766 auto CurLine = CodeTilDiag.substr (StartCurLine);
@@ -94,9 +93,7 @@ noLintFixes(const clang::tidy::ClangTidyContext &CTContext,
9493}
9594
9695const auto Regex = std::regex(NoLintFixMsgRegexStr);
97- bool isNoLintFixes (const Fix &F) {
98- return std::regex_match (F.Message , Regex);
99- }
96+ bool isNoLintFixes (const Fix &F) { return std::regex_match (F.Message , Regex); }
10097
10198} // namespace clangd
10299} // namespace clang
0 commit comments