[PATCH] D34106: [clangd] Use 'std::string' for VFSTag instead of 'int'
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 13 01:25:25 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL305279: [clangd] Use 'std::string' for VFSTag instead of 'int' (authored by ibiryukov).
Changed prior to commit:
https://reviews.llvm.org/D34106?vs=102189&id=102298#toc
Repository:
rL LLVM
https://reviews.llvm.org/D34106
Files:
clang-tools-extra/trunk/clangd/ClangdServer.h
clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp
Index: clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp
===================================================================
--- clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp
+++ clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp
@@ -386,13 +386,13 @@
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);
Index: clang-tools-extra/trunk/clangd/ClangdServer.h
===================================================================
--- clang-tools-extra/trunk/clangd/ClangdServer.h
+++ clang-tools-extra/trunk/clangd/ClangdServer.h
@@ -43,20 +43,22 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34106.102298.patch
Type: text/x-patch
Size: 1921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170613/734d7623/attachment-0001.bin>
More information about the cfe-commits
mailing list