[clangd] Rename -run-synchronously to -sync

llvm-svn: 361798
This commit is contained in:
Ilya Biryukov 2019-05-28 09:20:57 +00:00
parent 8e91dd7934
commit 536a62d007
6 changed files with 22 additions and 23 deletions

View File

@ -1,4 +1,4 @@
# RUN: clangd -input-style=delimited -run-synchronously -input-mirror-file %t < %s
# RUN: clangd -input-style=delimited -sync -input-mirror-file %t < %s
# RUN: grep '{"jsonrpc":"2.0","id":3,"method":"exit"}' %t
#
# RUN: clangd -lit-test -input-mirror-file %t < %s

View File

@ -1,4 +1,4 @@
# RUN: clangd -pretty -run-synchronously -input-mirror-file %t < %s
# RUN: clangd -pretty -sync -input-mirror-file %t < %s
# Note that we have to use '-b' as -input-mirror-file does not have a newline at the end of file.
# RUN: diff -b %t %s
# It is absolutely vital that this file has CRLF line endings.

View File

@ -1,5 +1,5 @@
# RUN: not clangd -pretty -run-synchronously -enable-test-uri-scheme < %s | FileCheck -strict-whitespace %s
# RUN: not clangd -pretty -run-synchronously -enable-test-uri-scheme < %s 2>&1 | FileCheck -check-prefix=STDERR %s
# RUN: not clangd -pretty -sync -enable-test-uri-scheme < %s | FileCheck -strict-whitespace %s
# RUN: not clangd -pretty -sync -enable-test-uri-scheme < %s 2>&1 | FileCheck -check-prefix=STDERR %s
# vim: fileformat=dos
# It is absolutely vital that this file has CRLF line endings.
#

View File

@ -1,5 +1,5 @@
# RUN: clangd -input-style=delimited -run-synchronously < %s 2>&1 | FileCheck %s
# RUN: clangd -lit-test -run-synchronously < %s 2>&1 | FileCheck %s
# RUN: clangd -input-style=delimited -sync < %s 2>&1 | FileCheck %s
# RUN: clangd -lit-test -sync < %s 2>&1 | FileCheck %s
#
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}

View File

@ -1,4 +1,4 @@
# RUN: not clangd -run-synchronously < %s 2>&1 | FileCheck -check-prefix=STDERR %s
# RUN: not clangd -sync < %s 2>&1 | FileCheck -check-prefix=STDERR %s
# vim: fileformat=dos
# It is absolutely vital that this file has CRLF line endings.
#

View File

@ -96,8 +96,8 @@ static llvm::cl::opt<Logger::Level> LogLevel(
static llvm::cl::opt<bool>
Test("lit-test",
llvm::cl::desc("Abbreviation for -input-style=delimited -pretty "
"-run-synchronously -enable-test-scheme -log=verbose. "
llvm::cl::desc("Abbreviation for -input-style=delimited -pretty -sync "
"-enable-test-scheme -log=verbose."
"Intended to simplify lit tests."),
llvm::cl::init(false), llvm::cl::Hidden);
@ -122,10 +122,9 @@ static llvm::cl::opt<int> LimitResults(
"0 means no limit. (default=100)"),
llvm::cl::init(100));
static llvm::cl::opt<bool> RunSynchronously(
"run-synchronously",
llvm::cl::desc("Parse on main thread. If set, -j is ignored"),
llvm::cl::init(false), llvm::cl::Hidden);
static llvm::cl::opt<bool>
Sync("sync", llvm::cl::desc("Parse on main thread. If set, -j is ignored"),
llvm::cl::init(false), llvm::cl::Hidden);
static llvm::cl::opt<Path>
ResourceDir("resource-dir",
@ -229,10 +228,10 @@ static llvm::cl::opt<std::string> ClangTidyChecks(
".clang-tidy files). Only meaningful when -clang-tidy flag is on."),
llvm::cl::init(""));
static llvm::cl::opt<bool> EnableClangTidy(
"clang-tidy",
llvm::cl::desc("Enable clang-tidy diagnostics."),
llvm::cl::init(true));
static llvm::cl::opt<bool>
EnableClangTidy("clang-tidy",
llvm::cl::desc("Enable clang-tidy diagnostics."),
llvm::cl::init(true));
static llvm::cl::opt<std::string>
FallbackStyle("fallback-style",
@ -343,7 +342,7 @@ int main(int argc, char *argv[]) {
"\n\thttps://clang.llvm.org/extra/clangd.html"
"\n\thttps://microsoft.github.io/language-server-protocol/");
if (Test) {
RunSynchronously = true;
Sync = true;
InputStyle = JSONStreamStyle::Delimited;
LogLevel = Logger::Verbose;
PrettyPrint = true;
@ -355,15 +354,15 @@ int main(int argc, char *argv[]) {
"test", "Test scheme for clangd lit tests.");
}
if (!RunSynchronously && WorkerThreadsCount == 0) {
if (!Sync && WorkerThreadsCount == 0) {
llvm::errs() << "A number of worker threads cannot be 0. Did you mean to "
"specify -run-synchronously?";
"specify -sync?";
return 1;
}
if (RunSynchronously) {
if (Sync) {
if (WorkerThreadsCount.getNumOccurrences())
llvm::errs() << "Ignoring -j because -run-synchronously is set.\n";
llvm::errs() << "Ignoring -j because -sync is set.\n";
WorkerThreadsCount = 0;
}
if (FallbackStyle.getNumOccurrences())
@ -461,7 +460,7 @@ int main(int argc, char *argv[]) {
if (auto Idx = loadIndex(IndexFile, /*UseDex=*/true))
Placeholder->reset(std::move(Idx));
});
if (RunSynchronously)
if (Sync)
AsyncIndexLoad.wait();
}
Opts.StaticIndex = StaticIdx.get();