This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Store references instead of unique_ptrs in ClangdServer.
ClosedPublic

Authored by ilya-biryukov on Jun 13 2017, 7:50 AM.

Details

Summary

ClangdServer was owning objects passed to it in constructor for no good reason.
Lots of stuff was moved from the heap to the stack thanks to this change.

Event Timeline

ilya-biryukov created this revision.Jun 13 2017, 7:50 AM
krasimir added inline comments.Jun 13 2017, 8:21 AM
clangd/ClangdLSPServer.h
75

This approach is still inflexible. I'd make ClangdLSPServer : public DiagnosticsConsumer and pass references to the CompilationDatabase and to the FileSystemProvider to its constructor. I'd create these two in ClangdMain.cpp.

krasimir accepted this revision.Jun 13 2017, 8:22 AM

But, of course, that can be done in a separate commit.

This revision is now accepted and ready to land.Jun 13 2017, 8:22 AM
This revision was automatically updated to reflect the committed changes.