diff --git a/clang-tools-extra/clangd/ConfigCompile.cpp b/clang-tools-extra/clangd/ConfigCompile.cpp index dadc578c3a81d..b4f0d61868863 100644 --- a/clang-tools-extra/clangd/ConfigCompile.cpp +++ b/clang-tools-extra/clangd/ConfigCompile.cpp @@ -321,8 +321,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 d9aa171f31029..4961d3474fd9a 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) {