[clang-tools-extra] [clangd] Respect background index priority (PR #212700)

Aleksandr Platonov via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 29 03:48:17 PDT 2026


================
@@ -1361,6 +1361,16 @@ int endPreamble;
                   Source.range("inactive3"), Source.range("inactive4"))));
 }
 
+TEST(ClangdServer, BackgroundIndexPriorityPropagatesToIndexingThreads) {
+  auto Opts = ClangdServer::optsForTest();
+  for (auto Priority :
+       {llvm::ThreadPriority::Background, llvm::ThreadPriority::Low,
+        llvm::ThreadPriority::Default}) {
+    Opts.BackgroundIndexPriority = Priority;
+    EXPECT_EQ(BackgroundIndex::Options(Opts).IndexingPriority, Priority);
+  }
+}
----------------
ArcsinX wrote:

This test verifies that the newly introduced operator correctly sets the `IndexingPriority` field, but it does not verify that the original issue (where `BackgroundIndexPriority` was not being passed to the `BackgroundIndex` options) has actually been fixed.
Ideally, the test should look something like this: a `ClangdServer` object is created, and then we verify that the `BackgroundIndex` has actually got correct `IndexingPriority` based on `BackgroundIndexPriority` value.
I am not sure if the current interfaces allow to this check, but the test as it stands for now does not seem to be related to `ClangdServer` at all.

https://github.com/llvm/llvm-project/pull/212700


More information about the cfe-commits mailing list