summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/Protocol.cpp
diff options
context:
space:
mode:
authorNathan Ridge <zeratul976@hotmail.com>2019-07-13 03:24:48 +0000
committerNathan Ridge <zeratul976@hotmail.com>2019-07-13 03:24:48 +0000
commit087b044c4915717a51f8c0adb18eca5ae7a4f994 (patch)
tree159bdd1369a73cbbc379f05e92d444a31e1712e4 /clang-tools-extra/clangd/Protocol.cpp
parent81b03d4a08b16217669fcccb96e7cc436ab3d74a (diff)
downloadbcm5719-llvm-087b044c4915717a51f8c0adb18eca5ae7a4f994.tar.gz
bcm5719-llvm-087b044c4915717a51f8c0adb18eca5ae7a4f994.zip
[clangd] Implement typeHierarchy/resolve for subtypes
Summary: This allows the client to resolve subtypes one level at a time. For supertypes, this is not necessary, because we eagerly compute supertypes and return all levels. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64308 llvm-svn: 365986
Diffstat (limited to 'clang-tools-extra/clangd/Protocol.cpp')
-rw-r--r--clang-tools-extra/clangd/Protocol.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp
index 7c70afb567d..600896b1eee 100644
--- a/clang-tools-extra/clangd/Protocol.cpp
+++ b/clang-tools-extra/clangd/Protocol.cpp
@@ -422,8 +422,7 @@ bool fromJSON(const llvm::json::Value &Params,
bool fromJSON(const llvm::json::Value &Params,
DocumentRangeFormattingParams &R) {
llvm::json::ObjectMapper O(Params);
- return O && O.map("textDocument", R.textDocument) &&
- O.map("range", R.range);
+ return O && O.map("textDocument", R.textDocument) && O.map("range", R.range);
}
bool fromJSON(const llvm::json::Value &Params,
@@ -445,8 +444,8 @@ bool fromJSON(const llvm::json::Value &Params, DocumentSymbolParams &R) {
llvm::json::Value toJSON(const DiagnosticRelatedInformation &DRI) {
return llvm::json::Object{
- {"location", DRI.location},
- {"message", DRI.message},
+ {"location", DRI.location},
+ {"message", DRI.message},
};
}
@@ -978,6 +977,8 @@ llvm::json::Value toJSON(const TypeHierarchyItem &I) {
Result["parents"] = I.parents;
if (I.children)
Result["children"] = I.children;
+ if (I.data)
+ Result["data"] = I.data;
return std::move(Result);
}
@@ -996,10 +997,18 @@ bool fromJSON(const llvm::json::Value &Params, TypeHierarchyItem &I) {
O.map("deprecated", I.deprecated);
O.map("parents", I.parents);
O.map("children", I.children);
+ O.map("data", I.data);
return true;
}
+bool fromJSON(const llvm::json::Value &Params,
+ ResolveTypeHierarchyItemParams &P) {
+ llvm::json::ObjectMapper O(Params);
+ return O && O.map("item", P.item) && O.map("resolve", P.resolve) &&
+ O.map("direction", P.direction);
+}
+
bool fromJSON(const llvm::json::Value &Params, ReferenceParams &R) {
TextDocumentPositionParams &Base = R;
return fromJSON(Params, Base);
OpenPOWER on IntegriCloud