This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Move helpers that convert Replacements to TextEdits to SourceCode.h
ClosedPublic

Authored by ioeric on May 9 2018, 6:22 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

ioeric created this revision.May 9 2018, 6:22 PM
ioeric updated this revision to Diff 146082.May 10 2018, 12:41 AM
  • [clangd] Add helper for collecting #include directives in file.
ilya-biryukov accepted this revision.May 11 2018, 2:51 AM

LGTM, just a few non-blocking NITs with questions.

clangd/SourceCode.cpp
180 ↗(On Diff #146082)

NIT: the comment about json array does not make any sense, given that we merely return a vector.
(that was true before the change too)

clangd/SourceCode.h
62 ↗(On Diff #146082)

Do we really need to expose separate functions for vector<tooling::Replacement> and tooling::Replacements, given that both are trivial: loop over the array, convert each item?
Having them in .cpp file didn't hurt, but they seems redundant in the public header.
WDYT?

This revision is now accepted and ready to land.May 11 2018, 2:51 AM
ioeric updated this revision to Diff 146303.May 11 2018, 4:49 AM
ioeric marked 2 inline comments as done.
  • Got rid of a helper for std::vector<Replacement>
clangd/SourceCode.h
62 ↗(On Diff #146082)

Good point. Use of std::vector<Replacement> should be discouraged anyway. I removed this function and inline the conversion for std::vector<Replacement> as this is only used in rename (which should probably be fixed to use tooling::Replacements instead).

This revision was automatically updated to reflect the committed changes.