[clangd] Add command-line flag to set background indexing thread priority.
authorSam McCall <sam.mccall@gmail.com>
Mon, 16 May 2022 09:16:37 +0000 (11:16 +0200)
committerSam McCall <sam.mccall@gmail.com>
Tue, 17 May 2022 18:17:07 +0000 (20:17 +0200)
commit127a1492d72902e2b2cd8905c1198743761f52fb
tree6fe2291ebdd7e4d64bb8a407325b8759412a4b54
parent79a66ec97b4fb8cbc4e0a81ead356caf5507a6ea
[clangd] Add command-line flag to set background indexing thread priority.

This is a followup to D124715, which changed the default, and it anticipates
future patches raising the priority of Low (which is currently equal to
Background on Windows & Linux).
The main point is to allow users to restore the old behavior, which e.g.
allows efficiency cores to remain idle.

I did consider making this a config setting, this is a more complicated change:
 - needs to touch queue priorities as well as thread priorities
 - we don't know the priority until evaluating the config inside the task
 - users would want the ability to prioritize background indexing tasks relative
   to each other without necessarily affecting thread priority, so using one
   option for both may be confusing
I don't really have a use case, so I prefer the simpler thing.

Differential Revision: https://reviews.llvm.org/D125673
clang-tools-extra/clangd/ClangdServer.h
clang-tools-extra/clangd/index/Background.cpp
clang-tools-extra/clangd/index/Background.h
clang-tools-extra/clangd/tool/ClangdMain.cpp