| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_REMOTE_MARSHALLING_H |
| 10 |
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_REMOTE_MARSHALLING_H |
| 11 |
|
| 12 |
#include "Index.pb.h" |
| 13 |
#include "index/Index.h" |
| 14 |
#include "llvm/ADT/StringRef.h" |
| 15 |
#include "llvm/Support/StringSaver.h" |
| 16 |
|
| 17 |
namespace clang { |
| 18 |
namespace clangd { |
| 19 |
namespace remote { |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
class Marshaller { |
| 37 |
public: |
| 38 |
Marshaller() = delete; |
| 39 |
Marshaller(llvm::StringRef RemoteIndexRoot, llvm::StringRef LocalIndexRoot); |
| 40 |
|
| 41 |
llvm::Expected<clangd::Symbol> fromProtobuf(const Symbol &Message); |
| 42 |
llvm::Expected<clangd::Ref> fromProtobuf(const Ref &Message); |
| 43 |
llvm::Expected<std::pair<clangd::SymbolID, clangd::Symbol>> |
| 44 |
fromProtobuf(const Relation &Message); |
| 45 |
|
| 46 |
llvm::Expected<clangd::LookupRequest> |
| 47 |
fromProtobuf(const LookupRequest *Message); |
| 48 |
llvm::Expected<clangd::FuzzyFindRequest> |
| 49 |
fromProtobuf(const FuzzyFindRequest *Message); |
| 50 |
llvm::Expected<clangd::RefsRequest> fromProtobuf(const RefsRequest *Message); |
| 51 |
llvm::Expected<clangd::RelationsRequest> |
| 52 |
fromProtobuf(const RelationsRequest *Message); |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
LookupRequest toProtobuf(const clangd::LookupRequest &From); |
| 59 |
FuzzyFindRequest toProtobuf(const clangd::FuzzyFindRequest &From); |
| 60 |
RefsRequest toProtobuf(const clangd::RefsRequest &From); |
| 61 |
RelationsRequest toProtobuf(const clangd::RelationsRequest &From); |
| 62 |
|
| 63 |
llvm::Expected<Symbol> toProtobuf(const clangd::Symbol &From); |
| 64 |
llvm::Expected<Ref> toProtobuf(const clangd::Ref &From); |
| 65 |
llvm::Expected<Relation> toProtobuf(const clangd::SymbolID &Subject, |
| 66 |
const clangd::Symbol &Object); |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
llvm::Expected<std::string> relativePathToURI(llvm::StringRef RelativePath); |
| 75 |
|
| 76 |
|
| 77 |
llvm::Expected<std::string> uriToRelativePath(llvm::StringRef URI); |
| 78 |
|
| 79 |
private: |
| 80 |
clangd::SymbolLocation::Position fromProtobuf(const Position &Message); |
| 81 |
Position toProtobuf(const clangd::SymbolLocation::Position &Position); |
| 82 |
clang::index::SymbolInfo fromProtobuf(const SymbolInfo &Message); |
| 83 |
SymbolInfo toProtobuf(const clang::index::SymbolInfo &Info); |
| 84 |
llvm::Expected<clangd::SymbolLocation> |
| 85 |
fromProtobuf(const SymbolLocation &Message); |
| 86 |
llvm::Expected<SymbolLocation> |
| 87 |
toProtobuf(const clangd::SymbolLocation &Location); |
| 88 |
llvm::Expected<HeaderWithReferences> |
| 89 |
toProtobuf(const clangd::Symbol::IncludeHeaderWithReferences &IncludeHeader); |
| 90 |
llvm::Expected<clangd::Symbol::IncludeHeaderWithReferences> |
| 91 |
fromProtobuf(const HeaderWithReferences &Message); |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
std::string RemoteIndexRoot; |
| 99 |
std::string LocalIndexRoot; |
| 100 |
llvm::BumpPtrAllocator Arena; |
| 101 |
llvm::UniqueStringSaver Strings; |
| 102 |
}; |
| 103 |
|
| 104 |
} |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
#endif |