This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Make background index thread count calculation clearer
ClosedPublic

Authored by sammccall on Jun 22 2020, 11:44 PM.

Details

Summary

This confusion was inadvertently introduced in a change to the
heavyweight_hardware_concurrency API: 8404aeb56a73ab24f9b295111de3b37a37f0b841

  • don't indirect through the rebuilder policy when building the thread pool
  • document that rebuilder thresholds are exposed for testing only
  • don't use 0 as a sentinel value for "all threads", as we use it as a sentinel value for "synchronous" (though unsupported for BackgroundIndex)
  • rather than pick some new sentinel value, just always use 4 threads for tests

Diff Detail

Event Timeline

sammccall created this revision.Jun 22 2020, 11:44 PM

LGTM. Thanks for reverting.

kadircet accepted this revision.Jun 23 2020, 1:42 PM

Thanks LGTM!

clang-tools-extra/clangd/index/Background.h
140

maybe ClangdServer::optsForTest().AsyncThreadsCount instead of hardcoding 4 in another place ?

This revision is now accepted and ready to land.Jun 23 2020, 1:42 PM
sammccall marked an inline comment as done.Jun 24 2020, 3:17 PM
sammccall added inline comments.
clang-tools-extra/clangd/index/Background.h
140

This file doesn't/shouldn't depend on clangdserver though :-(

This revision was automatically updated to reflect the committed changes.