[clang] [clang-tools-extra] [clangd] Make clangd run `format::cleanupAroundReplacements()` for all code actions just as clang-tidy does (PR #118569)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 22 14:57:41 PST 2024


================
@@ -761,7 +762,37 @@ void StoreDiags::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
         return false;
       if (!isInsideMainFile(FixIt.RemoveRange.getBegin(), SM))
         return false;
-      Edits.push_back(toTextEdit(FixIt, SM, *LangOpts));
+
+      auto R = tooling::Replacement(SM, FixIt.RemoveRange, FixIt.CodeToInsert,
+                                    *LangOpts);
+      auto Err = Replacements->addOrMerge(R);
+      if (Err) {
----------------
llvm-beanz wrote:

```suggestion
      if (llvm:::Error Err = Replacements->addOrMerge(R)) {
```

https://github.com/llvm/llvm-project/pull/118569


More information about the cfe-commits mailing list