diff --git a/clang-tools-extra/clangd/ClangdServer.h b/clang-tools-extra/clangd/ClangdServer.h index 0c920ae5d664..2b6a3ff92ff1 100644 --- a/clang-tools-extra/clangd/ClangdServer.h +++ b/clang-tools-extra/clangd/ClangdServer.h @@ -43,20 +43,22 @@ size_t positionToOffset(StringRef Code, Position P); Position offsetToPosition(StringRef Code, size_t Offset); /// A tag supplied by the FileSytemProvider. -typedef int VFSTag; +typedef std::string VFSTag; /// A value of an arbitrary type and VFSTag that was supplied by the /// FileSystemProvider when this value was computed. template class Tagged { public: template - Tagged(U &&Value, VFSTag Tag) : Value(std::forward(Value)), Tag(Tag) {} + Tagged(U &&Value, VFSTag Tag) + : Value(std::forward(Value)), Tag(std::move(Tag)) {} template Tagged(const Tagged &Other) : Value(Other.Value), Tag(Other.Tag) {} template - Tagged(Tagged &&Other) : Value(std::move(Other.Value)), Tag(Other.Tag) {} + Tagged(Tagged &&Other) + : Value(std::move(Other.Value)), Tag(std::move(Other.Tag)) {} T Value; VFSTag Tag; diff --git a/clang-tools-extra/unittests/clangd/ClangdTests.cpp b/clang-tools-extra/unittests/clangd/ClangdTests.cpp index b8b1fb2c1c59..ef24e64294de 100644 --- a/clang-tools-extra/unittests/clangd/ClangdTests.cpp +++ b/clang-tools-extra/unittests/clangd/ClangdTests.cpp @@ -386,13 +386,13 @@ TEST_F(ClangdVFSTest, CheckVersions) { auto FooCpp = getVirtualTestFilePath("foo.cpp"); const auto SourceContents = "int a;"; FS->Files[FooCpp] = SourceContents; - FS->Tag = 123; + FS->Tag = "123"; Server.addDocument(FooCpp, SourceContents); EXPECT_EQ(DiagConsumer->lastVFSTag(), FS->Tag); EXPECT_EQ(Server.codeComplete(FooCpp, Position{0, 0}).Tag, FS->Tag); - FS->Tag = 321; + FS->Tag = "321"; Server.addDocument(FooCpp, SourceContents); EXPECT_EQ(DiagConsumer->lastVFSTag(), FS->Tag); EXPECT_EQ(Server.codeComplete(FooCpp, Position{0, 0}).Tag, FS->Tag);