clang-tools
15.0.0git
|
A notable exception is URI translation. More...
#include <Marshalling.h>
A notable exception is URI translation.
Because paths to files are different on indexing machine and client machine ("/remote/machine/projects/llvm-project/llvm/include/HelloWorld.h" versus "/usr/local/username/llvm-project/llvm/include/HelloWorld.h"), they need to be converted appropriately. Remote machine strips the prefix (RemoteIndexRoot) from the absolute path and passes paths relative to the project root over the wire ("include/HelloWorld.h" in this example). The indexed project root is passed to the remote server. Client receives this relative path and constructs a URI that points to the relevant file in the filesystem. The relative path is appended to LocalIndexRoot to construct the full path and build the final URI.
Definition at line 36 of file Marshalling.h.
|
delete |
clang::clangd::remote::Marshaller::Marshaller | ( | llvm::StringRef | RemoteIndexRoot, |
llvm::StringRef | LocalIndexRoot | ||
) |
Definition at line 57 of file Marshalling.cpp.
llvm::Expected< clangd::FuzzyFindRequest > clang::clangd::remote::Marshaller::fromProtobuf | ( | const FuzzyFindRequest * | Message | ) |
Definition at line 89 of file Marshalling.cpp.
llvm::Expected< clangd::LookupRequest > clang::clangd::remote::Marshaller::fromProtobuf | ( | const LookupRequest * | Message | ) |
Definition at line 79 of file Marshalling.cpp.
References clang::clangd::LookupRequest::IDs, and clang::tidy::bugprone::Message.
llvm::Expected< clangd::Ref > clang::clangd::remote::Marshaller::fromProtobuf | ( | const Ref & | Message | ) |
Definition at line 182 of file Marshalling.cpp.
References clang::clangd::error(), and clang::tidy::bugprone::Message.
llvm::Expected< clangd::RefsRequest > clang::clangd::remote::Marshaller::fromProtobuf | ( | const RefsRequest * | Message | ) |
Definition at line 113 of file Marshalling.cpp.
References clang::clangd::All, clang::clangd::RefsRequest::Filter, clang::clangd::RefsRequest::IDs, clang::clangd::RefsRequest::Limit, and clang::tidy::bugprone::Message.
llvm::Expected< std::pair< clangd::SymbolID, clangd::Symbol > > clang::clangd::remote::Marshaller::fromProtobuf | ( | const Relation & | Message | ) |
Definition at line 195 of file Marshalling.cpp.
References clang::clangd::error(), fromProtobuf(), clang::clangd::SymbolID::fromStr(), clang::tidy::bugprone::Message, and clang::clangd::Object.
llvm::Expected< clangd::RelationsRequest > clang::clangd::remote::Marshaller::fromProtobuf | ( | const RelationsRequest * | Message | ) |
Definition at line 129 of file Marshalling.cpp.
References clang::clangd::error(), clang::clangd::RelationsRequest::Limit, clang::tidy::bugprone::Message, clang::clangd::RelationsRequest::Predicate, and clang::clangd::RelationsRequest::Subjects.
llvm::Expected< clangd::Symbol > clang::clangd::remote::Marshaller::fromProtobuf | ( | const Symbol & | Message | ) |
Definition at line 143 of file Marshalling.cpp.
References clang::clangd::error(), and clang::tidy::bugprone::Message.
Referenced by fromProtobuf().
llvm::Expected< std::string > clang::clangd::remote::Marshaller::relativePathToURI | ( | llvm::StringRef | RelativePath | ) |
Translates RelativePath
into the absolute path and builds URI for the user machine.
This translation happens on the client side with the RelativePath
received from remote index server and IndexRoot
is provided by the client.
The relative path passed over the wire has unix slashes.
Definition at line 312 of file Marshalling.cpp.
References clang::clangd::error().
FuzzyFindRequest clang::clangd::remote::Marshaller::toProtobuf | ( | const clangd::FuzzyFindRequest & | From | ) |
Definition at line 214 of file Marshalling.cpp.
References clang::clangd::FuzzyFindRequest::AnyScope, clang::clangd::FuzzyFindRequest::Limit, clang::clangd::FuzzyFindRequest::PreferredTypes, clang::clangd::FuzzyFindRequest::ProximityPaths, clang::clangd::FuzzyFindRequest::Query, clang::clangd::FuzzyFindRequest::RestrictForCodeCompletion, clang::clangd::FuzzyFindRequest::Scopes, and Type.
LookupRequest clang::clangd::remote::Marshaller::toProtobuf | ( | const clangd::LookupRequest & | From | ) |
toProtobuf() functions serialize native clangd types and strip IndexRoot from the file paths specific to indexing machine.
fromProtobuf() functions deserialize clangd types and translate relative paths into machine-native URIs.
Definition at line 207 of file Marshalling.cpp.
References clang::clangd::LookupRequest::IDs, and clang::clangd::SymbolID::str().
llvm::Expected< Ref > clang::clangd::remote::Marshaller::toProtobuf | ( | const clangd::Ref & | From | ) |
Definition at line 290 of file Marshalling.cpp.
RefsRequest clang::clangd::remote::Marshaller::toProtobuf | ( | const clangd::RefsRequest & | From | ) |
Definition at line 235 of file Marshalling.cpp.
References clang::clangd::RefsRequest::Filter, ID, clang::clangd::RefsRequest::IDs, and clang::clangd::RefsRequest::Limit.
RelationsRequest clang::clangd::remote::Marshaller::toProtobuf | ( | const clangd::RelationsRequest & | From | ) |
Definition at line 245 of file Marshalling.cpp.
References ID, clang::clangd::RelationsRequest::Limit, clang::clangd::RelationsRequest::Predicate, and clang::clangd::RelationsRequest::Subjects.
llvm::Expected< Symbol > clang::clangd::remote::Marshaller::toProtobuf | ( | const clangd::Symbol & | From | ) |
Definition at line 255 of file Marshalling.cpp.
llvm::Expected< Relation > clang::clangd::remote::Marshaller::toProtobuf | ( | const clangd::SymbolID & | Subject, |
const clangd::Symbol & | Object | ||
) |
Definition at line 300 of file Marshalling.cpp.
llvm::Expected< std::string > clang::clangd::remote::Marshaller::uriToRelativePath | ( | llvm::StringRef | URI | ) |
Translates a URI from the server's backing index to a relative path suitable to send over the wire to the client.
Definition at line 325 of file Marshalling.cpp.
References clang::clangd::error(), and clang::clangd::URI::parse().