[PATCH] D91103: [tooling] Add support for fixits that indicate code will need reformatting

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 01:00:10 PST 2020


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/Diagnostics.cpp:636
+    // Filter out any reformat fixits, we don't handle these.
+    // FIXME: Can we?
+    llvm::erase_if(FixIts,
----------------
in theory yes, as we have access to source manager, we can fetch file contents and create formatted  replacements (see `cleanupAndFormat`). but formatting those fixes can imply significant delays on clangd's diagnostic cycles (if there are many of those), that's the reason why we currently don't format fixits.


================
Comment at: clang-tools-extra/clangd/Diagnostics.cpp:637
+    // FIXME: Can we?
+    llvm::erase_if(FixIts,
+                   [](const FixItHint &Fix) { return Fix.isReformatFixit(); });
----------------
rather than doing an extra loop, can we just skip those in the for loop below ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91103/new/

https://reviews.llvm.org/D91103



More information about the cfe-commits mailing list