[clang-tools-extra] 7d591e1 - [clangd] Complete the fix for (Local|Remote)IndexRoot confusion
Kirill Bobyrev via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 21 02:53:34 PDT 2020
Author: Kirill Bobyrev
Date: 2020-07-21T11:53:17+02:00
New Revision: 7d591e123e0eb2d3415840de9c2b45c3742f0eaa
URL: https://github.com/llvm/llvm-project/commit/7d591e123e0eb2d3415840de9c2b45c3742f0eaa
DIFF: https://github.com/llvm/llvm-project/commit/7d591e123e0eb2d3415840de9c2b45c3742f0eaa.diff
LOG: [clangd] Complete the fix for (Local|Remote)IndexRoot confusion
Related revision: https://reviews.llvm.org/D83826
Added:
Modified:
clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp b/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
index e8393d17b01e..b6c83c974072 100644
--- a/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
+++ b/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
@@ -61,7 +61,7 @@ Marshaller::fromProtobuf(const FuzzyFindRequest *Request) {
Result.Limit = Request->limit();
Result.RestrictForCodeCompletion = Request->restricted_for_code_completion();
for (const auto &Path : Request->proximity_paths()) {
- llvm::SmallString<256> LocalPath = llvm::StringRef(*LocalIndexRoot);
+ llvm::SmallString<256> LocalPath = llvm::StringRef(*RemoteIndexRoot);
llvm::sys::path::append(LocalPath, Path);
Result.ProximityPaths.push_back(std::string(LocalPath));
}
@@ -157,7 +157,7 @@ FuzzyFindRequest Marshaller::toProtobuf(const clangd::FuzzyFindRequest &From) {
RPCRequest.set_restricted_for_code_completion(From.RestrictForCodeCompletion);
for (const auto &Path : From.ProximityPaths) {
llvm::SmallString<256> RelativePath = llvm::StringRef(Path);
- if (llvm::sys::path::replace_path_prefix(RelativePath, *RemoteIndexRoot,
+ if (llvm::sys::path::replace_path_prefix(RelativePath, *LocalIndexRoot,
""))
RPCRequest.add_proximity_paths(llvm::sys::path::convert_to_slash(
RelativePath, llvm::sys::path::Style::posix));
diff --git a/clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp b/clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp
index 6cc08144bef8..7db7c03d61c9 100644
--- a/clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp
+++ b/clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp
@@ -282,16 +282,16 @@ TEST(RemoteMarshallingTest, IncludeHeaderURIs) {
TEST(RemoteMarshallingTest, FuzzyFindRequestSerialization) {
clangd::FuzzyFindRequest Request;
- Request.ProximityPaths = {testPath("remote/Header.h"),
- testPath("remote/subdir/OtherHeader.h"),
- testPath("notremote/File.h"), "Not a Path."};
- Marshaller ProtobufMarshaller(testPath("remote/"), testPath("home/"));
+ Request.ProximityPaths = {testPath("local/Header.h"),
+ testPath("local/subdir/OtherHeader.h"),
+ testPath("remote/File.h"), "Not a Path."};
+ Marshaller ProtobufMarshaller(testPath("remote/"), testPath("local/"));
auto Serialized = ProtobufMarshaller.toProtobuf(Request);
EXPECT_EQ(Serialized.proximity_paths_size(), 2);
auto Deserialized = ProtobufMarshaller.fromProtobuf(&Serialized);
EXPECT_THAT(Deserialized.ProximityPaths,
- testing::ElementsAre(testPath("home/Header.h"),
- testPath("home/subdir/OtherHeader.h")));
+ testing::ElementsAre(testPath("remote/Header.h"),
+ testPath("remote/subdir/OtherHeader.h")));
}
TEST(RemoteMarshallingTest, RelativePathToURITranslation) {
More information about the cfe-commits
mailing list