This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Load static index asynchronously, add tracing.
ClosedPublic

Authored by sammccall on Sep 4 2018, 8:54 AM.

Details

Summary

Like D51475 but simplified based on recent patches.
While here, clarify that loadIndex() takes a filename, not file content.

Event Timeline

sammccall created this revision.Sep 4 2018, 8:54 AM
ioeric accepted this revision.Sep 4 2018, 9:00 AM

lg. Thanks!

This revision is now accepted and ready to land.Sep 4 2018, 9:00 AM
This revision was automatically updated to reflect the committed changes.
ilya-biryukov added inline comments.Sep 5 2018, 12:17 AM
clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
287 ↗(On Diff #163847)

Wouldn't the future returned by runAsync wait in destructor?

288 ↗(On Diff #163847)

What happens if clangd tries to exit before the index is loaded?
Could lead to crashes.

I think you're right - this isn't actually asynchronous (I didn't manage to test that!), and if it were it'd interfere with clean shutdown.

I think both issues can be addressed by assigning the future to a variable scoped to main. Will send a patch.