forked from OSchip/llvm-project
[clangd] Improve diagnostics in dexp interface
When running dexp in remote mode without --project-root it shuts down with an assertion. This is not the desired behaviour: instruct user on how to run it properly when the configuration is incorrect.
This commit is contained in:
parent
0057532e3f
commit
c6d2078a35
|
@ -30,10 +30,12 @@ llvm::cl::opt<std::string> IndexLocation(
|
|||
llvm::cl::Positional);
|
||||
|
||||
llvm::cl::opt<std::string>
|
||||
ExecCommand("c", llvm::cl::desc("Command to execute and then exit"));
|
||||
ExecCommand("c", llvm::cl::desc("Command to execute and then exit."));
|
||||
|
||||
llvm::cl::opt<std::string> ProjectRoot("project-root",
|
||||
llvm::cl::desc("Path to the project"));
|
||||
llvm::cl::opt<std::string> ProjectRoot(
|
||||
"project-root",
|
||||
llvm::cl::desc(
|
||||
"Path to the project. Required when connecting using remote index."));
|
||||
|
||||
static constexpr char Overview[] = R"(
|
||||
This is an **experimental** interactive tool to process user-provided search
|
||||
|
@ -373,10 +375,14 @@ int main(int argc, const char *argv[]) {
|
|||
llvm::cl::ResetCommandLineParser(); // We reuse it for REPL commands.
|
||||
llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
|
||||
|
||||
bool RemoteMode = llvm::StringRef(IndexLocation).startswith("remote:");
|
||||
if (RemoteMode && ProjectRoot.empty()) {
|
||||
llvm::errs() << "--project-root is required in remote mode\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::unique_ptr<SymbolIndex> Index;
|
||||
reportTime(llvm::StringRef(IndexLocation).startswith("remote:")
|
||||
? "Remote index client creation"
|
||||
: "Dex build",
|
||||
reportTime(RemoteMode ? "Remote index client creation" : "Dex build",
|
||||
[&]() { Index = openIndex(IndexLocation); });
|
||||
|
||||
if (!Index) {
|
||||
|
|
Loading…
Reference in New Issue