[clang-tools-extra] b9b708e - [clangd] Log a message when gRPC support is off, but remote-index is configured
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 9 06:53:33 PDT 2021
Author: Kadir Cetinkaya
Date: 2021-04-09T15:52:51+02:00
New Revision: b9b708eef8cb7bcb073361283cd573beb04992a9
URL: https://github.com/llvm/llvm-project/commit/b9b708eef8cb7bcb073361283cd573beb04992a9
DIFF: https://github.com/llvm/llvm-project/commit/b9b708eef8cb7bcb073361283cd573beb04992a9.diff
LOG: [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
Added:
Modified:
clang-tools-extra/clangd/ConfigCompile.cpp
clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/ConfigCompile.cpp b/clang-tools-extra/clangd/ConfigCompile.cpp
index 8f402ae061535..1185eb7255b4c 100644
--- a/clang-tools-extra/clangd/ConfigCompile.cpp
+++ b/clang-tools-extra/clangd/ConfigCompile.cpp
@@ -322,8 +322,9 @@ struct FragmentCompiler {
llvm::SMRange BlockRange) {
#ifndef CLANGD_ENABLE_REMOTE
if (External.Server) {
- diag(Error, "Clangd isn't compiled with remote index support, ignoring "
- "Server." External.Server->Range);
+ elog("Clangd isn't compiled with remote index support, ignoring Server: "
+ "{0}",
+ *External.Server);
External.Server.reset();
}
#endif
diff --git a/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp b/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
index b68d7e5f5e173..f2c27c22fdeb9 100644
--- a/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
@@ -324,15 +324,15 @@ TEST_F(ConfigCompileTests, ExternalBlockWarnOnMultipleSource) {
External.Server.emplace("");
Frag.Index.External = std::move(External);
compileAndApply();
- llvm::StringLiteral ExpectedDiag =
#ifdef CLANGD_ENABLE_REMOTE
- "Exactly one of File or Server must be set.";
+ EXPECT_THAT(
+ Diags.Diagnostics,
+ Contains(AllOf(DiagMessage("Exactly one of File or Server must be set."),
+ DiagKind(llvm::SourceMgr::DK_Error))));
#else
- "Clangd isn't compiled with remote index support, ignoring Server.";
+ ASSERT_TRUE(Conf.Index.External.hasValue());
+ EXPECT_EQ(Conf.Index.External->Kind, Config::ExternalIndexSpec::File);
#endif
- EXPECT_THAT(Diags.Diagnostics,
- Contains(AllOf(DiagMessage(ExpectedDiag),
- DiagKind(llvm::SourceMgr::DK_Error))));
}
TEST_F(ConfigCompileTests, ExternalBlockErrOnNoSource) {
More information about the cfe-commits
mailing list