[PATCH] D92202: [clangd] Add symbol origin for remote index
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 26 18:51:50 PST 2020
kbobyrev created this revision.
kbobyrev added a reviewer: sammccall.
Herald added subscribers: cfe-commits, usaxena95, arphaman.
Herald added a project: clang.
kbobyrev requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.
Makes it easier to diagnose remote index issues with --debug-origins flag.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92202
Files:
clang-tools-extra/clangd/index/SymbolOrigin.cpp
clang-tools-extra/clangd/index/SymbolOrigin.h
clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp
Index: clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp
+++ clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp
@@ -16,6 +16,7 @@
#include "index/Symbol.h"
#include "index/SymbolID.h"
#include "index/SymbolLocation.h"
+#include "index/SymbolOrigin.h"
#include "index/remote/marshalling/Marshalling.h"
#include "clang/Index/IndexSymbol.h"
#include "llvm/ADT/SmallString.h"
@@ -73,7 +74,7 @@
Sym.CanonicalDeclaration = Location;
Sym.References = 9000;
- Sym.Origin = clangd::SymbolOrigin::Static;
+ Sym.Origin = clangd::SymbolOrigin::Static | clangd::SymbolOrigin::Remote;
Sym.Signature = Strings.save("(int X, char Y, Type T)");
Sym.TemplateSpecializationArgs = Strings.save("<int, char, bool, Type>");
Sym.CompletionSnippetSuffix =
Index: clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
===================================================================
--- clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
+++ clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
@@ -161,7 +161,8 @@
return Declaration.takeError();
Result.CanonicalDeclaration = *Declaration;
Result.References = Message.references();
- Result.Origin = static_cast<clangd::SymbolOrigin>(Message.origin());
+ Result.Origin = static_cast<clangd::SymbolOrigin>(Message.origin()) |
+ clangd::SymbolOrigin::Remote;
Result.Signature = Message.signature();
Result.TemplateSpecializationArgs = Message.template_specialization_args();
Result.CompletionSnippetSuffix = Message.completion_snippet_suffix();
Index: clang-tools-extra/clangd/index/SymbolOrigin.h
===================================================================
--- clang-tools-extra/clangd/index/SymbolOrigin.h
+++ clang-tools-extra/clangd/index/SymbolOrigin.h
@@ -25,6 +25,7 @@
Static = 1 << 2, // From the static, externally-built index.
Merge = 1 << 3, // A non-trivial index merge was performed.
Identifier = 1 << 4, // Raw identifiers in file.
+ Remote = 1 << 5, // Remote index.
// Remaining bits reserved for index implementations.
};
Index: clang-tools-extra/clangd/index/SymbolOrigin.cpp
===================================================================
--- clang-tools-extra/clangd/index/SymbolOrigin.cpp
+++ clang-tools-extra/clangd/index/SymbolOrigin.cpp
@@ -14,7 +14,7 @@
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, SymbolOrigin O) {
if (O == SymbolOrigin::Unknown)
return OS << "unknown";
- constexpr static char Sigils[] = "ADSMI567";
+ constexpr static char Sigils[] = "ADSMIR67";
for (unsigned I = 0; I < sizeof(Sigils); ++I)
if (static_cast<uint8_t>(O) & 1u << I)
OS << Sigils[I];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92202.307946.patch
Type: text/x-patch
Size: 2861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201127/6598b7df/attachment.bin>
More information about the cfe-commits
mailing list