Author: ibiryukov Date: Tue Jun 13 03:24:48 2017 New Revision: 305279 URL: http://llvm.org/viewvc/llvm-project?rev=305279&view=rev Log: [clangd] Use 'std::string' for VFSTag instead of 'int'
Reviewers: krasimir Reviewed By: krasimir Subscribers: klimek, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D34106 Modified: clang-tools-extra/trunk/clangd/ClangdServer.h clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp Modified: clang-tools-extra/trunk/clangd/ClangdServer.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.h?rev=305279&r1=305278&r2=305279&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/ClangdServer.h (original) +++ clang-tools-extra/trunk/clangd/ClangdServer.h Tue Jun 13 03:24:48 2017 @@ -43,20 +43,22 @@ size_t positionToOffset(StringRef Code, 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 T> class Tagged { public: template <class U> - Tagged(U &&Value, VFSTag Tag) : Value(std::forward<U>(Value)), Tag(Tag) {} + Tagged(U &&Value, VFSTag Tag) + : Value(std::forward<U>(Value)), Tag(std::move(Tag)) {} template <class U> Tagged(const Tagged<U> &Other) : Value(Other.Value), Tag(Other.Tag) {} template <class U> - Tagged(Tagged<U> &&Other) : Value(std::move(Other.Value)), Tag(Other.Tag) {} + Tagged(Tagged<U> &&Other) + : Value(std::move(Other.Value)), Tag(std::move(Other.Tag)) {} T Value; VFSTag Tag; Modified: clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp?rev=305279&r1=305278&r2=305279&view=diff ============================================================================== --- clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp (original) +++ clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp Tue Jun 13 03:24:48 2017 @@ -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); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits