Skip to content

Commit 0cbbf06

Browse files
kadircettstellar
authored andcommitted
[clangd] Log a message when gRPC support is off, but remote-index is configured
Before this change clangd would emit a diagnostic whenever remote-index was configured but binary didn't have grpc support. This can be annoying when projects are configuring remote-index through their configs but developers have a clangd binary without the support. Differential Revision: https://reviews.llvm.org/D100103 (cherry picked from commit b9b708e)
1 parent 25dd67e commit 0cbbf06

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

clang-tools-extra/clangd/ConfigCompile.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,9 @@ struct FragmentCompiler {
321321
llvm::SMRange BlockRange) {
322322
#ifndef CLANGD_ENABLE_REMOTE
323323
if (External.Server) {
324-
diag(Error, "Clangd isn't compiled with remote index support, ignoring "
325-
"Server." External.Server->Range);
324+
elog("Clangd isn't compiled with remote index support, ignoring Server: "
325+
"{0}",
326+
*External.Server);
326327
External.Server.reset();
327328
}
328329
#endif

clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,15 +324,15 @@ TEST_F(ConfigCompileTests, ExternalBlockWarnOnMultipleSource) {
324324
External.Server.emplace("");
325325
Frag.Index.External = std::move(External);
326326
compileAndApply();
327-
llvm::StringLiteral ExpectedDiag =
328327
#ifdef CLANGD_ENABLE_REMOTE
329-
"Exactly one of File or Server must be set.";
328+
EXPECT_THAT(
329+
Diags.Diagnostics,
330+
Contains(AllOf(DiagMessage("Exactly one of File or Server must be set."),
331+
DiagKind(llvm::SourceMgr::DK_Error))));
330332
#else
331-
"Clangd isn't compiled with remote index support, ignoring Server.";
333+
ASSERT_TRUE(Conf.Index.External.hasValue());
334+
EXPECT_EQ(Conf.Index.External->Kind, Config::ExternalIndexSpec::File);
332335
#endif
333-
EXPECT_THAT(Diags.Diagnostics,
334-
Contains(AllOf(DiagMessage(ExpectedDiag),
335-
DiagKind(llvm::SourceMgr::DK_Error))));
336336
}
337337

338338
TEST_F(ConfigCompileTests, ExternalBlockErrOnNoSource) {

0 commit comments

Comments
 (0)