1 //===--- Client.h - Connect to a remote index via gRPC -----------*- C++-*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_REMOTE_INDEX_H 10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_REMOTE_INDEX_H 11 12 #include "index/Index.h" 13 #include "llvm/ADT/StringRef.h" 14 15 namespace clang { 16 namespace clangd { 17 namespace remote { 18 19 /// Returns an SymbolIndex client that passes requests to remote index located 20 /// at \p Address. The client allows synchronous RPC calls. 21 /// \p IndexRoot is an absolute path on the local machine to the source tree 22 /// described by the remote index. Paths returned by the index will be treated 23 /// as relative to this directory. 24 /// 25 /// This method attempts to resolve the address and establish the connection. 26 /// 27 /// \returns nullptr if the address is not resolved during the function call or 28 /// if the project was compiled without Remote Index support. 29 std::unique_ptr<clangd::SymbolIndex> getClient(llvm::StringRef Address, 30 llvm::StringRef IndexRoot); 31 32 } // namespace remote 33 } // namespace clangd 34 } // namespace clang 35 36 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_REMOTE_INDEX_H 37