clang-tools 20.0.0git
|
A notable exception is URI translation. More...
#include <Marshalling.h>
Public Member Functions | |
Marshaller ()=delete | |
Marshaller (llvm::StringRef RemoteIndexRoot, llvm::StringRef LocalIndexRoot) | |
llvm::Expected< clangd::Symbol > | fromProtobuf (const Symbol &Message) |
llvm::Expected< clangd::Ref > | fromProtobuf (const Ref &Message) |
llvm::Expected< std::pair< clangd::SymbolID, clangd::Symbol > > | fromProtobuf (const Relation &Message) |
llvm::Expected< clangd::LookupRequest > | fromProtobuf (const LookupRequest *Message) |
llvm::Expected< clangd::FuzzyFindRequest > | fromProtobuf (const FuzzyFindRequest *Message) |
llvm::Expected< clangd::RefsRequest > | fromProtobuf (const RefsRequest *Message) |
llvm::Expected< clangd::RelationsRequest > | fromProtobuf (const RelationsRequest *Message) |
LookupRequest | toProtobuf (const clangd::LookupRequest &From) |
toProtobuf() functions serialize native clangd types and strip IndexRoot from the file paths specific to indexing machine. | |
FuzzyFindRequest | toProtobuf (const clangd::FuzzyFindRequest &From) |
RefsRequest | toProtobuf (const clangd::RefsRequest &From) |
RelationsRequest | toProtobuf (const clangd::RelationsRequest &From) |
llvm::Expected< Symbol > | toProtobuf (const clangd::Symbol &From) |
llvm::Expected< Ref > | toProtobuf (const clangd::Ref &From) |
llvm::Expected< Relation > | toProtobuf (const clangd::SymbolID &Subject, const clangd::Symbol &Object) |
llvm::Expected< std::string > | relativePathToURI (llvm::StringRef RelativePath) |
Translates RelativePath into the absolute path and builds URI for the user machine. | |
llvm::Expected< std::string > | 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. | |
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.
References clang::clangd::Type.
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.
llvm::Expected< clangd::Ref > clang::clangd::remote::Marshaller::fromProtobuf | ( | const Ref & | Message | ) |
Definition at line 183 of file Marshalling.cpp.
References clang::clangd::error(), and fromProtobuf().
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::clangd::RefsRequest::WantContainer.
llvm::Expected< std::pair< clangd::SymbolID, clangd::Symbol > > clang::clangd::remote::Marshaller::fromProtobuf | ( | const Relation & | Message | ) |
Definition at line 196 of file Marshalling.cpp.
References clang::clangd::error(), fromProtobuf(), clang::clangd::SymbolID::fromStr(), and clang::clangd::Object.
llvm::Expected< clangd::RelationsRequest > clang::clangd::remote::Marshaller::fromProtobuf | ( | const RelationsRequest * | Message | ) |
Definition at line 130 of file Marshalling.cpp.
References clang::clangd::error(), clang::clangd::RelationsRequest::Limit, clang::clangd::RelationsRequest::Predicate, and clang::clangd::RelationsRequest::Subjects.
llvm::Expected< clangd::Symbol > clang::clangd::remote::Marshaller::fromProtobuf | ( | const Symbol & | Message | ) |
Definition at line 144 of file Marshalling.cpp.
References clang::clangd::Declaration, clang::clangd::Definition, clang::clangd::error(), fromProtobuf(), clang::clangd::SymbolID::fromStr(), ID, and clang::clangd::Remote.
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 314 of file Marshalling.cpp.
References clang::clangd::URI::createFile(), and clang::clangd::error().
FuzzyFindRequest clang::clangd::remote::Marshaller::toProtobuf | ( | const clangd::FuzzyFindRequest & | From | ) |
Definition at line 215 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 clang::clangd::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 208 of file Marshalling.cpp.
References clang::clangd::LookupRequest::IDs, and clang::clangd::SymbolID::str().
Referenced by toProtobuf().
llvm::Expected< Ref > clang::clangd::remote::Marshaller::toProtobuf | ( | const clangd::Ref & | From | ) |
Definition at line 292 of file Marshalling.cpp.
References clang::clangd::Ref::Kind, clang::clangd::Ref::Location, and toProtobuf().
RefsRequest clang::clangd::remote::Marshaller::toProtobuf | ( | const clangd::RefsRequest & | From | ) |
Definition at line 236 of file Marshalling.cpp.
References clang::clangd::RefsRequest::Filter, ID, clang::clangd::RefsRequest::IDs, clang::clangd::RefsRequest::Limit, and clang::clangd::RefsRequest::WantContainer.
RelationsRequest clang::clangd::remote::Marshaller::toProtobuf | ( | const clangd::RelationsRequest & | From | ) |
Definition at line 247 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 257 of file Marshalling.cpp.
References clang::clangd::Symbol::CanonicalDeclaration, clang::clangd::Symbol::CompletionSnippetSuffix, clang::clangd::Declaration, clang::clangd::Definition, clang::clangd::Symbol::Definition, clang::clangd::Symbol::Documentation, clang::clangd::SymbolLocation::FileURI, clang::clangd::Symbol::Flags, clang::clangd::Symbol::ID, clang::clangd::Symbol::IncludeHeaders, clang::clangd::Symbol::Name, clang::clangd::Symbol::References, clang::clangd::Symbol::ReturnType, clang::clangd::Symbol::Scope, clang::clangd::Symbol::Signature, clang::clangd::SymbolID::str(), clang::clangd::Symbol::SymInfo, clang::clangd::Symbol::TemplateSpecializationArgs, toProtobuf(), and clang::clangd::Symbol::Type.
llvm::Expected< Relation > clang::clangd::remote::Marshaller::toProtobuf | ( | const clangd::SymbolID & | Subject, |
const clangd::Symbol & | Object | ||
) |
Definition at line 302 of file Marshalling.cpp.
References clang::clangd::Object, clang::clangd::SymbolID::str(), and toProtobuf().
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 327 of file Marshalling.cpp.
References clang::clangd::error(), and clang::clangd::URI::parse().