[PATCH] D57739: [clangd] Format tweak's replacements.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 6 06:35:49 PST 2019


ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM! Also a few NITs.



================
Comment at: clangd/ClangdServer.cpp:155
     Opts.ClangTidyOpts = ClangTidyOptProvider->getOptions(File);
+  // FIXME: cache this
+  Opts.Style =
----------------
NIT: put `.` to the end of the comment.


================
Comment at: clangd/ClangdServer.cpp:378
       return CB(A.takeError());
     // FIXME: run formatter on top of resulting replacements.
+    return CB((*A)->apply(*Selection, InpAST->Inputs.Opts.Style));
----------------
This FIXME is stale now, remove?


================
Comment at: clangd/Format.h:19
+inline llvm::Expected<tooling::Replacements>
+cleanupAndFormat(StringRef Code, const tooling::Replacements &Replaces,
+                 const format::FormatStyle &Style) {
----------------
NIT: Maybe move to `SourceCode.h`? We have helpers to turn replacements into edits there, having this would be a good addition.
Or inline now that this function has only one call-site?

The extra file does not seem to carry its weight.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D57739





More information about the cfe-commits mailing list